summaryrefslogtreecommitdiff
path: root/plugins/Toaster/src/options.cpp
blob: be08b5cf16e371e56f223338596f34e94dbb2258 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "stdafx.h"

COptions::COptions()
	: CDlgBase(g_plugin, IDD_OPTIONS_MAIN),
	m_shortcut(this, IDC_SHORTCUT),
	m_preview(this, IDC_PREVIEW),
	m_enabled(this, IDC_CHECK_ENABLED)
{
	m_shortcut.OnClick = Callback(this, &COptions::Shortcut_OnClick);
	m_preview.OnClick = Callback(this, &COptions::Preview_OnClick);
	m_enabled.OnChange = Callback(this, &COptions::Enabled_OnChange);
}

bool COptions::OnInitDialog()
{
	m_enabled.SetState(Popup_Enabled());
	return true;
}

void COptions::Shortcut_OnClick(CCtrlBase*)
{
	if (FAILED(TryCreateShortcut()))
		PUShowMessageW(TranslateT("Failed to create shortcut"), SM_ERROR);
	else
		PUShowMessageW(TranslateT("Shortcut was added to the start menu"), SM_NOTIFY);
}

void COptions::Preview_OnClick(CCtrlBase*)
{
	PUShowMessageW(TranslateT("Information"), SM_NOTIFY);
	PUShowMessageW(TranslateT("Warning"), SM_WARNING);
	PUShowMessageW(TranslateT("Error"), SM_ERROR);
}

void COptions::Enabled_OnChange(CCtrlCheck* chk)
{
	Popup_Enable(chk->GetState());
}

/////////////////////////////////////////////////////////////////////////////////

int OnOptionsInitialized(WPARAM wParam, LPARAM)
{
	OPTIONSDIALOGPAGE odp = {};
	odp.szTitle.w = L"Popups";
	odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
	odp.position = -790000000;
	odp.szTab.w = _T(MODULENAME);
	odp.pDialog = new COptions();
	g_plugin.addOptions(wParam, &odp);

	return 0;
}