aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/WinButton.cc67
1 files changed, 35 insertions, 32 deletions
diff --git a/src/WinButton.cc b/src/WinButton.cc
index e9f49b0..0756515 100644
--- a/src/WinButton.cc
+++ b/src/WinButton.cc
@@ -19,16 +19,18 @@
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.2 2003/02/23 01:06:23 fluxgen Exp $ 22/// $Id: WinButton.cc,v 1.3 2003/04/25 17:35:28 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 27
27WinButton::WinButton(Type buttontype, const FbTk::FbWindow &parent, 28WinButton::WinButton(const FluxboxWindow &listen_to,
29 Type buttontype, const FbTk::FbWindow &parent,
28 int x, int y, 30 int x, int y,
29 unsigned int width, unsigned int height): 31 unsigned int width, unsigned int height):
30 FbTk::Button(parent, x, y, width, height), 32 FbTk::Button(parent, x, y, width, height),
31 m_type(buttontype) { 33 m_type(buttontype), m_listen_to(listen_to) {
32 34
33} 35}
34 36
@@ -37,48 +39,45 @@ void WinButton::exposeEvent(XExposeEvent &event) {
37 drawType(); 39 drawType();
38} 40}
39 41
42void WinButton::buttonReleaseEvent(XButtonEvent &event) {
43 FbTk::Button::buttonReleaseEvent(event);
44 clear();
45}
46
40void WinButton::drawType() { 47void WinButton::drawType() {
41 if (gc() == 0) // must have valid graphic context 48 if (gc() == 0) // must have valid graphic context
42 return; 49 return;
43 50
44 Display *disp = FbTk::App::instance()->display();
45 switch (m_type) { 51 switch (m_type) {
46 case MAXIMIZE: 52 case MAXIMIZE:
47 XDrawRectangle(disp, window().window(), 53 window().drawRectangle(gc(),
48 gc(), 54 2, 2, width() - 5, height() - 5);
49 2, 2, width() - 5, height() - 5); 55 window().drawLine(gc(),
50 XDrawLine(disp, window().window(), 56 2, 3, width() - 3, 3);
51 gc(),
52 2, 3, width() - 3, 3);
53 break; 57 break;
54 case MINIMIZE: 58 case MINIMIZE:
55 XDrawRectangle(disp, window().window(), 59 window().drawRectangle(gc(),
56 gc(), 60 2, height() - 5, width() - 5, 2);
57 2, height() - 5, width() - 5, 2);
58 break; 61 break;
59 case STICK: 62 case STICK:
60 /* if (m_stuck) { 63 if (m_listen_to.isStuck()) {
61 XFillRectangle(disp, window().window(), 64 window().fillRectangle(gc(),
62 gc(), 65 width()/2 - width()/4, height()/2 - height()/4,
63 width()/2 - width()/4, height()/2 - height()/4, 66 width()/2, height()/2);
64 width()/2, height()/2); 67 } else {
65 } else { */ 68 window().fillRectangle(gc(),
66 XFillRectangle(disp, window().window(), 69 width()/2, height()/2,
67 gc(), 70 width()/5, height()/5);
68 width()/2, height()/2, 71 }
69 width()/5, height()/5);
70 // }
71 72
72 break; 73 break;
73 case CLOSE: 74 case CLOSE:
74 XDrawLine(disp, window().window(), 75 window().drawLine(gc(),
75 gc(), 76 2, 2,
76 2, 2, 77 width() - 3, height() - 3);
77 width() - 3, height() - 3); 78 window().drawLine(gc(),
78 XDrawLine(disp, window().window(), 79 2, width() - 3,
79 gc(), 80 height() - 3, 2);
80 2, width() - 3,
81 height() - 3, 2);
82 break; 81 break;
83 case SHADE: 82 case SHADE:
84 break; 83 break;
@@ -89,3 +88,7 @@ void WinButton::clear() {
89 FbTk::Button::clear(); 88 FbTk::Button::clear();
90 drawType(); 89 drawType();
91} 90}
91
92void WinButton::update(FbTk::Subject *subj) {
93 clear();
94}