aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/WinButton.cc54
-rw-r--r--src/WinButton.hh5
2 files changed, 16 insertions, 43 deletions
diff --git a/src/WinButton.cc b/src/WinButton.cc
index ff0ff76..e1b79a2 100644
--- a/src/WinButton.cc
+++ b/src/WinButton.cc
@@ -114,60 +114,32 @@ void WinButton::setPressedColor(const FbTk::Color &color) {
114 } 114 }
115} 115}
116 116
117Pixmap WinButton::getBackgroundPixmap() const { 117Pixmap WinButton::getPixmap(const FbTk::ThemeProxy<WinButtonTheme> &theme) const {
118 switch(m_type) { 118 switch(m_type) {
119 case MAXIMIZE: 119 case MAXIMIZE:
120 return m_theme->maximizePixmap().pixmap().drawable(); 120 return theme->maximizePixmap().pixmap().drawable();
121 break;
122 case MINIMIZE:
123 return m_theme->iconifyPixmap().pixmap().drawable();
124 break;
125 case STICK:
126 if (m_listen_to.isStuck())
127 return m_theme->stuckPixmap().pixmap().drawable();
128 return m_theme->stickPixmap().pixmap().drawable();
129 break;
130 case CLOSE:
131 return m_theme->closePixmap().pixmap().drawable();
132 break;
133 case SHADE:
134 if (m_listen_to.isShaded())
135 return m_theme->unshadePixmap().pixmap().drawable();
136 return m_theme->shadePixmap().pixmap().drawable();
137 break;
138 case MENUICON:
139 if (m_icon_pixmap.drawable())
140 return m_theme->titlePixmap().pixmap().drawable();
141 return m_theme->menuiconPixmap().pixmap().drawable();
142 break;
143 }
144 return None;
145}
146
147Pixmap WinButton::getPressedPixmap() const {
148 switch(m_type) {
149 case MAXIMIZE:
150 return m_pressed_theme->maximizePixmap().pixmap().drawable();
151 case MINIMIZE: 121 case MINIMIZE:
152 return m_pressed_theme->iconifyPixmap().pixmap().drawable(); 122 return theme->iconifyPixmap().pixmap().drawable();
153 case STICK: 123 case STICK:
154 if (m_listen_to.isStuck()) 124 if (m_listen_to.isStuck())
155 return m_pressed_theme->stuckPixmap().pixmap().drawable(); 125 return theme->stuckPixmap().pixmap().drawable();
156 return m_pressed_theme->stickPixmap().pixmap().drawable(); 126 else
127 return theme->stickPixmap().pixmap().drawable();
157 case CLOSE: 128 case CLOSE:
158 return m_pressed_theme->closePixmap().pixmap().drawable(); 129 return theme->closePixmap().pixmap().drawable();
159 case SHADE: 130 case SHADE:
160 if (m_listen_to.isShaded()) 131 if (m_listen_to.isShaded())
161 return m_pressed_theme->unshadePixmap().pixmap().drawable(); 132 return theme->unshadePixmap().pixmap().drawable();
162 else 133 else
163 return m_pressed_theme->shadePixmap().pixmap().drawable(); 134 return theme->shadePixmap().pixmap().drawable();
164 case MENUICON: 135 case MENUICON:
165 if (m_icon_pixmap.drawable()) 136 if (m_icon_pixmap.drawable())
166 return m_theme->titlePixmap().pixmap().drawable(); 137 return theme->titlePixmap().pixmap().drawable();
167 else 138 else
168 return m_pressed_theme->menuiconPixmap().pixmap().drawable(); 139 return theme->menuiconPixmap().pixmap().drawable();
140 default:
141 return None;
169 } 142 }
170 return None;
171} 143}
172 144
173// clear is used to force this to clear the window (e.g. called from clear()) 145// clear is used to force this to clear the window (e.g. called from clear())
diff --git a/src/WinButton.hh b/src/WinButton.hh
index 80fc4b1..3912a1a 100644
--- a/src/WinButton.hh
+++ b/src/WinButton.hh
@@ -52,13 +52,14 @@ public:
52 void setBackgroundColor(const FbTk::Color &color); 52 void setBackgroundColor(const FbTk::Color &color);
53 void setPressedColor(const FbTk::Color &color); 53 void setPressedColor(const FbTk::Color &color);
54 54
55 Pixmap getBackgroundPixmap() const; 55 Pixmap getBackgroundPixmap() const { return getPixmap(m_theme); }
56 Pixmap getPressedPixmap() const; 56 Pixmap getPressedPixmap() const { return getPixmap(m_pressed_theme); }
57 /// override for redrawing 57 /// override for redrawing
58 void clear(); 58 void clear();
59 void updateAll(); 59 void updateAll();
60private: 60private:
61 void drawType(); 61 void drawType();
62 Pixmap getPixmap(const FbTk::ThemeProxy<WinButtonTheme> &) const;
62 Type m_type; ///< the button type 63 Type m_type; ///< the button type
63 FluxboxWindow &m_listen_to; 64 FluxboxWindow &m_listen_to;
64 FbTk::ThemeProxy<WinButtonTheme> &m_theme, &m_pressed_theme; 65 FbTk::ThemeProxy<WinButtonTheme> &m_theme, &m_pressed_theme;