summaryrefslogtreecommitdiff
path: root/plugins/Skins/SkinLib/SkinOptions.h
blob: 41d238a5a15bc7ebc447da6a23b0ee36ec618b4e (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
#ifndef __SKINNED_DIALOG_OPTIONS_H__
# define __SKINNED_DIALOG_OPTIONS_H__

#include <windows.h>
#include "tstring.h"
#include <vector>


enum SkinOptionType
{
	CHECKBOX,
	NUMBER,
	TEXT
};

class SkinOption;

typedef void (*SkinOptionCallback)(void *param, const SkinOption *opt);


class SkinOption
{
public:
	SkinOption(const char *name);
	~SkinOption();

	const char * getName() const;

	SkinOptionType getType() const;
	void setType(SkinOptionType type);

	const TCHAR * getDescription() const;
	void setDescription(const TCHAR * description);

	int getMax() const;
	void setMax(int max);

	int getMin() const;
	void setMin(int min);

	bool getValueCheckbox() const;
	void setValueCheckbox(bool value);

	int getValueNumber() const;
	void setValueNumber(int value);

	const TCHAR * getValueText() const;
	void setValueText(const TCHAR * value);

	void setOnChangeCallback(SkinOptionCallback cb, void *param = NULL);

private:
	std::string name;
	SkinOptionType type;
	std::tstring description;
	bool valueCheckbox;
	int valueNumber;
	int minValue;
	int maxValue;
	std::tstring valueText;

	SkinOptionCallback onChangeCallback;
	void * onChangeCallbackParam;

	void fireOnChange();
};


class SkinOptions
{
public:
	SkinOptions();
	~SkinOptions();

	bool addOption(SkinOption *opt);
	SkinOption * getOption(const char *name) const;
	SkinOption * getOption(unsigned int pos) const;
	unsigned int getNumOptions() const;
	void clearOptions();

	void setOnOptionAddRemoveCallback(SkinOptionCallback cb, void *param = NULL);
	void setOnOptionChangeCallback(SkinOptionCallback cb, void *param = NULL);

private:
	std::vector<SkinOption *> options;

	SkinOptionCallback onAddRemoveCallback;
	void * onAddRemoveCallbackParam;

	SkinOptionCallback onChangeCallback;
	void * onChangeCallbackParam;

	void fireOnAddRemove(SkinOption *opt);
};



#endif // __SKINNED_DIALOG_OPTIONS_H__