summaryrefslogtreecommitdiff
path: root/plugins/ExternalAPI/m_skinengine.h
blob: 98b3e8843a81da9354d92d24d35f1f78f5f21c8c (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
struct ISkinBackend;
struct ISkinElement;

struct SkinRenderParams
{
	HDC hdc;
	RECT rc;
};

struct ISkinDataSource
{
	virtual LPCTSTR GetText(const TCHAR *key) = 0;
	virtual HICON GetIcon(const TCHAR *key) = 0;
	virtual HBITMAP GetBitmap(const TCHAR *key) = 0;
	virtual ISkinBackend *GetObject(const TCHAR *key) = 0;
};

struct ISkinElement
{
	// general manadgement
	virtual void SetParent(ISkinElement *parent) = 0;
	virtual void LoadFromXml(HXML hXml) = 0;
	virtual void SetId(const TCHAR *id) = 0;
	virtual void SetDataSource(ISkinDataSource *ds) = 0;
	virtual void Destroy() = 0;

	// rendering and layouting
	virtual void Measure(SkinRenderParams *params) = 0;
	virtual void Layout(SkinRenderParams *params) = 0;
	virtual void Paint(SkinRenderParams *params) = 0;

	// element tree
	virtual bool IsComplexObject() = 0;
	virtual ISkinElement *GetParent() = 0;
	virtual int GetChildCount() = 0;
	virtual ISkinElement *GetChild(int index) = 0;
	virtual bool AppendChild(ISkinElement *child) = 0;
	virtual bool InsertChild(ISkinElement *child, int index) = 0;
	virtual void RemoveChild(ISkinElement *child) = 0;

	// element properties
	virtual void SetPropText(const TCHAR *key, const TCHAR *value) = 0;
	virtual const TCHAR *GetPropText(const TCHAR *key, const TCHAR *value) = 0;
	virtual void SetPropInt(const TCHAR *key, int value) = 0;
	virtual void SetPropIntText(const TCHAR *key, const TCHAR *value) = 0;
	virtual int GetPropInt(const TCHAR *key) = 0;
};

struct ISkinBackend
{
	virtual LPCTSTR GetText(const TCHAR *key) = 0;
	virtual HICON GetIcon(const TCHAR *key) = 0;
	virtual HBITMAP GetBitmap(const TCHAR *key) = 0;
	virtual ISkinBackend *GetObject(const TCHAR *key) = 0;
};