summaryrefslogtreecommitdiff
path: root/plugins/Skins/SkinLib/Field.h
blob: 4cf7faaa5161c5e5450e92cede810474940418dc (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
#ifndef __FIELD_H__
# define __FIELD_H__

#include <windows.h>
#include <tchar.h>
#include "tstring.h"
#include "Size.h"
#include "Position.h"


enum FieldType
{
	SIMPLE_TEXT = 1,
	SIMPLE_IMAGE,
	SIMPLE_ICON,
	CONTROL_LABEL,
	CONTROL_BUTTON,
	CONTROL_EDIT,
	USER_DEFINED = 0x100
};

class Dialog;
class DialogState;
class Field;
class FieldState;

typedef void (*FieldCallback)(void *param, const Field *field);


class Field
{
public:
	Field(Dialog *dlg, const char *name);
	virtual ~Field();

	virtual Dialog * getDialog() const;
	virtual const char * getName() const;
	virtual FieldType getType() const = 0;

	virtual bool isEnabled() const;
	virtual void setEnabled(bool enabled);

	virtual const TCHAR * getToolTip() const;
	virtual void setToolTip(const TCHAR *tooltip);

	virtual FieldState * createState(DialogState *dialogState) = 0;

	virtual void setOnChangeCallback(FieldCallback cb, void *param = NULL);

protected:
	void fireOnChange() const;

private:
	Dialog *dlg;
	const std::string name;
	bool enabled;
	std::tstring tooltip;

	FieldCallback onChangeCallback;
	void *onChangeCallbackParam;
};




#endif // __FIELD_H__