aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-04-28 22:25:13 (GMT)
committerfluxgen <fluxgen>2003-04-28 22:25:13 (GMT)
commite37f631c4fa90a952e50313a4b566b5219488a63 (patch)
tree7b91accc37694042b09b98db4befc99174519813
parent7a643267c1024f0b95ac39f86bb16e1464ac6cc7 (diff)
downloadfluxbox_paul-e37f631c4fa90a952e50313a4b566b5219488a63.zip
fluxbox_paul-e37f631c4fa90a952e50313a4b566b5219488a63.tar.bz2
added pixmap support
-rw-r--r--src/FbTk/Theme.cc43
1 files changed, 39 insertions, 4 deletions
diff --git a/src/FbTk/Theme.cc b/src/FbTk/Theme.cc
index 1efc8a1..ca80ab5 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.2 2003/02/23 00:47:34 fluxgen Exp $ 22// $Id: Theme.cc,v 1.3 2003/04/28 22:25:13 fluxgen Exp $
23 23
24#include "Theme.hh" 24#include "Theme.hh"
25 25
@@ -29,6 +29,15 @@
29#include "Texture.hh" 29#include "Texture.hh"
30#include "App.hh" 30#include "App.hh"
31 31
32
33#ifdef HAVE_CONFIG_H
34#include "config.h"
35#endif // HAVE_CONFIG_H
36
37#ifdef HAVE_XPM
38#include <X11/xpm.h>
39#endif // HAVE_XPM
40
32#include <iostream> 41#include <iostream>
33 42
34using namespace std; 43using namespace std;
@@ -71,10 +80,36 @@ void ThemeItem<FbTk::Texture>::setDefaultValue() {
71 80
72template <> 81template <>
73void ThemeItem<FbTk::Texture>::load() { 82void ThemeItem<FbTk::Texture>::load() {
74 string color_name(ThemeManager::instance().resourceValue(name()+".color", altName()+".Color")); 83 string color_name(ThemeManager::instance().
75 string colorto_name(ThemeManager::instance().resourceValue(name()+".colorTo", altName()+".ColorTo")); 84 resourceValue(name()+".color", altName()+".Color"));
85 string colorto_name(ThemeManager::instance().
86 resourceValue(name()+".colorTo", altName()+".ColorTo"));
87 string pixmap_name(ThemeManager::instance().
88 resourceValue(name()+".pixmap", altName()+".Pixmap"));
89
76 m_value.color().setFromString(color_name.c_str(), m_tm.screenNum()); 90 m_value.color().setFromString(color_name.c_str(), m_tm.screenNum());
77 m_value.colorTo().setFromString(colorto_name.c_str(), m_tm.screenNum()); 91 m_value.colorTo().setFromString(colorto_name.c_str(), m_tm.screenNum());
92
93#ifdef HAVE_XPM
94 XpmAttributes xpm_attr;
95 xpm_attr.valuemask = 0;
96 Display *dpy = FbTk::App::instance()->display();
97 Pixmap pm = 0, mask = 0;
98 int retvalue = XpmReadFileToPixmap(dpy,
99 RootWindow(dpy, m_tm.screenNum()),
100 const_cast<char *>(pixmap_name.c_str()),
101 &pm,
102 &mask, &xpm_attr);
103 if (retvalue == 0) { // success
104 m_value.pixmap() = pm;
105 if (mask != 0)
106 XFreePixmap(dpy, mask);
107 } else { // failure
108 // create empty pixmap
109 m_value.pixmap() = FbTk::FbPixmap();
110 }
111#endif // HAVE_XPM
112
78} 113}
79 114
80 115
@@ -179,7 +214,7 @@ std::string ThemeManager::resourceValue(const std::string &name, const std::stri
179 char *value_type; 214 char *value_type;
180 215
181 if (*m_database != 0 && XrmGetResource(*m_database, name.c_str(), 216 if (*m_database != 0 && XrmGetResource(*m_database, name.c_str(),
182 altname.c_str(), &value_type, &value) && value.addr != 0) { 217 altname.c_str(), &value_type, &value) && value.addr != 0) {
183 return string(value.addr); 218 return string(value.addr);
184 } 219 }
185 return ""; 220 return "";