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.cc60
1 files changed, 53 insertions, 7 deletions
diff --git a/src/FbTk/ThemeItems.cc b/src/FbTk/ThemeItems.cc
index 6b24baf..ccbe3a3 100644
--- a/src/FbTk/ThemeItems.cc
+++ b/src/FbTk/ThemeItems.cc
@@ -26,6 +26,10 @@
26#ifndef THEMEITEMS_HH 26#ifndef THEMEITEMS_HH
27#define THEMEITEMS_HH 27#define THEMEITEMS_HH
28 28
29#ifdef HAVE_CONFIG_H
30#include "config.h"
31#endif // HAVE_CONFIG_H
32
29#include "Theme.hh" 33#include "Theme.hh"
30#include "Color.hh" 34#include "Color.hh"
31#include "Texture.hh" 35#include "Texture.hh"
@@ -98,9 +102,40 @@ void FbTk::ThemeItem<bool>::setFromString(char const *strval) {
98} 102}
99 103
100template <> 104template <>
105void ThemeItem<unsigned int>::setDefaultValue() {
106 m_value = 0;
107}
108
109template <>
110void ThemeItem<unsigned int>::setFromString(const char *str) {
111 sscanf(str, "%d", &m_value);
112}
113
114template <>
115void ThemeItem<unsigned int>::load(const std::string *name, const std::string *altname) {
116}
117
118
101void ThemeItem<Font>::setDefaultValue() { 119void ThemeItem<Font>::setDefaultValue() {
102 if (!m_value.load("fixed")) { 120 if (!m_value.load("fixed")) {
103 cerr<<"ThemeItem<Font>: Warning! Failed to load default value 'fixed'"<<endl; 121 cerr<<"ThemeItem<Font>: Warning! Failed to load default value 'fixed'"<<endl;
122 } else {
123 string effect(ThemeManager::instance().resourceValue(name()+".effect", altName()+".Effect"));
124 if (effect == "halo") {
125 m_value.setHalo(true);
126 FbTk::Color halo_color(ThemeManager::instance().resourceValue(name()+".halo.color", altName()+".Halo.Color").c_str(),
127 theme().screenNum());
128 m_value.setHaloColor(halo_color);
129
130 } else if (effect == "shadow" ) {
131 FbTk::Color shadow_color(ThemeManager::instance().resourceValue(name()+".shadow.x", altName()+".Shadow.X").c_str(),
132 theme().screenNum());
133
134 m_value.setShadow(true);
135 m_value.setShadowColor(shadow_color);
136 m_value.setShadowOffX(atoi(ThemeManager::instance().resourceValue(name()+".shadow.x", altName()+".Shadow.X").c_str()));
137 m_value.setShadowOffY(atoi(ThemeManager::instance().resourceValue(name()+".shadow.y", altName()+".Shadow.Y").c_str()));
138 }
104 } 139 }
105} 140}
106 141
@@ -110,19 +145,30 @@ void ThemeItem<Font>::setFromString(const char *str) {
110 if (str == 0 || m_value.load(str) == false) { 145 if (str == 0 || m_value.load(str) == false) {
111 if (ThemeManager::instance().verbose()) { 146 if (ThemeManager::instance().verbose()) {
112 cerr<<"Theme: Error loading font "<< 147 cerr<<"Theme: Error loading font "<<
113 ((m_value.isAntialias() || m_value.utf8()) ? "(" : "")<< 148 ((m_value.utf8()) ? "(utf8)" : "")<<
114
115 (m_value.isAntialias() ? "antialias" : "")<<
116 (m_value.utf8() ? " utf8" : "")<<
117
118 ((m_value.isAntialias() || m_value.utf8()) ? ") " : "")<<
119 "for \""<<name()<<"\" or \""<<altName()<<"\": "<<str<<endl; 149 "for \""<<name()<<"\" or \""<<altName()<<"\": "<<str<<endl;
120 150
121 cerr<<"Theme: Setting default value"<<endl; 151 cerr<<"Theme: Setting default value"<<endl;
122 } 152 }
123 setDefaultValue(); 153 setDefaultValue();
154 } else {
155 string effect(ThemeManager::instance().resourceValue(name()+".effect", altName()+".Effect"));
156 if (effect == "halo") {
157 m_value.setHalo(true);
158 FbTk::Color halo_color(ThemeManager::instance().resourceValue(name()+".halo.color", altName()+".Halo.Color").c_str(),
159 theme().screenNum());
160 m_value.setHaloColor(halo_color);
161
162 } else if (effect == "shadow" ) {
163 FbTk::Color shadow_color(ThemeManager::instance().resourceValue(name()+".shadow.x", altName()+".Shadow.X").c_str(),
164 theme().screenNum());
165
166 m_value.setShadow(true);
167 m_value.setShadowColor(shadow_color);
168 m_value.setShadowOffX(atoi(ThemeManager::instance().resourceValue(name()+".shadow.x", altName()+".Shadow.X").c_str()));
169 m_value.setShadowOffY(atoi(ThemeManager::instance().resourceValue(name()+".shadow.y", altName()+".Shadow.Y").c_str()));
170 }
124 } 171 }
125
126} 172}
127 173
128// do nothing 174// do nothing