aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/WinButton.cc210
1 files changed, 122 insertions, 88 deletions
diff --git a/src/WinButton.cc b/src/WinButton.cc
index 2534296..d029ecf 100644
--- a/src/WinButton.cc
+++ b/src/WinButton.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: WinButton.cc,v 1.10 2003/08/22 21:33:13 fluxgen Exp $ 22/// $Id: WinButton.cc,v 1.11 2003/09/12 22:52:22 fluxgen Exp $
23 23
24#include "WinButton.hh" 24#include "WinButton.hh"
25#include "App.hh" 25#include "App.hh"
@@ -49,32 +49,38 @@ void WinButton::buttonReleaseEvent(XButtonEvent &event) {
49} 49}
50 50
51void WinButton::drawType() { 51void WinButton::drawType() {
52 bool used = false;
52 53
53 switch (m_type) { 54 switch (m_type) {
54 case MAXIMIZE: 55 case MAXIMIZE:
55 if (m_theme.maximizePixmap().pixmap().drawable() != 0) { 56
56 if (pressed()) { 57 if (pressed() && m_theme.maximizePressedPixmap().pixmap().drawable() != 0) {
57 FbTk::FbWindow::setBackgroundPixmap(m_theme. 58 FbTk::FbWindow::setBackgroundPixmap(m_theme.
58 maximizePressedPixmap(). 59 maximizePressedPixmap().
59 pixmap().drawable()); 60 pixmap().drawable());
60 } else if (m_theme.maximizePixmap().pixmap().drawable()) { 61 } else {
61 // check focus 62 // check focus
62 if (!m_listen_to.isFocused() && 63 if (!m_listen_to.isFocused()) {
63 m_theme.maximizeUnfocusPixmap().pixmap().drawable() != 0) { 64 if (m_theme.maximizeUnfocusPixmap().pixmap().drawable() != 0) {
64 // not focused 65 // not focused
65 FbTk::FbWindow::setBackgroundPixmap(m_theme. 66 FbTk::FbWindow::setBackgroundPixmap(m_theme.
66 maximizeUnfocusPixmap(). 67 maximizeUnfocusPixmap().
67 pixmap().drawable()); 68 pixmap().drawable());
68 } else { // focused 69 used = true;
69 FbTk::FbWindow::setBackgroundPixmap(m_theme.
70 maximizePixmap().
71 pixmap().drawable());
72 } 70 }
71 } else if (m_theme.maximizePixmap().pixmap().drawable() != 0) {
72 FbTk::FbWindow::setBackgroundPixmap(m_theme.
73 maximizePixmap().
74 pixmap().drawable());
75 used = true;
73 } 76 }
74 77 }
78 if (used)
75 FbTk::FbWindow::clear(); 79 FbTk::FbWindow::clear();
76 80
77 } else { 81
82 // if no pixmap was used, use old style
83 if (!used) {
78 if (gc() == 0) // must have valid graphic context 84 if (gc() == 0) // must have valid graphic context
79 return; 85 return;
80 drawRectangle(gc(), 86 drawRectangle(gc(),
@@ -84,29 +90,37 @@ void WinButton::drawType() {
84 } 90 }
85 break; 91 break;
86 case MINIMIZE: 92 case MINIMIZE:
87 if (m_theme.iconifyPixmap().pixmap().drawable() != 0) { 93
88 if (pressed()) { 94 if (pressed() && m_theme.iconifyPressedPixmap().pixmap().drawable() != 0) {
89 FbTk::FbWindow::setBackgroundPixmap(m_theme. 95 FbTk::FbWindow::setBackgroundPixmap(m_theme.
90 iconifyPressedPixmap(). 96 iconifyPressedPixmap().
91 pixmap().drawable()); 97 pixmap().drawable());
92 } else if (m_theme.iconifyPixmap().pixmap().drawable()){ 98 used = true;
99 } else {
100 if (m_theme.iconifyPixmap().pixmap().drawable()){
93 // check focus 101 // check focus
94 if (!m_listen_to.isFocused() && 102 if (!m_listen_to.isFocused()) {
95 m_theme.iconifyUnfocusPixmap().pixmap().drawable() != 0) { 103 if (m_theme.iconifyUnfocusPixmap().pixmap().drawable() != 0) {
96 // not focused 104 // not focused
97 FbTk::FbWindow::setBackgroundPixmap(m_theme. 105 FbTk::FbWindow::setBackgroundPixmap(m_theme.
98 iconifyUnfocusPixmap(). 106 iconifyUnfocusPixmap().
99 pixmap().drawable()); 107 pixmap().drawable());
100 } else { // focused 108 used = true;
109 }
110 } else if (m_theme.iconifyPixmap().pixmap().drawable() != 0) {
101 FbTk::FbWindow::setBackgroundPixmap(m_theme. 111 FbTk::FbWindow::setBackgroundPixmap(m_theme.
102 iconifyPixmap(). 112 iconifyPixmap().
103 pixmap().drawable()); 113 pixmap().drawable());
114 used = true;
104 } 115 }
105 } 116 }
117
118 if (used)
119 FbTk::FbWindow::clear();
106 120
107 FbTk::FbWindow::clear(); 121 }
108 122
109 } else { 123 if (!used) {
110 if (gc() == 0) // must have valid graphic context 124 if (gc() == 0) // must have valid graphic context
111 return; 125 return;
112 FbTk::FbWindow::drawRectangle(gc(), 126 FbTk::FbWindow::drawRectangle(gc(),
@@ -114,56 +128,65 @@ void WinButton::drawType() {
114 } 128 }
115 break; 129 break;
116 case STICK: 130 case STICK:
117 if (m_theme.stickPixmap().pixmap().drawable() != 0) { 131
118 if (m_listen_to.isStuck() && 132 if (m_listen_to.isStuck() && !pressed()) {
119 m_theme.stuckPixmap().pixmap().drawable() && 133 if ( m_theme.stuckPixmap().pixmap().drawable() &&
120 ! pressed()) { // we're using the same pixmap for pressed as in not stuck 134 ! pressed()) { // we're using the same pixmap for pressed as in not stuck
121 // check focus 135 // check focus
122 if (!m_listen_to.isFocused() && 136 if (!m_listen_to.isFocused()) {
123 m_theme.stuckUnfocusPixmap().pixmap().drawable() != 0) { 137 if ( m_theme.stuckUnfocusPixmap().pixmap().drawable() != 0) {
124 // not focused 138 // not focused
125 FbTk::FbWindow::setBackgroundPixmap(m_theme. 139 FbTk::FbWindow::setBackgroundPixmap(m_theme.
126 stuckUnfocusPixmap(). 140 stuckUnfocusPixmap().
127 pixmap().drawable()); 141 pixmap().drawable());
128 } else { // focused 142 used = true;
143 }
144 } else if (m_theme.stuckPixmap().pixmap().drawable() != 0) {
145 // focused
129 FbTk::FbWindow::setBackgroundPixmap(m_theme. 146 FbTk::FbWindow::setBackgroundPixmap(m_theme.
130 stuckPixmap(). 147 stuckPixmap().
131 pixmap().drawable()); 148 pixmap().drawable());
149 used = true;
132 } 150 }
133 } else { // not stuck 151 }
152 } else { // not stuck and pressed
134 153
135 if (pressed()) { 154 if (pressed()) {
155 if (m_theme.stickPressedPixmap().pixmap().drawable() == 0) {
136 FbTk::FbWindow::setBackgroundPixmap(m_theme. 156 FbTk::FbWindow::setBackgroundPixmap(m_theme.
137 stickPressedPixmap(). 157 stickPressedPixmap().
138 pixmap().drawable()); 158 pixmap().drawable());
139 159 used = true;
140 } else if (m_theme.stickPixmap().pixmap().drawable()) { 160 }
141 // check focus 161 } else { // not pressed
142 if (!m_listen_to.isFocused() && 162 // check focus
143 m_theme.stickUnfocusPixmap().pixmap().drawable() != 0) { 163 if (!m_listen_to.isFocused()) {
164 if (m_theme.stickUnfocusPixmap().pixmap().drawable() != 0) {
144 // not focused 165 // not focused
145 FbTk::FbWindow::setBackgroundPixmap(m_theme. 166 FbTk::FbWindow::setBackgroundPixmap(m_theme.
146 stickUnfocusPixmap(). 167 stickUnfocusPixmap().
147 pixmap().drawable()); 168 pixmap().drawable());
148 } else { // focused 169 used = true;
149 FbTk::FbWindow::setBackgroundPixmap(m_theme.
150 stickPixmap().
151 pixmap().drawable());
152 } 170 }
153 171 } else if (m_theme.stickPixmap().pixmap().drawable()) { // focused
172 FbTk::FbWindow::setBackgroundPixmap(m_theme.
173 stickPixmap().
174 pixmap().drawable());
175 used = true;
154 } 176 }
155 } // end if stuck
156 177
157 FbTk::FbWindow::clear(); 178 }
158 179
159 } else { 180 }
181
182 if (used)
183 FbTk::FbWindow::clear();
184 else if (gc() != 0) {
160 if (m_listen_to.isStuck()) { 185 if (m_listen_to.isStuck()) {
161 fillRectangle(gc(), 186 fillRectangle(gc(),
162 width()/2 - width()/4, height()/2 - height()/4, 187 width()/2 - width()/4, height()/2 - height()/4,
163 width()/2, height()/2); 188 width()/2, height()/2);
164 } else { 189 } else {
165 if (gc() == 0) // must have valid graphic context
166 return;
167 fillRectangle(gc(), 190 fillRectangle(gc(),
168 width()/2 - width()/10, height()/2 - height()/10, 191 width()/2 - width()/10, height()/2 - height()/10,
169 width()/5, height()/5); 192 width()/5, height()/5);
@@ -172,32 +195,36 @@ void WinButton::drawType() {
172 break; 195 break;
173 case CLOSE: 196 case CLOSE:
174 197
175 if (m_theme.closePixmap().pixmap().drawable() != 0) { 198 if (pressed()) {
176 if (pressed()) { 199 if (m_theme.closePressedPixmap().pixmap().drawable()) {
177 FbTk::FbWindow::setBackgroundPixmap(m_theme. 200 FbTk::FbWindow::setBackgroundPixmap(m_theme.
178 closePressedPixmap(). 201 closePressedPixmap().
179 pixmap().drawable()); 202 pixmap().drawable());
180 203 used = true;
181 } else if (m_theme.closePixmap().pixmap().drawable()) { 204 }
182 // check focus 205 } else { // not pressed
183 if (!m_listen_to.isFocused() && 206 // check focus
184 m_theme.closeUnfocusPixmap().pixmap().drawable() != 0) { 207 if (!m_listen_to.isFocused()) {
208 if (m_theme.closeUnfocusPixmap().pixmap().drawable() != 0) {
185 // not focused 209 // not focused
186 FbTk::FbWindow::setBackgroundPixmap(m_theme. 210 FbTk::FbWindow::setBackgroundPixmap(m_theme.
187 closeUnfocusPixmap(). 211 closeUnfocusPixmap().
188 pixmap().drawable()); 212 pixmap().drawable());
189 } else { // focused 213 used = true;
190 FbTk::FbWindow::setBackgroundPixmap(m_theme.
191 closePixmap().
192 pixmap().drawable());
193 } 214 }
215 } else if (m_theme.closePixmap().pixmap().drawable() != 0) { // focused
216 FbTk::FbWindow::setBackgroundPixmap(m_theme.
217 closePixmap().
218 pixmap().drawable());
219 used = true;
194 } 220 }
221 }
222
195 223
196 FbTk::FbWindow::clear(); 224 if (used)
197 225 FbTk::FbWindow::clear();
198 } else { 226 else if (gc() != 0) { // must have valid graphic context
199 if (gc() == 0) // must have valid graphic context 227
200 return;
201 drawLine(gc(), 228 drawLine(gc(),
202 2, 2, 229 2, 2,
203 width() - 3, height() - 3); 230 width() - 3, height() - 3);
@@ -207,28 +234,35 @@ void WinButton::drawType() {
207 } 234 }
208 break; 235 break;
209 case SHADE: 236 case SHADE:
210 if (m_theme.shadePixmap().pixmap().drawable() != 0) { 237
211 if (pressed()) { 238 if (pressed()) {
239 if (m_theme.shadePressedPixmap().pixmap().drawable()) {
212 FbTk::FbWindow::setBackgroundPixmap(m_theme. 240 FbTk::FbWindow::setBackgroundPixmap(m_theme.
213 shadePressedPixmap(). 241 shadePressedPixmap().
214 pixmap().drawable()); 242 pixmap().drawable());
215 } else if (m_theme.shadePixmap().pixmap().drawable()) { 243 used = true;
216 // check focus 244 }
217 if (!m_listen_to.isFocused() && 245 } else { // not pressed
218 m_theme.shadeUnfocusPixmap().pixmap().drawable() != 0) { 246 // check focus
247 if (!m_listen_to.isFocused()) {
248 if ( m_theme.shadeUnfocusPixmap().pixmap().drawable() != 0) {
219 // not focused 249 // not focused
220 FbTk::FbWindow::setBackgroundPixmap(m_theme. 250 FbTk::FbWindow::setBackgroundPixmap(m_theme.
221 shadeUnfocusPixmap(). 251 shadeUnfocusPixmap().
222 pixmap().drawable()); 252 pixmap().drawable());
223 } else { // focused 253 used = true;
224 FbTk::FbWindow::setBackgroundPixmap(m_theme.
225 shadePixmap().
226 pixmap().drawable());
227 } 254 }
255 } else if (m_theme.shadePixmap().pixmap().drawable() != 0) { // focused
256 FbTk::FbWindow::setBackgroundPixmap(m_theme.
257 shadePixmap().
258 pixmap().drawable());
259 used = true;
228 } 260 }
229
230 FbTk::FbWindow::clear();
231 } 261 }
262
263
264 FbTk::FbWindow::clear();
265
232 break; 266 break;
233 } 267 }
234} 268}