summaryrefslogtreecommitdiff
path: root/protocols/CurrencyRates/src/WinCtrlHelper.cpp
blob: f45c4db53661a823d5344dc011f473140a8b1b4c (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);

		tostringstream o;
		for (auto &spec : aSpecificators)
			o << spec.first << '\t' << spec.second << L"\r\n";
		::SetDlgItemText(m_hwnd, IDC_EDIT_VARIABLE, o.str().c_str());
		return true;
	}
};

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