summaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
authorrathnor <rathnor>2004-04-26 15:04:37 (GMT)
committerrathnor <rathnor>2004-04-26 15:04:37 (GMT)
commitd4a871785130ab0d6533bef4f1ec55c4cfd3b8df (patch)
treef07025c5527733c88043ca61316c0af62daf598d /src/FbTk
parentef6bf03ca19c0c96943894f9d0f0db9bc0bd58fc (diff)
downloadfluxbox_lack-d4a871785130ab0d6533bef4f1ec55c4cfd3b8df.zip
fluxbox_lack-d4a871785130ab0d6533bef4f1ec55c4cfd3b8df.tar.bz2
toolbar themeing fixes
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/MenuTheme.cc6
-rw-r--r--src/FbTk/Text.cc4
-rw-r--r--src/FbTk/Theme.cc10
-rw-r--r--src/FbTk/Theme.hh8
-rw-r--r--src/FbTk/ThemeItems.hh26
5 files changed, 28 insertions, 26 deletions
diff --git a/src/FbTk/MenuTheme.cc b/src/FbTk/MenuTheme.cc
index 605246a..95d15d1 100644
--- a/src/FbTk/MenuTheme.cc
+++ b/src/FbTk/MenuTheme.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: MenuTheme.cc,v 1.14 2004/01/08 22:07:58 fluxgen Exp $ 22// $Id: MenuTheme.cc,v 1.15 2004/04/26 15:04:37 rathnor Exp $
23 23
24#include "MenuTheme.hh" 24#include "MenuTheme.hh"
25 25
@@ -136,7 +136,7 @@ void ThemeItem<MenuTheme::BulletType>::setFromString(const char *str) {
136} 136}
137 137
138template <> 138template <>
139void ThemeItem<MenuTheme::BulletType>::load() { 139void ThemeItem<MenuTheme::BulletType>::load(const std::string *name, const std::string *altname) {
140 // do nothing, we don't have anything extra to load 140 // do nothing, we don't have anything extra to load
141} 141}
142 142
@@ -151,7 +151,7 @@ void ThemeItem<unsigned int>::setFromString(const char *str) {
151} 151}
152 152
153template <> 153template <>
154void ThemeItem<unsigned int>::load() { 154void ThemeItem<unsigned int>::load(const std::string *name, const std::string *altname) {
155} 155}
156 156
157 157
diff --git a/src/FbTk/Text.cc b/src/FbTk/Text.cc
index 190e233..8dc91d9 100644
--- a/src/FbTk/Text.cc
+++ b/src/FbTk/Text.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Text.cc,v 1.2 2003/08/11 14:59:57 fluxgen Exp $ 22// $Id: Text.cc,v 1.3 2004/04/26 15:04:37 rathnor Exp $
23 23
24#include "Text.hh" 24#include "Text.hh"
25 25
@@ -82,7 +82,7 @@ void ThemeItem<FbTk::Justify>::setFromString(const char *value) {
82 82
83// do nothing 83// do nothing
84template <> 84template <>
85void ThemeItem<FbTk::Justify>::load() { 85void ThemeItem<FbTk::Justify>::load(const std::string *name, const std::string *altname) {
86} 86}
87 87
88}; // end namespace FbTk 88}; // end namespace FbTk
diff --git a/src/FbTk/Theme.cc b/src/FbTk/Theme.cc
index 224ae6f..f9c3366 100644
--- a/src/FbTk/Theme.cc
+++ b/src/FbTk/Theme.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Theme.cc,v 1.25 2004/01/12 20:24:06 fluxgen Exp $ 22// $Id: Theme.cc,v 1.26 2004/04/26 15:04:37 rathnor Exp $
23 23
24#include "Theme.hh" 24#include "Theme.hh"
25 25
@@ -157,11 +157,10 @@ bool ThemeManager::loadItem(ThemeItem_base &resource) {
157bool ThemeManager::loadItem(ThemeItem_base &resource, const std::string &name, const std::string &alt_name) { 157bool ThemeManager::loadItem(ThemeItem_base &resource, const std::string &name, const std::string &alt_name) {
158 XrmValue value; 158 XrmValue value;
159 char *value_type; 159 char *value_type;
160
161 if (XrmGetResource(*m_database, name.c_str(), 160 if (XrmGetResource(*m_database, name.c_str(),
162 alt_name.c_str(), &value_type, &value)) { 161 alt_name.c_str(), &value_type, &value)) {
163 resource.setFromString(value.addr); 162 resource.setFromString(value.addr);
164 resource.load(); // load additional stuff by the ThemeItem 163 resource.load(&name, &alt_name); // load additional stuff by the ThemeItem
165 } else 164 } else
166 return false; 165 return false;
167 166
@@ -171,11 +170,10 @@ bool ThemeManager::loadItem(ThemeItem_base &resource, const std::string &name, c
171std::string ThemeManager::resourceValue(const std::string &name, const std::string &altname) { 170std::string ThemeManager::resourceValue(const std::string &name, const std::string &altname) {
172 XrmValue value; 171 XrmValue value;
173 char *value_type; 172 char *value_type;
174
175 if (*m_database != 0 && XrmGetResource(*m_database, name.c_str(), 173 if (*m_database != 0 && XrmGetResource(*m_database, name.c_str(),
176 altname.c_str(), &value_type, &value) && value.addr != 0) { 174 altname.c_str(), &value_type, &value) && value.addr != 0)
177 return string(value.addr); 175 return string(value.addr);
178 } 176
179 return ""; 177 return "";
180} 178}
181 179
diff --git a/src/FbTk/Theme.hh b/src/FbTk/Theme.hh
index 105d860..ff84051 100644
--- a/src/FbTk/Theme.hh
+++ b/src/FbTk/Theme.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Theme.hh,v 1.15 2004/01/02 22:55:15 fluxgen Exp $ 22// $Id: Theme.hh,v 1.16 2004/04/26 15:04:37 rathnor Exp $
23 23
24/** 24/**
25 @file holds ThemeItem<T>, Theme and ThemeManager which is the base for any theme 25 @file holds ThemeItem<T>, Theme and ThemeManager which is the base for any theme
@@ -50,7 +50,7 @@ public:
50 virtual ~ThemeItem_base() { } 50 virtual ~ThemeItem_base() { }
51 virtual void setFromString(const char *str) = 0; 51 virtual void setFromString(const char *str) = 0;
52 virtual void setDefaultValue() = 0; 52 virtual void setDefaultValue() = 0;
53 virtual void load() = 0; // if it needs to load additional stuff 53 virtual void load(const std::string *name = 0, const std::string *altname = 0) = 0; // if it needs to load additional stuff
54 const std::string &name() const { return m_name; } 54 const std::string &name() const { return m_name; }
55 const std::string &altName() const { return m_altname; } 55 const std::string &altName() const { return m_altname; }
56private: 56private:
@@ -70,7 +70,9 @@ public:
70 /// specialized 70 /// specialized
71 void setFromString(const char *strval); 71 void setFromString(const char *strval);
72 /// specialized 72 /// specialized
73 void load(); 73 // name and altname may be different to the primary ones (e.g. from fallback)
74 // if they are null, then the original name is used
75 void load(const std::string *name = 0, const std::string *altname = 0);
74 /** 76 /**
75 @name access operators 77 @name access operators
76 */ 78 */
diff --git a/src/FbTk/ThemeItems.hh b/src/FbTk/ThemeItems.hh
index 63c17df..57a5f11 100644
--- a/src/FbTk/ThemeItems.hh
+++ b/src/FbTk/ThemeItems.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: ThemeItems.hh,v 1.5 2004/02/10 19:03:04 fluxgen Exp $ 22// $Id: ThemeItems.hh,v 1.6 2004/04/26 15:04:37 rathnor Exp $
23 23
24/// @file implements common theme items 24/// @file implements common theme items
25 25
@@ -42,7 +42,7 @@ using namespace std;
42 42
43// create default handlers for Color, Font, Texture, int and string 43// create default handlers for Color, Font, Texture, int and string
44template <> 44template <>
45void FbTk::ThemeItem<std::string>::load() { } 45void FbTk::ThemeItem<std::string>::load(const std::string *name, const std::string *altname) { }
46 46
47template <> 47template <>
48void FbTk::ThemeItem<std::string>::setDefaultValue() { 48void FbTk::ThemeItem<std::string>::setDefaultValue() {
@@ -55,7 +55,7 @@ void FbTk::ThemeItem<std::string>::setFromString(const char *str) {
55} 55}
56 56
57template <> 57template <>
58void FbTk::ThemeItem<int>::load() { } 58void FbTk::ThemeItem<int>::load(const std::string *name, const std::string *altname) { }
59 59
60template <> 60template <>
61void FbTk::ThemeItem<int>::setDefaultValue() { 61void FbTk::ThemeItem<int>::setDefaultValue() {
@@ -103,18 +103,21 @@ void ThemeItem<FbTk::Font>::setFromString(const char *str) {
103 103
104// do nothing 104// do nothing
105template <> 105template <>
106void ThemeItem<FbTk::Font>::load() { 106void ThemeItem<FbTk::Font>::load(const std::string *name, const std::string *altname) {
107} 107}
108 108
109 109
110template <> 110template <>
111void ThemeItem<FbTk::Texture>::load() { 111void ThemeItem<FbTk::Texture>::load(const std::string *o_name, const std::string *o_altname) {
112 const std::string &m_name = (o_name==0)?name():*o_name;
113 const std::string &m_altname = (o_altname==0)?altName():*o_altname;
114
112 string color_name(ThemeManager::instance(). 115 string color_name(ThemeManager::instance().
113 resourceValue(name()+".color", altName()+".Color")); 116 resourceValue(m_name+".color", m_altname+".Color"));
114 string colorto_name(ThemeManager::instance(). 117 string colorto_name(ThemeManager::instance().
115 resourceValue(name()+".colorTo", altName()+".ColorTo")); 118 resourceValue(m_name+".colorTo", m_altname+".ColorTo"));
116 string pixmap_name(ThemeManager::instance(). 119 string pixmap_name(ThemeManager::instance().
117 resourceValue(name()+".pixmap", altName()+".Pixmap")); 120 resourceValue(m_name+".pixmap", m_altname+".Pixmap"));
118 121
119 122
120 // set default value if we failed to load color 123 // set default value if we failed to load color
@@ -137,7 +140,7 @@ void ThemeItem<FbTk::Texture>::load() {
137 m_tm.screenNum())); 140 m_tm.screenNum()));
138 if (pm.get() == 0) { 141 if (pm.get() == 0) {
139 if (FbTk::ThemeManager::instance().verbose()) { 142 if (FbTk::ThemeManager::instance().verbose()) {
140 cerr<<"Resource("<<name()+".pixmap" 143 cerr<<"Resource("<<m_name+".pixmap"
141 <<"): Failed to load image: "<<pixmap_name<<endl; 144 <<"): Failed to load image: "<<pixmap_name<<endl;
142 } 145 }
143 m_value.pixmap() = 0; 146 m_value.pixmap() = 0;
@@ -163,8 +166,7 @@ void ThemeItem<FbTk::Texture>::setFromString(const char *str) {
163 166
164// not used 167// not used
165template <> 168template <>
166void FbTk::ThemeItem<PixmapWithMask>:: 169void FbTk::ThemeItem<PixmapWithMask>::load(const std::string *name, const std::string *altname) { }
167load() { }
168 170
169template <> 171template <>
170void FbTk::ThemeItem<PixmapWithMask>:: 172void FbTk::ThemeItem<PixmapWithMask>::
@@ -211,7 +213,7 @@ void ThemeItem<FbTk::Color>::setFromString(const char *str) {
211 213
212// does nothing 214// does nothing
213template <> 215template <>
214void ThemeItem<FbTk::Color>::load() { } 216void ThemeItem<FbTk::Color>::load(const std::string *name, const std::string *altname) { }
215 217
216} // end namespace FbTk 218} // end namespace FbTk
217 219