summaryrefslogtreecommitdiff
path: root/protocols/CurrencyRates/src/WinCtrlHelper.cpp
blob: 7d6087f44ef5076ce87be872ae1441660f12f528 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "stdafx.h"

class CVariableListDlg : public CDlgBase
{
	const ICurrencyRatesProvider *m_pProvider;

public:
	CVariableListDlg(HWND hwndParent, const ICurrencyRatesProvider *pProvider) :
		CDlgBase(g_plugin, IDD_DIALOG_VARIABLE_LIST),
		m_pProvider(pProvider)
	{
		SetParent(hwndParent);
	}

	bool OnInitDialog() override
	{
		TFormatSpecificators aSpecificators;
		m_pProvider->FillFormat(aSpecificators);

		CMStringW str;
		for (auto &spec : aSpecificators)
			str.AppendFormat(L"%s\t%s\r\n", spec.first, TranslateW(spec.second));
		::SetDlgItemTextW(m_hwnd, IDC_EDIT_VARIABLE, str);
		return true;
	}
};

void show_variable_list(HWND hwndParent, const ICurrencyRatesProvider *pProvider)
{
	CVariableListDlg(hwndParent, pProvider).DoModal();
}