aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/ThemeItems.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/ThemeItems.cc')
-rw-r--r--src/FbTk/ThemeItems.cc37
1 files changed, 30 insertions, 7 deletions
diff --git a/src/FbTk/ThemeItems.cc b/src/FbTk/ThemeItems.cc
index db314a3..d16955b 100644
--- a/src/FbTk/ThemeItems.cc
+++ b/src/FbTk/ThemeItems.cc
@@ -37,6 +37,7 @@
37#include "GContext.hh" 37#include "GContext.hh"
38#include "PixmapWithMask.hh" 38#include "PixmapWithMask.hh"
39#include "Image.hh" 39#include "Image.hh"
40#include "Shape.hh"
40#include "StringUtil.hh" 41#include "StringUtil.hh"
41 42
42#include <string> 43#include <string>
@@ -99,15 +100,15 @@ void ThemeItem<int>::setFromString(const char *str) {
99 setDefaultValue(); 100 setDefaultValue();
100} 101}
101template<> 102template<>
102void FbTk::ThemeItem<bool>::load(const std::string *name, const std::string *altname) { } 103void ThemeItem<bool>::load(const std::string *name, const std::string *altname) { }
103 104
104template<> 105template<>
105void FbTk::ThemeItem<bool>::setDefaultValue() { 106void ThemeItem<bool>::setDefaultValue() {
106 *(*this) = false; 107 *(*this) = false;
107} 108}
108 109
109template<> 110template<>
110void FbTk::ThemeItem<bool>::setFromString(char const *strval) { 111void ThemeItem<bool>::setFromString(char const *strval) {
111 if (strcasecmp(strval, "true")==0) 112 if (strcasecmp(strval, "true")==0)
112 *(*this) = true; 113 *(*this) = true;
113 else 114 else
@@ -136,12 +137,12 @@ void ThemeItem<Font>::setDefaultValue() {
136 string effect(ThemeManager::instance().resourceValue(name()+".effect", altName()+".Effect")); 137 string effect(ThemeManager::instance().resourceValue(name()+".effect", altName()+".Effect"));
137 if (effect == "halo") { 138 if (effect == "halo") {
138 m_value.setHalo(true); 139 m_value.setHalo(true);
139 FbTk::Color halo_color(ThemeManager::instance().resourceValue(name()+".halo.color", altName()+".Halo.Color").c_str(), 140 Color halo_color(ThemeManager::instance().resourceValue(name()+".halo.color", altName()+".Halo.Color").c_str(),
140 theme().screenNum()); 141 theme().screenNum());
141 m_value.setHaloColor(halo_color); 142 m_value.setHaloColor(halo_color);
142 143
143 } else if (effect == "shadow" ) { 144 } else if (effect == "shadow" ) {
144 FbTk::Color shadow_color(ThemeManager::instance().resourceValue(name()+".shadow.color", altName()+".Shadow.Color").c_str(), 145 Color shadow_color(ThemeManager::instance().resourceValue(name()+".shadow.color", altName()+".Shadow.Color").c_str(),
145 theme().screenNum()); 146 theme().screenNum());
146 147
147 m_value.setShadow(true); 148 m_value.setShadow(true);
@@ -168,12 +169,12 @@ void ThemeItem<Font>::setFromString(const char *str) {
168 string effect(ThemeManager::instance().resourceValue(name()+".effect", altName()+".Effect")); 169 string effect(ThemeManager::instance().resourceValue(name()+".effect", altName()+".Effect"));
169 if (effect == "halo") { 170 if (effect == "halo") {
170 m_value.setHalo(true); 171 m_value.setHalo(true);
171 FbTk::Color halo_color(ThemeManager::instance().resourceValue(name()+".halo.color", altName()+".Halo.Color").c_str(), 172 Color halo_color(ThemeManager::instance().resourceValue(name()+".halo.color", altName()+".Halo.Color").c_str(),
172 theme().screenNum()); 173 theme().screenNum());
173 m_value.setHaloColor(halo_color); 174 m_value.setHaloColor(halo_color);
174 175
175 } else if (effect == "shadow" ) { 176 } else if (effect == "shadow" ) {
176 FbTk::Color shadow_color(ThemeManager::instance().resourceValue(name()+".shadow.color", altName()+".Shadow.Color").c_str(), 177 Color shadow_color(ThemeManager::instance().resourceValue(name()+".shadow.color", altName()+".Shadow.Color").c_str(),
177 theme().screenNum()); 178 theme().screenNum());
178 179
179 m_value.setShadow(true); 180 m_value.setShadow(true);
@@ -373,7 +374,29 @@ void ThemeItem<GContext::CapStyle>::setFromString(char const *strval) {
373template<> 374template<>
374void ThemeItem<GContext::CapStyle>::load(const string *name, const string *altname) { } 375void ThemeItem<GContext::CapStyle>::load(const string *name, const string *altname) { }
375 376
377template <>
378void ThemeItem<Shape::ShapePlace>::load(const string *name, const string *altname) { }
379
380template <>
381void ThemeItem<Shape::ShapePlace>::setDefaultValue() {
382 *(*this) = Shape::NONE;
383}
376 384
385template <>
386void ThemeItem<Shape::ShapePlace>::setFromString(const char *str) {
387 int places = 0;
388
389 if (StringUtil::strcasestr(str, "topleft") != 0)
390 places |= Shape::TOPLEFT;
391 if (StringUtil::strcasestr(str, "topright") != 0)
392 places |= Shape::TOPRIGHT;
393 if (StringUtil::strcasestr(str, "bottomleft") != 0)
394 places |= Shape::BOTTOMLEFT;
395 if (StringUtil::strcasestr(str, "bottomright") != 0)
396 places |= Shape::BOTTOMRIGHT;
397
398 *(*this) = static_cast<Shape::ShapePlace>(places);
399}
377 400
378} // end namespace FbTk 401} // end namespace FbTk
379 402