summaryrefslogtreecommitdiff
path: root/plugins/modernb/_disabled_src/skinpp_private.h
blob: d3d2ced2204388f814be3101b6197dcf18e57c64 (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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/**************************************************************************\

This program 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 2
of the License, or (at your option) any later version.

This program 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 this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

****************************************************************************

Created: Nov 9, 2006

Author:  Artem Shpynov aka FYR:  ashpynov@gmail.com

****************************************************************************

File contains class definitions for skinpp system

\**************************************************************************/

#ifndef skinpp_private_h__
#define skinpp_private_h__

#ifdef UNICODE
#define tstring wstring
#else 
#define tstring string
#endif

using namespace std;
template<class string>
struct OBJLIST_myless : public binary_function <string, string, bool> 
{
	bool operator()(
		const string& _Left, 
		const string& _Right
		) const
	{
		return (bool) (stricmp(_Left.c_str(),_Right.c_str())<0);
	}
};

typedef map<string, class skinpp_SKINOBJECT*, OBJLIST_myless<string> > OBJLIST;
typedef OBJLIST::const_iterator OBJLIST_ITER;

typedef list<class skinpp_SELECTOR* > SELECTORLIST;
typedef SELECTORLIST::const_iterator SELECTORLIST_ITER;



class skinpp_SKIN
{
public:
	//constructor and destructor
	skinpp_SKIN();
	~skinpp_SKIN();
	HRESULT LoadSkin(const char * szFileName);
	HRESULT LoadSkinFromMemory(const char * szBuffer);
	HRESULT SaveSkin(const char * szFileName);

	class skinpp_SKINOBJECT * FindObjectByName(char * szName);
	class skinpp_SKINOBJECT * FindObjectByRule(char * szSelector);
	class skinpp_SKINOBJECT * FindObjectBySelector(class skinpp_SELECTOR * lpSelector);
private:
	HRESULT GetDataFromXMLDocument();		// convert skin data from xmldocument nodes
	HRESULT PutDataToXMLDocument();			// convert skin data to xmldocument nodes
	void ClearSkin();						// remove all data from skin	

	XMLDocument* m_lpXMLDocument;		// XML document loaded from
	OBJLIST		 m_ObjectList;			// map of objects
	SELECTORLIST m_SelectorList;		// list of selectors
	// list of buttons ???
	// map of skinable db keys

	string	m_strSkinName;
	string	m_strSkinAuthor;
	string	m_strSkinAbout;
	string  m_strAuthorMail;
	string  m_strSkinWeb;

};

#include "skinpp_object.h"

class skinpp_SOLID: public skinpp_SKINOBJECT
{
public:
	//constructor and destructor
	skinpp_SOLID();
	~skinpp_SOLID();

	virtual int GetObjectDataFromXMLNode(XMLNode * lpNode);	// gets data from node
	virtual int PutObjectDataToXMLNode(XMLNode * lpNode);	// put data to node

    // data of solid brush object
    BYTE    m_bOpacity;     // Common brush opacity
    DWORD   m_dwColor;      // Color of solid brush
};

class skinpp_GRADIENT: public skinpp_SKINOBJECT
{
public:
	//constructor and destructor
	skinpp_GRADIENT();
	~skinpp_GRADIENT();

	virtual int GetObjectDataFromXMLNode(XMLNode * lpNode);	// gets data from node
	virtual int PutObjectDataToXMLNode(XMLNode * lpNode);	// put data to node

    // data of gradient brush object
    BYTE    m_bStartOpacity;     // start brush opacity
    DWORD   m_dwStartColor;      // start color of gradient brush
    BYTE    m_bEndOpacity;       // end brush opacity
    DWORD   m_dwEndColor;        // end color of gradient brush
    BYTE    m_bDirection;       
};

class skinpp_EMPTY: public skinpp_SKINOBJECT
{
public:
	//constructor and destructor
	skinpp_EMPTY();
	~skinpp_EMPTY();

	virtual int GetObjectDataFromXMLNode(XMLNode * lpNode);	// gets data from node
	virtual int PutObjectDataToXMLNode(XMLNode * lpNode);	// put data to node
};

class skinpp_SELECTOR
{
public:
	//constructor and destructor
};

#endif // skinpp_private_h__