summaryrefslogtreecommitdiff
path: root/plugins/CurrencyRates/src/WinCtrlHelper.cpp
blob: 0d00422146f42e8b1d362b2720f2e34108334c2a (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();
}