1 | /* |
---|
2 | orxonox - the future of 3D-vertical-scrollers |
---|
3 | |
---|
4 | Copyright (C) 2004 orx |
---|
5 | |
---|
6 | This program is free software; you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation; either version 2, or (at your option) |
---|
9 | any later version. |
---|
10 | |
---|
11 | ### File Specific: |
---|
12 | main-programmer: ... |
---|
13 | co-programmer: ... |
---|
14 | */ |
---|
15 | |
---|
16 | //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ |
---|
17 | |
---|
18 | #include "glgui_style.h" |
---|
19 | |
---|
20 | #include "loading/load_param.h" |
---|
21 | |
---|
22 | namespace OrxGui |
---|
23 | { |
---|
24 | |
---|
25 | |
---|
26 | /** |
---|
27 | * @brief standard constructor |
---|
28 | */ |
---|
29 | GLGuiStyle::GLGuiStyle (const TiXmlElement* root) |
---|
30 | { |
---|
31 | _font = NULL; |
---|
32 | this->reset(); |
---|
33 | |
---|
34 | |
---|
35 | if (root != NULL) |
---|
36 | this->loadParams(root); |
---|
37 | |
---|
38 | } |
---|
39 | |
---|
40 | |
---|
41 | /** |
---|
42 | * @brief standard deconstructor |
---|
43 | */ |
---|
44 | GLGuiStyle::~GLGuiStyle () |
---|
45 | { |
---|
46 | // delete what has to be deleted here |
---|
47 | } |
---|
48 | |
---|
49 | void GLGuiStyle::reset() |
---|
50 | { |
---|
51 | this->setBorderLeft(1.0); |
---|
52 | this->setBorderRight(1.0); |
---|
53 | this->setBorderTop(1.0); |
---|
54 | this->setBorderBottom(1.0); |
---|
55 | |
---|
56 | this->setTextSize(20.0); |
---|
57 | this->setBackgroundColor(1.0); |
---|
58 | this->setForegroundColor(1.0); |
---|
59 | |
---|
60 | this->setFeaturePosition(FeatureLeft); |
---|
61 | this->setFont(NULL); |
---|
62 | |
---|
63 | this->setAnimated(true); |
---|
64 | this->setAnimatedStateChanges(true); |
---|
65 | } |
---|
66 | |
---|
67 | void GLGuiStyle::loadParams(const TiXmlElement* root) |
---|
68 | {} |
---|
69 | |
---|
70 | void GLGuiStyle::setBorderLeft(float value) |
---|
71 | { |
---|
72 | for (unsigned int i = 0; i < GLGUI_STATE_COUNT; ++i) |
---|
73 | setBorderLeft(value, (OrxGui::State)i); |
---|
74 | } |
---|
75 | |
---|
76 | void GLGuiStyle::setBorderLeft(float value, OrxGui::State state) |
---|
77 | { |
---|
78 | _style[state]._borderLeft = value; |
---|
79 | } |
---|
80 | |
---|
81 | void GLGuiStyle::setBorderLeftS(float value, const std::string& state) |
---|
82 | { |
---|
83 | } |
---|
84 | |
---|
85 | |
---|
86 | void GLGuiStyle::setBorderRight(float value) |
---|
87 | { |
---|
88 | for (unsigned int i = 0; i < GLGUI_STATE_COUNT; ++i) |
---|
89 | setBorderRight(value, (OrxGui::State)i); |
---|
90 | } |
---|
91 | |
---|
92 | void GLGuiStyle::setBorderRight(float value, OrxGui::State state) |
---|
93 | { |
---|
94 | _style[state]._borderRight = value; |
---|
95 | } |
---|
96 | |
---|
97 | void GLGuiStyle::setBorderRightS(float value, const std::string& state) |
---|
98 | {} |
---|
99 | |
---|
100 | |
---|
101 | void GLGuiStyle::setBorderTop(float value) |
---|
102 | { |
---|
103 | for (unsigned int i = 0; i < GLGUI_STATE_COUNT; ++i) |
---|
104 | setBorderTop(value, (OrxGui::State)i); |
---|
105 | } |
---|
106 | |
---|
107 | void GLGuiStyle::setBorderTop(float value, OrxGui::State state) |
---|
108 | { |
---|
109 | _style[state]._borderTop = value; |
---|
110 | } |
---|
111 | |
---|
112 | void GLGuiStyle::setBorderTopS(float value, const std::string& state) |
---|
113 | {} |
---|
114 | |
---|
115 | |
---|
116 | void GLGuiStyle::setBorderBottom(float value) |
---|
117 | { |
---|
118 | for (unsigned int i = 0; i < GLGUI_STATE_COUNT; ++i) |
---|
119 | setBorderBottom(value, (OrxGui::State)i); |
---|
120 | } |
---|
121 | |
---|
122 | void GLGuiStyle::setBorderBottom(float value, OrxGui::State state) |
---|
123 | { |
---|
124 | _style[state]._borderBottom = value; |
---|
125 | } |
---|
126 | |
---|
127 | void GLGuiStyle::setBorderBottomS(float value, const std::string& state) |
---|
128 | {} |
---|
129 | |
---|
130 | |
---|
131 | void GLGuiStyle::setTextSize(float value) |
---|
132 | { |
---|
133 | for (unsigned int i = 0; i < GLGUI_STATE_COUNT; ++i) |
---|
134 | setTextSize(value, (OrxGui::State)i); |
---|
135 | } |
---|
136 | |
---|
137 | void GLGuiStyle::setTextSize(float value, OrxGui::State state) |
---|
138 | { |
---|
139 | _style[state]._textSize = value; |
---|
140 | } |
---|
141 | |
---|
142 | void GLGuiStyle::setTextSizeS(float value, const std::string& state) |
---|
143 | {} |
---|
144 | |
---|
145 | |
---|
146 | void GLGuiStyle::setBackgroundColor(const Color& color) |
---|
147 | { |
---|
148 | for (unsigned int i = 0; i < GLGUI_STATE_COUNT; ++i) |
---|
149 | setBackgroundColor(color, (OrxGui::State)i); |
---|
150 | } |
---|
151 | |
---|
152 | void GLGuiStyle::setBackgroundColor(const Color& color, OrxGui::State state) |
---|
153 | { |
---|
154 | _style[state]._backgroundColor = color; |
---|
155 | } |
---|
156 | |
---|
157 | void GLGuiStyle::setBackgroundColorS(float r, float g, float b, float a, const std::string& state) |
---|
158 | {} |
---|
159 | |
---|
160 | |
---|
161 | void GLGuiStyle::setBackgroundTexture(const Texture& texture) |
---|
162 | { |
---|
163 | for (unsigned int i = 0; i < GLGUI_STATE_COUNT; ++i) |
---|
164 | setBackgroundTexture(texture, (OrxGui::State)i); |
---|
165 | } |
---|
166 | |
---|
167 | void GLGuiStyle::setBackgroundTexture(const Texture& texture, OrxGui::State state) |
---|
168 | { |
---|
169 | _style[state]._backgroundTexture = texture; |
---|
170 | } |
---|
171 | |
---|
172 | void GLGuiStyle::setBackgroundTexture(const std::string& textureName, const std::string& state) |
---|
173 | {} |
---|
174 | |
---|
175 | |
---|
176 | void GLGuiStyle::setForegroundColor(const Color& color) |
---|
177 | { |
---|
178 | for (unsigned int i = 0; i < GLGUI_STATE_COUNT; ++i) |
---|
179 | setForegroundColor(color, (OrxGui::State)i); |
---|
180 | } |
---|
181 | |
---|
182 | void GLGuiStyle::setForegroundColor(const Color& color, OrxGui::State state) |
---|
183 | { |
---|
184 | _style[state]._foregroundColor = color; |
---|
185 | } |
---|
186 | |
---|
187 | void GLGuiStyle::setForegroundColorS(float r, float g, float b, float a, const std::string& state) |
---|
188 | {} |
---|
189 | |
---|
190 | |
---|
191 | |
---|
192 | void GLGuiStyle::setFeaturePosition(FeaturePosition featurePosition) |
---|
193 | { |
---|
194 | this->_featurePosition = featurePosition; |
---|
195 | } |
---|
196 | |
---|
197 | void GLGuiStyle::setFeaturePosition(const std::string& featurePosition) |
---|
198 | {} |
---|
199 | |
---|
200 | |
---|
201 | void GLGuiStyle::setFont(Font* font) |
---|
202 | { |
---|
203 | this->_font = font; |
---|
204 | } |
---|
205 | |
---|
206 | void GLGuiStyle::setFont(const std::string& fontName) |
---|
207 | { |
---|
208 | //this->font = new Font(fontName); |
---|
209 | } |
---|
210 | |
---|
211 | |
---|
212 | void GLGuiStyle::setAnimated(bool animated) |
---|
213 | { |
---|
214 | this->_animated = animated; |
---|
215 | } |
---|
216 | |
---|
217 | void GLGuiStyle::setAnimatedStateChanges(bool animated) |
---|
218 | { |
---|
219 | this->_animatedStateChanges = animated; |
---|
220 | } |
---|
221 | |
---|
222 | } |
---|