aboutsummaryrefslogtreecommitdiff
path: root/src/ScreenResources.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2004-04-19 22:43:19 (GMT)
committerfluxgen <fluxgen>2004-04-19 22:43:19 (GMT)
commit2bef72c390eb0bc968382bc66ce5176e22417ea9 (patch)
tree36dab05a64e7b7797658642c6098786d55d35566 /src/ScreenResources.cc
parentabda1490d862606989664355d35d391eecbe8ffa (diff)
downloadfluxbox-2bef72c390eb0bc968382bc66ce5176e22417ea9.zip
fluxbox-2bef72c390eb0bc968382bc66ce5176e22417ea9.tar.bz2
moved from Screen
Diffstat (limited to 'src/ScreenResources.cc')
-rw-r--r--src/ScreenResources.cc265
1 files changed, 265 insertions, 0 deletions
diff --git a/src/ScreenResources.cc b/src/ScreenResources.cc
new file mode 100644
index 0000000..f7de944
--- /dev/null
+++ b/src/ScreenResources.cc
@@ -0,0 +1,265 @@
1// holds screen resource handling
2
3#include "Screen.hh"
4#include <string>
5using namespace std;
6
7template <>
8void FbTk::Resource<BScreen::PlacementPolicy>::setDefaultValue() {
9 *(*this) = BScreen::ROWSMARTPLACEMENT;
10}
11
12template <>
13void FbTk::Resource<BScreen::PlacementPolicy>::setFromString(const char *str) {
14 if (strcasecmp("RowSmartPlacement", str) == 0)
15 *(*this) = BScreen::ROWSMARTPLACEMENT;
16 else if (strcasecmp("ColSmartPlacement", str) == 0)
17 *(*this) = BScreen::COLSMARTPLACEMENT;
18 else if (strcasecmp("UnderMousePlacement", str) == 0)
19 *(*this) = BScreen::UNDERMOUSEPLACEMENT;
20 else if (strcasecmp("CascadePlacement", str) == 0)
21 *(*this) = BScreen::CASCADEPLACEMENT;
22 else
23 setDefaultValue();
24
25}
26
27template <>
28string FbTk::Resource<BScreen::PlacementPolicy>::getString() {
29 switch (*(*this)) {
30 case BScreen::ROWSMARTPLACEMENT:
31 return "RowSmartPlacement";
32 case BScreen::COLSMARTPLACEMENT:
33 return "ColSmartPlacement";
34 case BScreen::UNDERMOUSEPLACEMENT:
35 return "UnderMousePlacement";
36 case BScreen::CASCADEPLACEMENT:
37 return "CascadePlacement";
38 }
39
40 return "RowSmartPlacement";
41}
42
43template <>
44void FbTk::Resource<BScreen::RowDirection>::setDefaultValue() {
45 *(*this) = BScreen::LEFTRIGHT;
46}
47
48template <>
49void FbTk::Resource<BScreen::RowDirection>::setFromString(const char *str) {
50 if (strcasecmp("LeftToRight", str) == 0)
51 *(*this) = BScreen::LEFTRIGHT;
52 else if (strcasecmp("RightToLeft", str) == 0)
53 *(*this) = BScreen::RIGHTLEFT;
54 else
55 setDefaultValue();
56
57}
58
59template <>
60string FbTk::Resource<BScreen::RowDirection>::getString() {
61 switch (*(*this)) {
62 case BScreen::LEFTRIGHT:
63 return "LeftToRight";
64 case BScreen::RIGHTLEFT:
65 return "RightToLeft";
66 }
67
68 return "LeftToRight";
69}
70
71
72template <>
73void FbTk::Resource<BScreen::ColumnDirection>::setDefaultValue() {
74 *(*this) = BScreen::TOPBOTTOM;
75}
76
77template <>
78void FbTk::Resource<BScreen::ColumnDirection>::setFromString(const char *str) {
79 if (strcasecmp("TopToBottom", str) == 0)
80 *(*this) = BScreen::TOPBOTTOM;
81 else if (strcasecmp("BottomToTop", str) == 0)
82 *(*this) = BScreen::BOTTOMTOP;
83 else
84 setDefaultValue();
85
86}
87
88template <>
89string FbTk::Resource<BScreen::ColumnDirection>::getString() {
90 switch (*(*this)) {
91 case BScreen::TOPBOTTOM:
92 return "TopToBottom";
93 case BScreen::BOTTOMTOP:
94 return "BottomToTop";
95 }
96
97 return "TopToBottom";
98}
99
100template <>
101void FbTk::Resource<FbTk::MenuTheme::MenuMode>::setDefaultValue() {
102 *(*this) = FbTk::MenuTheme::DELAY_OPEN;
103}
104
105template <>
106string FbTk::Resource<FbTk::MenuTheme::MenuMode>::getString() {
107 switch (*(*this)) {
108 case FbTk::MenuTheme::DELAY_OPEN:
109 return string("Delay");
110 case FbTk::MenuTheme::CLICK_OPEN:
111 return string("Click");
112 }
113 return string("Delay");
114}
115
116template <>
117void FbTk::Resource<FbTk::MenuTheme::MenuMode>::setFromString(const char *str) {
118 if (strcasecmp(str, "Delay") == 0)
119 *(*this) = FbTk::MenuTheme::DELAY_OPEN;
120 else if (strcasecmp(str, "Click") == 0)
121 *(*this) = FbTk::MenuTheme::CLICK_OPEN;
122 else
123 setDefaultValue();
124}
125
126template<>
127std::string FbTk::Resource<BScreen::FocusModel>::
128getString() {
129 switch (m_value) {
130 case BScreen::SLOPPYFOCUS:
131 return string("SloppyFocus");
132 case BScreen::SEMISLOPPYFOCUS:
133 return string("SemiSloppyFocus");
134 case BScreen::CLICKTOFOCUS:
135 return string("ClickToFocus");
136 }
137 // default string
138 return string("ClickToFocus");
139}
140
141template<>
142void FbTk::Resource<BScreen::FocusModel>::
143setFromString(char const *strval) {
144 // auto raise options here for backwards read compatibility
145 // they are not supported for saving purposes. Nor does the "AutoRaise"
146 // part actually do anything
147 if (strcasecmp(strval, "SloppyFocus") == 0
148 || strcasecmp(strval, "AutoRaiseSloppyFocus") == 0)
149 m_value = BScreen::SLOPPYFOCUS;
150 else if (strcasecmp(strval, "SemiSloppyFocus") == 0
151 || strcasecmp(strval, "AutoRaiseSemiSloppyFocus") == 0)
152 m_value = BScreen::SEMISLOPPYFOCUS;
153 else if (strcasecmp(strval, "ClickToFocus") == 0)
154 m_value = BScreen::CLICKTOFOCUS;
155 else
156 setDefaultValue();
157}
158
159template<>
160void FbTk::Resource<FbTk::GContext::LineStyle>::setDefaultValue() {
161 *(*this) = FbTk::GContext::LINESOLID;
162}
163
164template<>
165std::string FbTk::Resource<FbTk::GContext::LineStyle>::getString() {
166 switch(m_value) {
167 case FbTk::GContext::LINESOLID:
168 return "LineSolid";
169 break;
170 case FbTk::GContext::LINEONOFFDASH:
171 return "LineOnOffDash";
172 break;
173 case FbTk::GContext::LINEDOUBLEDASH:
174 return "LineDoubleDash";
175 break;
176 };
177}
178
179template<>
180void FbTk::Resource<FbTk::GContext::LineStyle>
181::setFromString(char const *strval) {
182
183 if (strcasecmp(strval, "LineSolid") == 0 )
184 m_value = FbTk::GContext::LINESOLID;
185 else if (strcasecmp(strval, "LineOnOffDash") == 0 )
186 m_value = FbTk::GContext::LINEONOFFDASH;
187 else if (strcasecmp(strval, "LineDoubleDash") == 0)
188 m_value = FbTk::GContext::LINEDOUBLEDASH;
189 else
190 setDefaultValue();
191}
192
193template<>
194void FbTk::Resource<FbTk::GContext::JoinStyle>::setDefaultValue() {
195 *(*this) = FbTk::GContext::JOINMITER;
196}
197
198template<>
199std::string FbTk::Resource<FbTk::GContext::JoinStyle>::getString() {
200 switch(m_value) {
201 case FbTk::GContext::JOINMITER:
202 return "JoinMiter";
203 break;
204 case FbTk::GContext::JOINBEVEL:
205 return "JoinBevel";
206 break;
207 case FbTk::GContext::JOINROUND:
208 return "JoinRound";
209 break;
210 };
211}
212
213template<>
214void FbTk::Resource<FbTk::GContext::JoinStyle>
215::setFromString(char const *strval) {
216
217 if (strcasecmp(strval, "JoinRound") == 0 )
218 m_value = FbTk::GContext::JOINROUND;
219 else if (strcasecmp(strval, "JoinMiter") == 0 )
220 m_value = FbTk::GContext::JOINMITER;
221 else if (strcasecmp(strval, "JoinBevel") == 0)
222 m_value = FbTk::GContext::JOINBEVEL;
223 else
224 setDefaultValue();
225}
226
227template<>
228void FbTk::Resource<FbTk::GContext::CapStyle>::setDefaultValue() {
229 *(*this) = FbTk::GContext::CAPNOTLAST;
230}
231
232template<>
233std::string FbTk::Resource<FbTk::GContext::CapStyle>::getString() {
234 switch(m_value) {
235 case FbTk::GContext::CAPNOTLAST:
236 return "CapNotLast";
237 break;
238 case FbTk::GContext::CAPBUTT:
239 return "CapButt";
240 break;
241 case FbTk::GContext::CAPROUND:
242 return "CapRound";
243 break;
244 case FbTk::GContext::CAPPROJECTING:
245 return "CapProjecting";
246 break;
247 };
248}
249
250template<>
251void FbTk::Resource<FbTk::GContext::CapStyle>
252::setFromString(char const *strval) {
253
254 if (strcasecmp(strval, "CapNotLast") == 0 )
255 m_value = FbTk::GContext::CAPNOTLAST;
256 else if (strcasecmp(strval, "CapProjecting") == 0 )
257 m_value = FbTk::GContext::CAPPROJECTING;
258 else if (strcasecmp(strval, "CapRound") == 0)
259 m_value = FbTk::GContext::CAPROUND;
260 else if (strcasecmp(strval, "CapButt" ) == 0)
261 m_value = FbTk::GContext::CAPBUTT;
262 else
263 setDefaultValue();
264}
265