aboutsummaryrefslogtreecommitdiff
path: root/src/WinButton.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-08-13 10:14:54 (GMT)
committerfluxgen <fluxgen>2003-08-13 10:14:54 (GMT)
commit662be09609358784d08f1aa6d01ae0c88047cafa (patch)
tree50e994e66fe823fe67c18292af0ae6c2206edc6e /src/WinButton.cc
parent225e89d7754f15fa5947548e552fa5ce03141f80 (diff)
downloadfluxbox-662be09609358784d08f1aa6d01ae0c88047cafa.zip
fluxbox-662be09609358784d08f1aa6d01ae0c88047cafa.tar.bz2
Button changed to a FbWindow
Diffstat (limited to 'src/WinButton.cc')
-rw-r--r--src/WinButton.cc153
1 files changed, 76 insertions, 77 deletions
diff --git a/src/WinButton.cc b/src/WinButton.cc
index 36c7360..078daa9 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.7 2003/08/04 12:52:39 fluxgen Exp $ 22/// $Id: WinButton.cc,v 1.8 2003/08/13 10:14:54 fluxgen Exp $
23 23
24#include "WinButton.hh" 24#include "WinButton.hh"
25#include "App.hh" 25#include "App.hh"
@@ -82,7 +82,7 @@ WinButton::WinButton(const FluxboxWindow &listen_to,
82void WinButton::exposeEvent(XExposeEvent &event) { 82void WinButton::exposeEvent(XExposeEvent &event) {
83 FbTk::Button::exposeEvent(event); 83 FbTk::Button::exposeEvent(event);
84 drawType(); 84 drawType();
85 window().updateTransparent(); 85 updateTransparent();
86} 86}
87 87
88void WinButton::buttonReleaseEvent(XButtonEvent &event) { 88void WinButton::buttonReleaseEvent(XButtonEvent &event) {
@@ -92,68 +92,67 @@ void WinButton::buttonReleaseEvent(XButtonEvent &event) {
92 92
93void WinButton::drawType() { 93void WinButton::drawType() {
94 94
95
96 switch (m_type) { 95 switch (m_type) {
97 case MAXIMIZE: 96 case MAXIMIZE:
98 if (m_theme.maximizePixmap().pixmap_scaled.drawable() != 0) { 97 if (m_theme.maximizePixmap().pixmap_scaled.drawable() != 0) {
99 if (pressed()) { 98 if (pressed()) {
100 window().setBackgroundPixmap(m_theme. 99 FbTk::FbWindow::setBackgroundPixmap(m_theme.
101 maximizePressedPixmap(). 100 maximizePressedPixmap().
102 pixmap_scaled.drawable()); 101 pixmap_scaled.drawable());
103 } else if (m_theme.maximizePixmap().pixmap_scaled.drawable()) { 102 } else if (m_theme.maximizePixmap().pixmap_scaled.drawable()) {
104 // check focus 103 // check focus
105 if (!m_listen_to.isFocused() && 104 if (!m_listen_to.isFocused() &&
106 m_theme.maximizeUnfocusPixmap().pixmap_scaled.drawable() != 0) { 105 m_theme.maximizeUnfocusPixmap().pixmap_scaled.drawable() != 0) {
107 // not focused 106 // not focused
108 window().setBackgroundPixmap(m_theme. 107 FbTk::FbWindow::setBackgroundPixmap(m_theme.
109 maximizeUnfocusPixmap(). 108 maximizeUnfocusPixmap().
110 pixmap_scaled.drawable()); 109 pixmap_scaled.drawable());
111 } else { // focused 110 } else { // focused
112 window().setBackgroundPixmap(m_theme. 111 FbTk::FbWindow::setBackgroundPixmap(m_theme.
113 maximizePixmap(). 112 maximizePixmap().
114 pixmap_scaled.drawable()); 113 pixmap_scaled.drawable());
115 } 114 }
116 } 115 }
117 116
118 window().clear(); 117 FbTk::FbWindow::clear();
119 118
120 } else { 119 } else {
121 if (gc() == 0) // must have valid graphic context 120 if (gc() == 0) // must have valid graphic context
122 return; 121 return;
123 window().drawRectangle(gc(), 122 drawRectangle(gc(),
124 2, 2, width() - 5, height() - 5); 123 2, 2, width() - 5, height() - 5);
125 window().drawLine(gc(), 124 drawLine(gc(),
126 2, 3, width() - 3, 3); 125 2, 3, width() - 3, 3);
127 } 126 }
128 break; 127 break;
129 case MINIMIZE: 128 case MINIMIZE:
130 if (m_theme.iconifyPixmap().pixmap_scaled.drawable() != 0) { 129 if (m_theme.iconifyPixmap().pixmap_scaled.drawable() != 0) {
131 if (pressed()) { 130 if (pressed()) {
132 window().setBackgroundPixmap(m_theme. 131 FbTk::FbWindow::setBackgroundPixmap(m_theme.
133 iconifyPressedPixmap(). 132 iconifyPressedPixmap().
134 pixmap_scaled.drawable()); 133 pixmap_scaled.drawable());
135 } else if (m_theme.iconifyPixmap().pixmap_scaled.drawable()){ 134 } else if (m_theme.iconifyPixmap().pixmap_scaled.drawable()){
136 // check focus 135 // check focus
137 if (!m_listen_to.isFocused() && 136 if (!m_listen_to.isFocused() &&
138 m_theme.iconifyUnfocusPixmap().pixmap_scaled.drawable() != 0) { 137 m_theme.iconifyUnfocusPixmap().pixmap_scaled.drawable() != 0) {
139 // not focused 138 // not focused
140 window().setBackgroundPixmap(m_theme. 139 FbTk::FbWindow::setBackgroundPixmap(m_theme.
141 iconifyUnfocusPixmap(). 140 iconifyUnfocusPixmap().
142 pixmap_scaled.drawable()); 141 pixmap_scaled.drawable());
143 } else { // focused 142 } else { // focused
144 window().setBackgroundPixmap(m_theme. 143 FbTk::FbWindow::setBackgroundPixmap(m_theme.
145 iconifyPixmap(). 144 iconifyPixmap().
146 pixmap_scaled.drawable()); 145 pixmap_scaled.drawable());
147 } 146 }
148 } 147 }
149 148
150 window().clear(); 149 FbTk::FbWindow::clear();
151 150
152 } else { 151 } else {
153 if (gc() == 0) // must have valid graphic context 152 if (gc() == 0) // must have valid graphic context
154 return; 153 return;
155 window().drawRectangle(gc(), 154 FbTk::FbWindow::drawRectangle(gc(),
156 2, height() - 5, width() - 5, 2); 155 2, height() - 5, width() - 5, 2);
157 } 156 }
158 break; 157 break;
159 case STICK: 158 case STICK:
@@ -165,51 +164,51 @@ void WinButton::drawType() {
165 if (!m_listen_to.isFocused() && 164 if (!m_listen_to.isFocused() &&
166 m_theme.stuckUnfocusPixmap().pixmap_scaled.drawable() != 0) { 165 m_theme.stuckUnfocusPixmap().pixmap_scaled.drawable() != 0) {
167 // not focused 166 // not focused
168 window().setBackgroundPixmap(m_theme. 167 FbTk::FbWindow::setBackgroundPixmap(m_theme.
169 stuckUnfocusPixmap(). 168 stuckUnfocusPixmap().
170 pixmap_scaled.drawable()); 169 pixmap_scaled.drawable());
171 } else { // focused 170 } else { // focused
172 window().setBackgroundPixmap(m_theme. 171 FbTk::FbWindow::setBackgroundPixmap(m_theme.
173 stuckPixmap(). 172 stuckPixmap().
174 pixmap_scaled.drawable()); 173 pixmap_scaled.drawable());
175 } 174 }
176 } else { // not stuck 175 } else { // not stuck
177 176
178 if (pressed()) { 177 if (pressed()) {
179 window().setBackgroundPixmap(m_theme. 178 FbTk::FbWindow::setBackgroundPixmap(m_theme.
180 stickPressedPixmap(). 179 stickPressedPixmap().
181 pixmap_scaled.drawable()); 180 pixmap_scaled.drawable());
182 181
183 } else if (m_theme.stickPixmap().pixmap_scaled.drawable()) { 182 } else if (m_theme.stickPixmap().pixmap_scaled.drawable()) {
184 // check focus 183 // check focus
185 if (!m_listen_to.isFocused() && 184 if (!m_listen_to.isFocused() &&
186 m_theme.stickUnfocusPixmap().pixmap_scaled.drawable() != 0) { 185 m_theme.stickUnfocusPixmap().pixmap_scaled.drawable() != 0) {
187 // not focused 186 // not focused
188 window().setBackgroundPixmap(m_theme. 187 FbTk::FbWindow::setBackgroundPixmap(m_theme.
189 stickUnfocusPixmap(). 188 stickUnfocusPixmap().
190 pixmap_scaled.drawable()); 189 pixmap_scaled.drawable());
191 } else { // focused 190 } else { // focused
192 window().setBackgroundPixmap(m_theme. 191 FbTk::FbWindow::setBackgroundPixmap(m_theme.
193 stickPixmap(). 192 stickPixmap().
194 pixmap_scaled.drawable()); 193 pixmap_scaled.drawable());
195 } 194 }
196 195
197 } 196 }
198 } // end if stuck 197 } // end if stuck
199 198
200 window().clear(); 199 FbTk::FbWindow::clear();
201 200
202 } else { 201 } else {
203 if (m_listen_to.isStuck()) { 202 if (m_listen_to.isStuck()) {
204 window().fillRectangle(gc(), 203 fillRectangle(gc(),
205 width()/2 - width()/4, height()/2 - height()/4, 204 width()/2 - width()/4, height()/2 - height()/4,
206 width()/2, height()/2); 205 width()/2, height()/2);
207 } else { 206 } else {
208 if (gc() == 0) // must have valid graphic context 207 if (gc() == 0) // must have valid graphic context
209 return; 208 return;
210 window().fillRectangle(gc(), 209 fillRectangle(gc(),
211 width()/2 - width()/10, height()/2 - height()/10, 210 width()/2 - width()/10, height()/2 - height()/10,
212 width()/5, height()/5); 211 width()/5, height()/5);
213 } 212 }
214 } 213 }
215 break; 214 break;
@@ -217,60 +216,60 @@ void WinButton::drawType() {
217 216
218 if (m_theme.closePixmap().pixmap_scaled.drawable() != 0) { 217 if (m_theme.closePixmap().pixmap_scaled.drawable() != 0) {
219 if (pressed()) { 218 if (pressed()) {
220 window().setBackgroundPixmap(m_theme. 219 FbTk::FbWindow::setBackgroundPixmap(m_theme.
221 closePressedPixmap(). 220 closePressedPixmap().
222 pixmap_scaled.drawable()); 221 pixmap_scaled.drawable());
223 222
224 } else if (m_theme.closePixmap().pixmap_scaled.drawable()) { 223 } else if (m_theme.closePixmap().pixmap_scaled.drawable()) {
225 // check focus 224 // check focus
226 if (!m_listen_to.isFocused() && 225 if (!m_listen_to.isFocused() &&
227 m_theme.closeUnfocusPixmap().pixmap_scaled.drawable() != 0) { 226 m_theme.closeUnfocusPixmap().pixmap_scaled.drawable() != 0) {
228 // not focused 227 // not focused
229 window().setBackgroundPixmap(m_theme. 228 FbTk::FbWindow::setBackgroundPixmap(m_theme.
230 closeUnfocusPixmap(). 229 closeUnfocusPixmap().
231 pixmap_scaled.drawable()); 230 pixmap_scaled.drawable());
232 } else { // focused 231 } else { // focused
233 window().setBackgroundPixmap(m_theme. 232 FbTk::FbWindow::setBackgroundPixmap(m_theme.
234 closePixmap(). 233 closePixmap().
235 pixmap_scaled.drawable()); 234 pixmap_scaled.drawable());
236 } 235 }
237 } 236 }
238 237
239 window().clear(); 238 FbTk::FbWindow::clear();
240 239
241 } else { 240 } else {
242 if (gc() == 0) // must have valid graphic context 241 if (gc() == 0) // must have valid graphic context
243 return; 242 return;
244 window().drawLine(gc(), 243 drawLine(gc(),
245 2, 2, 244 2, 2,
246 width() - 3, height() - 3); 245 width() - 3, height() - 3);
247 window().drawLine(gc(), 246 drawLine(gc(),
248 2, width() - 3, 247 2, width() - 3,
249 height() - 3, 2); 248 height() - 3, 2);
250 } 249 }
251 break; 250 break;
252 case SHADE: 251 case SHADE:
253 if (m_theme.shadePixmap().pixmap_scaled.drawable() != 0) { 252 if (m_theme.shadePixmap().pixmap_scaled.drawable() != 0) {
254 if (pressed()) { 253 if (pressed()) {
255 window().setBackgroundPixmap(m_theme. 254 FbTk::FbWindow::setBackgroundPixmap(m_theme.
256 shadePressedPixmap(). 255 shadePressedPixmap().
257 pixmap_scaled.drawable()); 256 pixmap_scaled.drawable());
258 } else if (m_theme.shadePixmap().pixmap_scaled.drawable()) { 257 } else if (m_theme.shadePixmap().pixmap_scaled.drawable()) {
259 // check focus 258 // check focus
260 if (!m_listen_to.isFocused() && 259 if (!m_listen_to.isFocused() &&
261 m_theme.shadeUnfocusPixmap().pixmap_scaled.drawable() != 0) { 260 m_theme.shadeUnfocusPixmap().pixmap_scaled.drawable() != 0) {
262 // not focused 261 // not focused
263 window().setBackgroundPixmap(m_theme. 262 FbTk::FbWindow::setBackgroundPixmap(m_theme.
264 shadeUnfocusPixmap(). 263 shadeUnfocusPixmap().
265 pixmap_scaled.drawable()); 264 pixmap_scaled.drawable());
266 } else { // focused 265 } else { // focused
267 window().setBackgroundPixmap(m_theme. 266 FbTk::FbWindow::setBackgroundPixmap(m_theme.
268 shadePixmap(). 267 shadePixmap().
269 pixmap_scaled.drawable()); 268 pixmap_scaled.drawable());
270 } 269 }
271 } 270 }
272 271
273 window().clear(); 272 FbTk::FbWindow::clear();
274 } 273 }
275 break; 274 break;
276 } 275 }