summaryrefslogtreecommitdiff
path: root/plugins/CurrencyRates/src/WinCtrlHelper.cpp
blob: 1b2daf3cb7a3ec5c58ce314e9fc402c62507d882 (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
	{
		CCurrencyRatesProviderVisitorFormatSpecificator visitor;
		m_pProvider->Accept(visitor);

		tostringstream o;
		for (auto &spec : visitor.GetSpecificators())
			o << spec.m_sSymbol << '\t' << spec.m_sDesc << 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();
}