aboutsummaryrefslogtreecommitdiff
path: root/src/WinButton.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/WinButton.cc')
-rw-r--r--src/WinButton.cc125
1 files changed, 99 insertions, 26 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();