summaryrefslogtreecommitdiff
path: root/plugins/AuthState/src/options.cpp
blob: 8ff821714ba89d6aa5a113e2b136bb36f899a3f0 (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
55
56
57
58
59
60
/*
   Authorization State plugin for Miranda NG (www.miranda-ng.org)
   (c) 2006-2010 by Thief

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   */

#include "stdafx.h"

class COptionsDialog : public CDlgBase
{
	CCtrlCheck m_chkAuthIcon;
	CCtrlCheck m_chkGrantIcon;
	CCtrlCheck m_chkMenuItem;
	CCtrlCheck m_chkOnlyForRecent;

public:
	COptionsDialog() : 
		CDlgBase(g_plugin, IDD_AUTHSTATE_OPT),
		m_chkAuthIcon(this, IDC_AUTHICON),
		m_chkGrantIcon(this, IDC_GRANTICON),
		m_chkMenuItem(this, IDC_ENABLEMENUITEM),
		m_chkOnlyForRecent(this, IDC_ICONSFORRECENT)
	{
		CreateLink(m_chkAuthIcon, g_plugin.bUseAuthIcon);
		CreateLink(m_chkGrantIcon, g_plugin.bUseGrantIcon);
		CreateLink(m_chkMenuItem, g_plugin.bContactMenuItem);
		CreateLink(m_chkOnlyForRecent, g_plugin.bIconsForRecentContacts);
	}

	bool OnApply() override
	{
		for (auto &hContact : Contacts())
			onExtraImageApplying((WPARAM)hContact, 0);
		return true;
	}
};

int onOptInitialise(WPARAM wParam, LPARAM)
{
	OPTIONSDIALOGPAGE odp = {};
	odp.szGroup.a = LPGEN("Icons");
	odp.szTitle.a = LPGEN("Auth state");
	odp.flags = ODPF_BOLDGROUPS;
	odp.pDialog = new COptionsDialog();
	g_plugin.addOptions(wParam, &odp);
	return 0;
}