aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-05-06 23:58:08 (GMT)
committerfluxgen <fluxgen>2003-05-06 23:58:08 (GMT)
commit7298f23b0de460c219abac56dcf2fcba08928ec1 (patch)
treeba30fdac593c652020ed4636b8a3a4bce60a2e5c
parent1cbf54adeb7dad7cc172ad1e167b433457cdc95e (diff)
downloadfluxbox-7298f23b0de460c219abac56dcf2fcba08928ec1.zip
fluxbox-7298f23b0de460c219abac56dcf2fcba08928ec1.tar.bz2
added stuck pixmap, and unfocus pixmaps
-rw-r--r--src/WinButton.cc125
-rw-r--r--src/WinButtonTheme.cc11
-rw-r--r--src/WinButtonTheme.hh26
3 files changed, 123 insertions, 39 deletions
diff --git a/src/WinButton.cc b/src/WinButton.cc
index 650f312..17ad179 100644
--- a/src/WinButton.cc
+++ b/src/WinButton.cc
@@ -19,16 +19,13 @@
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: WinButton.cc,v 1.4 2003/04/28 22:41:28 fluxgen Exp $ 22/// $Id: WinButton.cc,v 1.5 2003/05/06 23:58:08 fluxgen Exp $
23 23
24#include "WinButton.hh" 24#include "WinButton.hh"
25#include "App.hh" 25#include "App.hh"
26#include "Window.hh" 26#include "Window.hh"
27#include "WinButtonTheme.hh" 27#include "WinButtonTheme.hh"
28 28
29#include <iostream>
30using namespace std;
31
32namespace { 29namespace {
33 30
34inline void scale(const FbTk::Button &btn, WinButtonTheme::PixmapWithMask &pm) { 31inline void scale(const FbTk::Button &btn, WinButtonTheme::PixmapWithMask &pm) {
@@ -46,15 +43,27 @@ void updateScale(const FbTk::Button &btn, WinButtonTheme &theme) {
46 43
47 // we need to scale our pixmaps to right size 44 // we need to scale our pixmaps to right size
48 scale(btn, theme.closePixmap()); 45 scale(btn, theme.closePixmap());
46 scale(btn, theme.closeUnfocusPixmap());
49 scale(btn, theme.closePressedPixmap()); 47 scale(btn, theme.closePressedPixmap());
48
50 scale(btn, theme.maximizePixmap()); 49 scale(btn, theme.maximizePixmap());
50 scale(btn, theme.maximizeUnfocusPixmap());
51 scale(btn, theme.maximizePressedPixmap()); 51 scale(btn, theme.maximizePressedPixmap());
52
52 scale(btn, theme.iconifyPixmap()); 53 scale(btn, theme.iconifyPixmap());
54 scale(btn, theme.iconifyUnfocusPixmap());
53 scale(btn, theme.iconifyPressedPixmap()); 55 scale(btn, theme.iconifyPressedPixmap());
56
54 scale(btn, theme.shadePixmap()); 57 scale(btn, theme.shadePixmap());
58 scale(btn, theme.shadeUnfocusPixmap());
55 scale(btn, theme.shadePressedPixmap()); 59 scale(btn, theme.shadePressedPixmap());
60
56 scale(btn, theme.stickPixmap()); 61 scale(btn, theme.stickPixmap());
62 scale(btn, theme.stickUnfocusPixmap());
57 scale(btn, theme.stickPressedPixmap()); 63 scale(btn, theme.stickPressedPixmap());
64
65 scale(btn, theme.stuckPixmap());
66 scale(btn, theme.stuckUnfocusPixmap());
58} 67}
59 68
60}; 69};
@@ -91,9 +100,18 @@ void WinButton::drawType() {
91 maximizePressedPixmap(). 100 maximizePressedPixmap().
92 pixmap_scaled.drawable()); 101 pixmap_scaled.drawable());
93 } else if (m_theme.maximizePixmap().pixmap_scaled.drawable()) { 102 } else if (m_theme.maximizePixmap().pixmap_scaled.drawable()) {
94 window().setBackgroundPixmap(m_theme. 103 // check focus
95 maximizePixmap(). 104 if (!m_listen_to.isFocused() &&
96 pixmap_scaled.drawable()); 105 m_theme.maximizeUnfocusPixmap().pixmap_scaled.drawable() != 0) {
106 // not focused
107 window().setBackgroundPixmap(m_theme.
108 maximizeUnfocusPixmap().
109 pixmap_scaled.drawable());
110 } else { // focused
111 window().setBackgroundPixmap(m_theme.
112 maximizePixmap().
113 pixmap_scaled.drawable());
114 }
97 } 115 }
98 116
99 window().clear(); 117 window().clear();
@@ -114,9 +132,18 @@ void WinButton::drawType() {
114 iconifyPressedPixmap(). 132 iconifyPressedPixmap().
115 pixmap_scaled.drawable()); 133 pixmap_scaled.drawable());
116 } else if (m_theme.iconifyPixmap().pixmap_scaled.drawable()){ 134 } else if (m_theme.iconifyPixmap().pixmap_scaled.drawable()){
117 window().setBackgroundPixmap(m_theme. 135 // check focus
118 iconifyPixmap(). 136 if (!m_listen_to.isFocused() &&
119 pixmap_scaled.drawable()); 137 m_theme.iconifyUnfocusPixmap().pixmap_scaled.drawable() != 0) {
138 // not focused
139 window().setBackgroundPixmap(m_theme.
140 iconifyUnfocusPixmap().
141 pixmap_scaled.drawable());
142 } else { // focused
143 window().setBackgroundPixmap(m_theme.
144 iconifyPixmap().
145 pixmap_scaled.drawable());
146 }
120 } 147 }
121 148
122 window().clear(); 149 window().clear();
@@ -130,17 +157,45 @@ void WinButton::drawType() {
130 break; 157 break;
131 case STICK: 158 case STICK:
132 if (m_theme.stickPixmap().pixmap_scaled.drawable() != 0) { 159 if (m_theme.stickPixmap().pixmap_scaled.drawable() != 0) {
133 if (pressed()) { 160 if (m_listen_to.isStuck() &&
134 window().setBackgroundPixmap(m_theme. 161 m_theme.stuckPixmap().pixmap_scaled.drawable() &&
135 stickPressedPixmap(). 162 ! pressed()) { // we're using the same pixmap for pressed as in not stuck
136 pixmap_scaled.drawable()); 163 // check focus
164 if (!m_listen_to.isFocused() &&
165 m_theme.stuckUnfocusPixmap().pixmap_scaled.drawable() != 0) {
166 // not focused
167 window().setBackgroundPixmap(m_theme.
168 stuckUnfocusPixmap().
169 pixmap_scaled.drawable());
170 } else { // focused
171 window().setBackgroundPixmap(m_theme.
172 stuckPixmap().
173 pixmap_scaled.drawable());
174 }
175 } else { // not stuck
176
177 if (pressed()) {
178 window().setBackgroundPixmap(m_theme.
179 stickPressedPixmap().
180 pixmap_scaled.drawable());
181
182 } else if (m_theme.stickPixmap().pixmap_scaled.drawable()) {
183 // check focus
184 if (!m_listen_to.isFocused() &&
185 m_theme.stickUnfocusPixmap().pixmap_scaled.drawable() != 0) {
186 // not focused
187 window().setBackgroundPixmap(m_theme.
188 stickUnfocusPixmap().
189 pixmap_scaled.drawable());
190 } else { // focused
191 window().setBackgroundPixmap(m_theme.
192 stickPixmap().
193 pixmap_scaled.drawable());
194 }
195
196 }
197 } // end if stuck
137 198
138 } else if (m_theme.closePixmap().pixmap_scaled.drawable()) {
139 window().setBackgroundPixmap(m_theme.
140 stickPixmap().
141 pixmap_scaled.drawable());
142 }
143
144 window().clear(); 199 window().clear();
145 200
146 } else { 201 } else {
@@ -166,9 +221,18 @@ void WinButton::drawType() {
166 pixmap_scaled.drawable()); 221 pixmap_scaled.drawable());
167 222
168 } else if (m_theme.closePixmap().pixmap_scaled.drawable()) { 223 } else if (m_theme.closePixmap().pixmap_scaled.drawable()) {
169 window().setBackgroundPixmap(m_theme. 224 // check focus
170 closePixmap(). 225 if (!m_listen_to.isFocused() &&
171 pixmap_scaled.drawable()); 226 m_theme.closeUnfocusPixmap().pixmap_scaled.drawable() != 0) {
227 // not focused
228 window().setBackgroundPixmap(m_theme.
229 closeUnfocusPixmap().
230 pixmap_scaled.drawable());
231 } else { // focused
232 window().setBackgroundPixmap(m_theme.
233 closePixmap().
234 pixmap_scaled.drawable());
235 }
172 } 236 }
173 237
174 window().clear(); 238 window().clear();
@@ -191,9 +255,18 @@ void WinButton::drawType() {
191 shadePressedPixmap(). 255 shadePressedPixmap().
192 pixmap_scaled.drawable()); 256 pixmap_scaled.drawable());
193 } else if (m_theme.shadePixmap().pixmap_scaled.drawable()) { 257 } else if (m_theme.shadePixmap().pixmap_scaled.drawable()) {
194 window().setBackgroundPixmap(m_theme. 258 // check focus
195 shadePixmap(). 259 if (!m_listen_to.isFocused() &&
196 pixmap_scaled.drawable()); 260 m_theme.shadeUnfocusPixmap().pixmap_scaled.drawable() != 0) {
261 // not focused
262 window().setBackgroundPixmap(m_theme.
263 shadeUnfocusPixmap().
264 pixmap_scaled.drawable());
265 } else { // focused
266 window().setBackgroundPixmap(m_theme.
267 shadePixmap().
268 pixmap_scaled.drawable());
269 }
197 } 270 }
198 271
199 window().clear(); 272 window().clear();
diff --git a/src/WinButtonTheme.cc b/src/WinButtonTheme.cc
index c67675e..d90d4c8 100644
--- a/src/WinButtonTheme.cc
+++ b/src/WinButtonTheme.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: WinButtonTheme.cc,v 1.2 2003/04/28 22:33:19 fluxgen Exp $ 22// $Id: WinButtonTheme.cc,v 1.3 2003/05/06 23:56:46 fluxgen Exp $
23 23
24#include "WinButtonTheme.hh" 24#include "WinButtonTheme.hh"
25 25
@@ -80,15 +80,22 @@ setFromString(const char *str) {
80WinButtonTheme::WinButtonTheme(int screen_num): 80WinButtonTheme::WinButtonTheme(int screen_num):
81 FbTk::Theme(screen_num), 81 FbTk::Theme(screen_num),
82 m_close_pm(*this, "window.close.pixmap", "Window.Close.Pixmap"), 82 m_close_pm(*this, "window.close.pixmap", "Window.Close.Pixmap"),
83 m_close_unfocus_pm(*this, "window.close.unfocus.pixmap", "Window.Close.Unfocus.Pixmap"),
83 m_close_pressed_pm(*this, "window.close.pressed.pixmap", "Window.Close.Pressed.Pixmap"), 84 m_close_pressed_pm(*this, "window.close.pressed.pixmap", "Window.Close.Pressed.Pixmap"),
84 m_maximize_pm(*this, "window.maximize.pixmap", "Window.Maximize.Pixmap"), 85 m_maximize_pm(*this, "window.maximize.pixmap", "Window.Maximize.Pixmap"),
86 m_maximize_unfocus_pm(*this, "window.maximize.unfocus.pixmap", "Window.Maximize.Unfocus.pixmap"),
85 m_maximize_pressed_pm(*this, "window.maximize.pressed.pixmap", "Window.Maximize.Pressed.Pixmap"), 87 m_maximize_pressed_pm(*this, "window.maximize.pressed.pixmap", "Window.Maximize.Pressed.Pixmap"),
86 m_iconify_pm(*this, "window.iconify.pixmap", "Window.Iconify.Pixmap"), 88 m_iconify_pm(*this, "window.iconify.pixmap", "Window.Iconify.Pixmap"),
89 m_iconify_unfocus_pm(*this, "window.iconify.unfocus.pixmap", "Window.Iconify.Unfocus.Pixmap"),
87 m_iconify_pressed_pm(*this, "window.iconify.pressed.pixmap", "Window.Iconify.Pressed.Pixmap"), 90 m_iconify_pressed_pm(*this, "window.iconify.pressed.pixmap", "Window.Iconify.Pressed.Pixmap"),
88 m_shade_pm(*this, "window.shade.pixmap", "Window.Shade.Pixmap"), 91 m_shade_pm(*this, "window.shade.pixmap", "Window.Shade.Pixmap"),
92 m_shade_unfocus_pm(*this, "window.shade.unfocus.pixmap", "Window.Shade.Unfocus.Pixmap"),
89 m_shade_pressed_pm(*this, "window.shade.pressed.pixmap", "Window.Shade.Pressed.Pixmap"), 93 m_shade_pressed_pm(*this, "window.shade.pressed.pixmap", "Window.Shade.Pressed.Pixmap"),
90 m_stick_pm(*this, "window.stick.pixmap", "Window.Stick.Pixmap"), 94 m_stick_pm(*this, "window.stick.pixmap", "Window.Stick.Pixmap"),
91 m_stick_pressed_pm(*this, "window.stick.pressed.pixmap", "Window.Stick.Pressed.Pixmap") { 95 m_stick_unfocus_pm(*this, "window.stick.unfocus.pixmap", "Window.Stick.Unfocus.Pixmap"),
96 m_stick_pressed_pm(*this, "window.stick.pressed.pixmap", "Window.Stick.Pressed.Pixmap"),
97 m_stuck_pm(*this, "window.stuck.pixmap", "Window.Stuck.Pixmap"),
98 m_stuck_unfocus_pm(*this, "window.stuck.unfocus.pixmap", "Window.Stuck.Unfocus.Pixmap") {
92 99
93} 100}
94 101
diff --git a/src/WinButtonTheme.hh b/src/WinButtonTheme.hh
index 6cbe69c..af2f011 100644
--- a/src/WinButtonTheme.hh
+++ b/src/WinButtonTheme.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: WinButtonTheme.hh,v 1.1 2003/04/28 22:30:34 fluxgen Exp $ 22// $Id: WinButtonTheme.hh,v 1.2 2003/05/06 23:52:55 fluxgen Exp $
23 23
24#ifndef WINBUTTONTHEME_HH 24#ifndef WINBUTTONTHEME_HH
25#define WINBUTTONTHEME_HH 25#define WINBUTTONTHEME_HH
@@ -44,42 +44,46 @@ public:
44 44
45 inline const PixmapWithMask &closePixmap() const { return *m_close_pm; } 45 inline const PixmapWithMask &closePixmap() const { return *m_close_pm; }
46 inline PixmapWithMask &closePixmap() { return *m_close_pm; } 46 inline PixmapWithMask &closePixmap() { return *m_close_pm; }
47 47 inline PixmapWithMask &closeUnfocusPixmap() { return *m_close_unfocus_pm; }
48 inline const PixmapWithMask &closePressedPixmap() const { return *m_close_pressed_pm; } 48 inline const PixmapWithMask &closePressedPixmap() const { return *m_close_pressed_pm; }
49 inline PixmapWithMask &closePressedPixmap() { return *m_close_pressed_pm; } 49 inline PixmapWithMask &closePressedPixmap() { return *m_close_pressed_pm; }
50 50
51 inline const PixmapWithMask &maximizePixmap() const { return *m_maximize_pm; } 51 inline const PixmapWithMask &maximizePixmap() const { return *m_maximize_pm; }
52 inline PixmapWithMask &maximizePixmap() { return *m_maximize_pm; } 52 inline PixmapWithMask &maximizePixmap() { return *m_maximize_pm; }
53 53 inline PixmapWithMask &maximizeUnfocusPixmap() { return *m_maximize_unfocus_pm; }
54 inline const PixmapWithMask &maximizePressedPixmap() const { return *m_maximize_pressed_pm; } 54 inline const PixmapWithMask &maximizePressedPixmap() const { return *m_maximize_pressed_pm; }
55 inline PixmapWithMask &maximizePressedPixmap() { return *m_maximize_pressed_pm; } 55 inline PixmapWithMask &maximizePressedPixmap() { return *m_maximize_pressed_pm; }
56 56
57 inline const PixmapWithMask &iconifyPixmap() const { return *m_iconify_pm; } 57 inline const PixmapWithMask &iconifyPixmap() const { return *m_iconify_pm; }
58 inline PixmapWithMask &iconifyPixmap() { return *m_iconify_pm; } 58 inline PixmapWithMask &iconifyPixmap() { return *m_iconify_pm; }
59 59 inline PixmapWithMask &iconifyUnfocusPixmap() { return *m_iconify_unfocus_pm; }
60 inline const PixmapWithMask &iconifyPressedPixmap() const { return *m_iconify_pressed_pm; } 60 inline const PixmapWithMask &iconifyPressedPixmap() const { return *m_iconify_pressed_pm; }
61 inline PixmapWithMask &iconifyPressedPixmap() { return *m_iconify_pressed_pm; } 61 inline PixmapWithMask &iconifyPressedPixmap() { return *m_iconify_pressed_pm; }
62 62
63 inline const PixmapWithMask &stickPixmap() const { return *m_stick_pm; } 63 inline const PixmapWithMask &stickPixmap() const { return *m_stick_pm; }
64 inline PixmapWithMask &stickPixmap() { return *m_stick_pm; } 64 inline PixmapWithMask &stickPixmap() { return *m_stick_pm; }
65 65 inline PixmapWithMask &stickUnfocusPixmap() { return *m_stick_unfocus_pm; }
66 inline const PixmapWithMask &stickPressedPixmap() const { return *m_stick_pressed_pm; } 66 inline const PixmapWithMask &stickPressedPixmap() const { return *m_stick_pressed_pm; }
67 inline PixmapWithMask &stickPressedPixmap() { return *m_stick_pressed_pm; } 67 inline PixmapWithMask &stickPressedPixmap() { return *m_stick_pressed_pm; }
68 68
69 inline PixmapWithMask &stuckPixmap() { return *m_stuck_pm; }
70 inline PixmapWithMask &stuckUnfocusPixmap() { return *m_stuck_unfocus_pm; }
71
69 inline const PixmapWithMask &shadePixmap() const { return *m_shade_pm; } 72 inline const PixmapWithMask &shadePixmap() const { return *m_shade_pm; }
70 inline PixmapWithMask &shadePixmap() { return *m_shade_pm; } 73 inline PixmapWithMask &shadePixmap() { return *m_shade_pm; }
71 74 inline PixmapWithMask &shadeUnfocusPixmap() { return *m_shade_unfocus_pm; }
72 inline const PixmapWithMask &shadePressedPixmap() const { return *m_shade_pressed_pm; } 75 inline const PixmapWithMask &shadePressedPixmap() const { return *m_shade_pressed_pm; }
73 inline PixmapWithMask &shadePressedPixmap() { return *m_shade_pressed_pm; } 76 inline PixmapWithMask &shadePressedPixmap() { return *m_shade_pressed_pm; }
74 FbTk::Subject &reconfigSig() { return m_reconf_sig; } 77 FbTk::Subject &reconfigSig() { return m_reconf_sig; }
75private: 78private:
76 FbTk::Subject m_reconf_sig; 79 FbTk::Subject m_reconf_sig;
77 80
78 FbTk::ThemeItem<PixmapWithMask> m_close_pm, m_close_pressed_pm; 81 FbTk::ThemeItem<PixmapWithMask> m_close_pm, m_close_unfocus_pm, m_close_pressed_pm;
79 FbTk::ThemeItem<PixmapWithMask> m_maximize_pm, m_maximize_pressed_pm; 82 FbTk::ThemeItem<PixmapWithMask> m_maximize_pm, m_maximize_unfocus_pm, m_maximize_pressed_pm;
80 FbTk::ThemeItem<PixmapWithMask> m_iconify_pm, m_iconify_pressed_pm; 83 FbTk::ThemeItem<PixmapWithMask> m_iconify_pm, m_iconify_unfocus_pm, m_iconify_pressed_pm;
81 FbTk::ThemeItem<PixmapWithMask> m_shade_pm, m_shade_pressed_pm; 84 FbTk::ThemeItem<PixmapWithMask> m_shade_pm, m_shade_unfocus_pm, m_shade_pressed_pm;
82 FbTk::ThemeItem<PixmapWithMask> m_stick_pm, m_stick_pressed_pm; 85 FbTk::ThemeItem<PixmapWithMask> m_stick_pm, m_stick_unfocus_pm, m_stick_pressed_pm;
86 FbTk::ThemeItem<PixmapWithMask> m_stuck_pm, m_stuck_unfocus_pm;
83}; 87};
84 88
85#endif // WINBUTTONTHEME_HH 89#endif // WINBUTTONTHEME_HH