summaryrefslogtreecommitdiff
path: root/plugins/!NotAdopted/SmartAutoReplier/GUI/OptionsDlg.h
blob: 0e2e91f1913b890a6681819c533243a0be4f1f6c (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
 *  Smart Auto Replier (SAR) - auto replier plugin for Miranda IM
 *
 *  Copyright (C) 2004 - 2012 by Volodymyr M. Shcherbyna <volodymyr@shcherbyna.com>
 *
 *      This file is part of SAR.
 *
 *  SAR 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 3 of the License, or
 *  (at your option) any later version.
 *
 *  SAR 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 SAR.  If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

/// #warning: redeclaring....quick programming ;)
/// look at stdafx.h
#ifndef REFRESH_OPTS_MSG
	#define REFRESH_OPTS_MSG WM_USER + 666
#endif

#include <commctrl.h>
#include <atlbase.h>
#include <atlapp.h>
#include <atlwin.h>
#include <atlctrls.h>

/// here is a wrapper on options dlg
class COptionsDlg : public CDialogImpl<COptionsDlg>, public CMessageFilter
{
public:	
	COptionsDlg(void);
	virtual ~COptionsDlg(void);
public:
	enum {IDD = IDD_OPTIONS};
	BEGIN_MSG_MAP(COptionsDlg)
		MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
		MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
		MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
		MESSAGE_HANDLER(REFRESH_OPTS_MSG, OnRefreshOptions)
		COMMAND_ID_HANDLER(IDC_BTN_ADDRULE, OnBtnAddRuleClick)
		COMMAND_ID_HANDLER(IDC_BTN_DELRULE, OnBtnDeleteRuleClick)
		COMMAND_ID_HANDLER(IDC_BTN_EDITRULE, OnBtnEditRuleClick)
		COMMAND_ID_HANDLER(IDC_EDIT_REPLAYDELAY, OnEditReply)
		COMMAND_ID_HANDLER(IDC_EDIT_HEADER, OnEditHeader)
		COMMAND_ID_HANDLER(IDC_EDIT_MESSAGE, OnEditMessage)
		COMMAND_CODE_HANDLER(LBN_SELCHANGE, OnListBoxSelChanged)
		COMMAND_HANDLER(IDC_LIST_RULES, LBN_DBLCLK, OnLbnDblclkListRules)
		COMMAND_HANDLER(IDC_CHECK_DISABLEWMON, BN_CLICKED, OnBnClickedCheck)
		COMMAND_HANDLER(IDC_CH_ENABLE_WSCH, BN_CLICKED, OnBnCheckEnableWhenModeIsOn)
		COMMAND_HANDLER(IDC_CH_SHOWCG, BN_CLICKED, OnBnCheckEnableWhenModeIsOn)
		COMMAND_HANDLER(IDC_CH_SAVE_AURS, BN_CLICKED, OnCheckSaveToHistory)
		COMMAND_HANDLER(IDC_CB_ENWSC, CBN_SELENDOK, OnCbnSelchangeCbEnwsc)
		COMMAND_HANDLER(IDC_CH_DISWHSB, BN_CLICKED, OnBnCheckDisableWhenModeIsOn)
		COMMAND_HANDLER(IDC_CB_DWSB, CBN_SELENDOK, OnCbnSelchangeCbDisnwsc)
	END_MSG_MAP()
	virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
	/// messages handlers prototypes
	LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT OnNotify(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT OnRefreshOptions(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	
	/// commands handlers prototypes
	LRESULT OnBtnAddRuleClick(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnBtnDeleteRuleClick(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnBtnEditRuleClick(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnEditReply(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnEditHeader(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnEditMessage(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnListBoxSelChanged(WORD wParam, WORD wParam2, HWND hwnd, BOOL & bHandled); 
	LRESULT OnBnClickedCheck(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnBnCheckEnableWhenModeIsOn(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnCbnSelchangeCbEnwsc(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnBnCheckDisableWhenModeIsOn(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnCheckSaveToHistory(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnCbnSelchangeCbDisnwsc(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnLbnDblclkListRules(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
public:
	static BOOL CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
private:
	void OnNotifyAboutChanges(void);
	void OnSetSelInRulesList(int nIndex);
protected:
	CEdit m_editReplayDelay;		/// edit box where reply delay is specifyed
	CEdit m_editMessageText;		/// edit box where message text is specifyed
	CListBox m_listRules;			/// list box where all rules are specifyed
	CButton m_btnAdd;				/// button add rule
	CButton m_btnDel;				/// button delete rule
	CButton m_btnChange;			/// button change rule
	CWindow m_wndCheckDOnSOn;		/// checkbox that specifyes dis of plug. when mir is on
	CComboBox m_cbModeTypes;		/// cb mode types
	CWindow m_wndCheckModeTypes;	/// ch mode types
	CWindow m_chbShowAurWhmc;		/// ch show edit reply message
	CWindow m_chDisWMB;				/// ch disable when mode becomes...
	CWindow m_chSaveAURSToHist;		/// save aurs to history
	CComboBox m_cbDisWMBTypes;		/// cb disable when mode becomes...
private:	
	LPTSTR	m_szMessage;
	int		m_nReplayDelay;
	bool	m_bDestroying;
protected:
	bool m_bShown;
public:
	HWND m_hwndHolder;
};

/// here is static dlg proc for options dialog..
/// very bad but mirand can accept only this function
BOOL CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);