aboutsummaryrefslogtreecommitdiff
path: root/src/WinButton.cc
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2013-02-06 12:47:11 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2013-02-06 12:47:17 (GMT)
commit34343bb20bdb3dc94fe426f69e5db16315353d57 (patch)
treecbf01e0b2af4ca14c093ada589f82558ec7d3a66 /src/WinButton.cc
parent94fddc09c064555721dc521e3e94ed6f610653b9 (diff)
downloadfluxbox-34343bb20bdb3dc94fe426f69e5db16315353d57.zip
fluxbox-34343bb20bdb3dc94fe426f69e5db16315353d57.tar.bz2
Feature #3602124: 'LHalf' and 'RHalf' buttons to the titlebar
First draft of feature request of #3602124: Having 2 buttons in the titlebar which allow quick positioning of a Window into the left or right half of the current monitor.
Diffstat (limited to 'src/WinButton.cc')
-rw-r--r--src/WinButton.cc35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/WinButton.cc b/src/WinButton.cc
index e1b79a2..bb841fb 100644
--- a/src/WinButton.cc
+++ b/src/WinButton.cc
@@ -137,6 +137,10 @@ Pixmap WinButton::getPixmap(const FbTk::ThemeProxy<WinButtonTheme> &theme) const
137 return theme->titlePixmap().pixmap().drawable(); 137 return theme->titlePixmap().pixmap().drawable();
138 else 138 else
139 return theme->menuiconPixmap().pixmap().drawable(); 139 return theme->menuiconPixmap().pixmap().drawable();
140 case LEFT_HALF:
141 return theme->leftHalfPixmap().pixmap().drawable();
142 case RIGHT_HALF:
143 return theme->rightHalfPixmap().pixmap().drawable();
140 default: 144 default:
141 return None; 145 return None;
142 } 146 }
@@ -160,18 +164,14 @@ void WinButton::drawType() {
160 // otherwise draw old style imagery 164 // otherwise draw old style imagery
161 switch (m_type) { 165 switch (m_type) {
162 case MAXIMIZE: 166 case MAXIMIZE:
163 // if no pixmap was used, use old style 167 drawRectangle(gc(), 2, 2, width() - 5, height() - 5);
164 if (gc() == 0) // must have valid graphic context 168 drawLine(gc(), 2, 3, width() - 3, 3);
165 return;
166
167 drawRectangle(gc(),
168 2, 2, width() - 5, height() - 5);
169 drawLine(gc(),
170 2, 3, width() - 3, 3);
171 break; 169 break;
170
172 case MINIMIZE: 171 case MINIMIZE:
173 drawRectangle(gc(), 2, height() - 5, width() - 5, 2); 172 drawRectangle(gc(), 2, height() - 5, width() - 5, 2);
174 break; 173 break;
174
175 case STICK: 175 case STICK:
176 // width/4 != width/2, so we use /4*2 so that it's properly centred 176 // width/4 != width/2, so we use /4*2 so that it's properly centred
177 if (m_listen_to.isStuck()) { 177 if (m_listen_to.isStuck()) {
@@ -184,6 +184,7 @@ void WinButton::drawType() {
184 width()/10*2 + oddW, height()/10*2 + oddH); 184 width()/10*2 + oddW, height()/10*2 + oddH);
185 } 185 }
186 break; 186 break;
187
187 case CLOSE: 188 case CLOSE:
188 drawLine(gc(), 189 drawLine(gc(),
189 2, 2, 190 2, 2,
@@ -199,15 +200,12 @@ void WinButton::drawType() {
199 // XFree86 Version 4.3.0.1 (Debian 4.3.0.dfsg.1-1 20040428170728) 200 // XFree86 Version 4.3.0.1 (Debian 4.3.0.dfsg.1-1 20040428170728)
200 // (X Protocol Version 11, Revision 0, Release 6.6) 201 // (X Protocol Version 11, Revision 0, Release 6.6)
201 202
202 drawLine(gc(), 203 drawLine(gc(), 2, height() - 3, width() - 3, 2);
203 2, height() - 3,
204 width() - 3, 2);
205 break; 204 break;
206 case SHADE:
207 205
206 case SHADE:
208 { 207 {
209 int size = width() - 5 - oddW; 208 int size = width() - 5 - oddW;
210
211 drawRectangle(gc(), 2, 2, size, 2); 209 drawRectangle(gc(), 2, 2, size, 2);
212 210
213 // draw a one-quarter triangle below the rectangle 211 // draw a one-quarter triangle below the rectangle
@@ -220,6 +218,7 @@ void WinButton::drawType() {
220 218
221 break; 219 break;
222 } 220 }
221
223 case MENUICON: 222 case MENUICON:
224 if (m_icon_pixmap.drawable()) { 223 if (m_icon_pixmap.drawable()) {
225 224
@@ -242,10 +241,16 @@ void WinButton::drawType() {
242 for (unsigned int y = height()/3; y <= height() - height()/3; y+=3) { 241 for (unsigned int y = height()/3; y <= height() - height()/3; y+=3) {
243 drawLine(gc(), width()/4, y, width() - width()/4 - oddW - 1, y); 242 drawLine(gc(), width()/4, y, width() - width()/4 - oddW - 1, y);
244 } 243 }
245 drawRectangle(gc(), 244 drawRectangle(gc(), 2, 2, width() - 5, height() - 5);
246 2, 2, width() - 5, height() - 5);
247 } 245 }
248 break; 246 break;
247
248 case LEFT_HALF:
249 fillRectangle(gc(), 2, 2, (width() / 2) - oddW, height() - 4);
250 break;
251 case RIGHT_HALF:
252 fillRectangle(gc(), width() / 2, 2, (width() / 2) - 2 + oddW, height() - 4);
253 break;
249 } 254 }
250} 255}
251 256