diff options
author | simonb <simonb> | 2005-04-10 18:18:14 (GMT) |
---|---|---|
committer | simonb <simonb> | 2005-04-10 18:18:14 (GMT) |
commit | 88c66f0687d2a9e2018f22407b2587dc4d87d012 (patch) | |
tree | 197308ad2426783058f479d12329548c6a8a4374 /src/FbTk/Button.cc | |
parent | 6cf66c66554a20a1c98eddf26af9e35b7c90cbd5 (diff) | |
download | fluxbox_pavel-88c66f0687d2a9e2018f22407b2587dc4d87d012.zip fluxbox_pavel-88c66f0687d2a9e2018f22407b2587dc4d87d012.tar.bz2 |
Big changes to how transparency works
Consequently rearrange lots of rendering ops, and strip calls to
updateTransparent
Diffstat (limited to 'src/FbTk/Button.cc')
-rw-r--r-- | src/FbTk/Button.cc | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/src/FbTk/Button.cc b/src/FbTk/Button.cc index c48b355..414979b 100644 --- a/src/FbTk/Button.cc +++ b/src/FbTk/Button.cc | |||
@@ -33,10 +33,9 @@ Button::Button(int screen_num, int x, int y, | |||
33 | unsigned int width, unsigned int height): | 33 | unsigned int width, unsigned int height): |
34 | FbWindow(screen_num, x, y, width, height, | 34 | FbWindow(screen_num, x, y, width, height, |
35 | ExposureMask | ButtonPressMask | ButtonReleaseMask), | 35 | ExposureMask | ButtonPressMask | ButtonReleaseMask), |
36 | m_foreground_pm(0), | ||
37 | m_background_pm(0), | 36 | m_background_pm(0), |
38 | m_pressed_pm(0), | 37 | m_pressed_pm(0), |
39 | m_pressed_color("black", screen_num), | 38 | m_pressed_color(), |
40 | m_gc(DefaultGC(FbTk::App::instance()->display(), screen_num)), | 39 | m_gc(DefaultGC(FbTk::App::instance()->display(), screen_num)), |
41 | m_pressed(false) { | 40 | m_pressed(false) { |
42 | 41 | ||
@@ -48,10 +47,9 @@ Button::Button(const FbWindow &parent, int x, int y, | |||
48 | unsigned int width, unsigned int height): | 47 | unsigned int width, unsigned int height): |
49 | FbWindow(parent, x, y, width, height, | 48 | FbWindow(parent, x, y, width, height, |
50 | ExposureMask | ButtonPressMask | ButtonReleaseMask), | 49 | ExposureMask | ButtonPressMask | ButtonReleaseMask), |
51 | m_foreground_pm(0), | ||
52 | m_background_pm(0), | 50 | m_background_pm(0), |
53 | m_pressed_pm(0), | 51 | m_pressed_pm(0), |
54 | m_pressed_color("black", parent.screenNumber()), | 52 | m_pressed_color(), |
55 | m_gc(DefaultGC(FbTk::App::instance()->display(), screenNumber())), | 53 | m_gc(DefaultGC(FbTk::App::instance()->display(), screenNumber())), |
56 | m_pressed(false) { | 54 | m_pressed(false) { |
57 | // add this to eventmanager | 55 | // add this to eventmanager |
@@ -70,15 +68,12 @@ void Button::setOnClick(RefCount<Command> &cmd, int button) { | |||
70 | m_onclick[button - 1] = cmd; | 68 | m_onclick[button - 1] = cmd; |
71 | } | 69 | } |
72 | 70 | ||
73 | void Button::setPixmap(Pixmap pm) { | ||
74 | m_foreground_pm = pm; | ||
75 | } | ||
76 | |||
77 | void Button::setPressedPixmap(Pixmap pm) { | 71 | void Button::setPressedPixmap(Pixmap pm) { |
78 | m_pressed_pm = pm; | 72 | m_pressed_pm = pm; |
79 | } | 73 | } |
80 | 74 | ||
81 | void Button::setPressedColor(const FbTk::Color &color) { | 75 | void Button::setPressedColor(const FbTk::Color &color) { |
76 | m_pressed_pm = None; | ||
82 | m_pressed_color = color; | 77 | m_pressed_color = color; |
83 | } | 78 | } |
84 | 79 | ||
@@ -115,27 +110,16 @@ void Button::buttonReleaseEvent(XButtonEvent &event) { | |||
115 | if (m_background_pm) { | 110 | if (m_background_pm) { |
116 | if (m_pressed_pm != 0) { | 111 | if (m_pressed_pm != 0) { |
117 | update = true; | 112 | update = true; |
118 | setBackgroundPixmap(m_background_pm); | 113 | FbTk::FbWindow::setBackgroundPixmap(m_background_pm); |
119 | } | 114 | } |
120 | } else if (m_pressed_color.isAllocated()) { | 115 | } else if (m_pressed_color.isAllocated()) { |
121 | update = true; | 116 | update = true; |
122 | setBackgroundColor(m_background_color); | 117 | FbTk::FbWindow::setBackgroundColor(m_background_color); |
123 | } | 118 | } |
124 | 119 | ||
125 | if (update) { | 120 | if (update) |
126 | clear(); // clear background | 121 | clear(); // clear background |
127 | 122 | ||
128 | if (m_foreground_pm) { // draw foreground pixmap | ||
129 | Display *disp = App::instance()->display(); | ||
130 | |||
131 | if (m_gc == 0) // get default gc if we dont have one | ||
132 | m_gc = DefaultGC(disp, screenNumber()); | ||
133 | |||
134 | XCopyArea(disp, m_foreground_pm, window(), m_gc, 0, 0, width(), height(), 0, 0); | ||
135 | } | ||
136 | |||
137 | } | ||
138 | |||
139 | // finaly, execute command (this must be done last since this object might be deleted by the command) | 123 | // finaly, execute command (this must be done last since this object might be deleted by the command) |
140 | if (event.button > 0 && event.button <= 5 && | 124 | if (event.button > 0 && event.button <= 5 && |
141 | event.x > 0 && event.x < static_cast<signed>(width()) && | 125 | event.x > 0 && event.x < static_cast<signed>(width()) && |
@@ -147,14 +131,7 @@ void Button::buttonReleaseEvent(XButtonEvent &event) { | |||
147 | } | 131 | } |
148 | 132 | ||
149 | void Button::exposeEvent(XExposeEvent &event) { | 133 | void Button::exposeEvent(XExposeEvent &event) { |
150 | /* | ||
151 | if (m_background_pm) | ||
152 | setBackgroundPixmap(m_background_pm); | ||
153 | else | ||
154 | setBackgroundColor(m_background_color); | ||
155 | */ | ||
156 | clearArea(event.x, event.y, event.width, event.height); | 134 | clearArea(event.x, event.y, event.width, event.height); |
157 | // updateTransparent(event.x, event.y, event.width, event.height); | ||
158 | } | 135 | } |
159 | 136 | ||
160 | }; // end namespace FbTk | 137 | }; // end namespace FbTk |