summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src/mlua_options.h
blob: cc4171938ffba6eebd7c53ff47ad38ae18b14f68 (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
#ifndef _LUA_OPTIONS_H_
#define _LUA_OPTIONS_H_

class CCtrlScriptList : public CCtrlListView
{
private:
	typedef CCtrlListView CSuper;

protected:
	BOOL OnNotify(int idCtrl, NMHDR *pnmh);

public:
	CCtrlScriptList(CDlgBase* dlg, int ctrlId);

	CCallback<TEventInfo> OnClick;
};


class CMLuaOptions : public CDlgBase
{
private:
	CCtrlCheck m_popupOnError;
	CCtrlCheck m_popupOnObsolete;

	bool isScriptListInit;
	CCtrlScriptList m_scripts;
	CCtrlButton m_reload;

	void LoadScripts();

protected:
	void OnInitDialog();
	void OnApply();

	void OnScriptListClick(CCtrlListView::TEventInfo *evt);
	void OnReload(CCtrlBase*);

	INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam);

public:
	CMLuaOptions(int idDialog);

	void CreateLink(CCtrlData& ctrl, const char *szSetting, BYTE type, DWORD iValue);
	void CreateLink(CCtrlData& ctrl, const char *szSetting, TCHAR *szValue);

	static int OnOptionsInit(WPARAM wParam, LPARAM);

	template<class T>
	__inline void CreateLink(CCtrlData &ctrl, CMOption<T> &option)
	{
		ctrl.CreateDbLink(new CMOptionLink<T>(option));
	}

	static CDlgBase *CreateOptionsPage() { return new CMLuaOptions(IDD_OPTIONS); }
};

#endif //_LUA_OPTIONS_H_