summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/FbWinFrame.cc28
-rw-r--r--src/WinButton.cc37
-rw-r--r--src/WinButton.hh4
3 files changed, 33 insertions, 36 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index fed91f9..36c8e81 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.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: FbWinFrame.cc,v 1.68 2004/01/02 13:26:44 fluxgen Exp $ 22// $Id: FbWinFrame.cc,v 1.69 2004/01/10 00:37:35 rathnor Exp $
23 23
24#include "FbWinFrame.hh" 24#include "FbWinFrame.hh"
25 25
@@ -560,7 +560,10 @@ void FbWinFrame::buttonReleaseEvent(XButtonEvent &event) {
560} 560}
561 561
562void FbWinFrame::exposeEvent(XExposeEvent &event) { 562void FbWinFrame::exposeEvent(XExposeEvent &event) {
563 if (m_label == event.window) { 563 if (m_titlebar == event.window) {
564 m_titlebar.clearArea(event.x, event.y, event.width, event.height);
565 m_titlebar.updateTransparent(event.x, event.y, event.width, event.height);
566 } else if (m_label == event.window) {
564 m_label.clearArea(event.x, event.y, event.width, event.height); 567 m_label.clearArea(event.x, event.y, event.width, event.height);
565 m_label.updateTransparent(event.x, event.y, event.width, event.height); 568 m_label.updateTransparent(event.x, event.y, event.width, event.height);
566 } else if (m_handle == event.window) { 569 } else if (m_handle == event.window) {
@@ -853,7 +856,6 @@ void FbWinFrame::renderTitlebar() {
853 getCurrentFocusPixmap(label_pm, title_pm, 856 getCurrentFocusPixmap(label_pm, title_pm,
854 label_color, title_color); 857 label_color, title_color);
855 858
856
857 if (label_pm != 0) 859 if (label_pm != 0)
858 m_label.setBackgroundPixmap(label_pm); 860 m_label.setBackgroundPixmap(label_pm);
859 else 861 else
@@ -864,6 +866,9 @@ void FbWinFrame::renderTitlebar() {
864 else 866 else
865 m_titlebar.setBackgroundColor(title_color); 867 m_titlebar.setBackgroundColor(title_color);
866 868
869 m_titlebar.setAlpha(theme().alpha());
870 m_label.setAlpha(theme().alpha());
871
867 renderLabelButtons(); 872 renderLabelButtons();
868 redrawTitlebar(); 873 redrawTitlebar();
869} 874}
@@ -921,16 +926,8 @@ void FbWinFrame::renderHandles() {
921 } 926 }
922 927
923 m_handle.setAlpha(theme().alpha()); 928 m_handle.setAlpha(theme().alpha());
924 m_handle.clear();
925 m_handle.updateTransparent();
926
927 m_grip_left.setAlpha(theme().alpha()); 929 m_grip_left.setAlpha(theme().alpha());
928 m_grip_left.clear();
929 m_grip_left.updateTransparent();
930
931 m_grip_right.setAlpha(theme().alpha()); 930 m_grip_right.setAlpha(theme().alpha());
932 m_grip_right.clear();
933 m_grip_right.updateTransparent();
934 931
935} 932}
936 933
@@ -1160,8 +1157,6 @@ void FbWinFrame::renderButtonFocus(FbTk::TextButton &button) {
1160 } else 1157 } else
1161 button.setBackgroundColor(m_label_focused_color); 1158 button.setBackgroundColor(m_label_focused_color);
1162 1159
1163 button.clear();
1164 button.updateTransparent();
1165} 1160}
1166 1161
1167void FbWinFrame::renderButtonActive(FbTk::TextButton &button) { 1162void FbWinFrame::renderButtonActive(FbTk::TextButton &button) {
@@ -1178,8 +1173,6 @@ void FbWinFrame::renderButtonActive(FbTk::TextButton &button) {
1178 } else 1173 } else
1179 button.setBackgroundColor(m_label_active_color); 1174 button.setBackgroundColor(m_label_active_color);
1180 1175
1181 button.clear();
1182 button.updateTransparent();
1183} 1176}
1184 1177
1185void FbWinFrame::renderButtonUnfocus(FbTk::TextButton &button) { 1178void FbWinFrame::renderButtonUnfocus(FbTk::TextButton &button) {
@@ -1196,15 +1189,13 @@ void FbWinFrame::renderButtonUnfocus(FbTk::TextButton &button) {
1196 } else 1189 } else
1197 button.setBackgroundColor(m_label_unfocused_color); 1190 button.setBackgroundColor(m_label_unfocused_color);
1198 1191
1199 button.clear();
1200 button.updateTransparent();
1201} 1192}
1202 1193
1203void FbWinFrame::updateTransparent() { 1194void FbWinFrame::updateTransparent() {
1204 redrawTitlebar(); 1195 redrawTitlebar();
1205 1196
1206 ButtonList::iterator button_it = m_buttons_left.begin(); 1197 ButtonList::iterator button_it = m_buttons_left.begin();
1207 ButtonList::iterator button_it_end = m_buttons_left.begin(); 1198 ButtonList::iterator button_it_end = m_buttons_left.end();
1208 for (; button_it != button_it_end; ++button_it) { 1199 for (; button_it != button_it_end; ++button_it) {
1209 (*button_it)->clear(); 1200 (*button_it)->clear();
1210 (*button_it)->updateTransparent(); 1201 (*button_it)->updateTransparent();
@@ -1223,6 +1214,7 @@ void FbWinFrame::updateTransparent() {
1223 m_grip_right.updateTransparent(); 1214 m_grip_right.updateTransparent();
1224 m_handle.clear(); 1215 m_handle.clear();
1225 m_handle.updateTransparent(); 1216 m_handle.updateTransparent();
1217
1226} 1218}
1227 1219
1228 1220
diff --git a/src/WinButton.cc b/src/WinButton.cc
index 900d23e..6af0dae 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.16 2003/10/31 19:32:40 rathnor Exp $ 22/// $Id: WinButton.cc,v 1.17 2004/01/10 00:37:35 rathnor Exp $
23 23
24#include "WinButton.hh" 24#include "WinButton.hh"
25#include "App.hh" 25#include "App.hh"
@@ -39,15 +39,17 @@ WinButton::WinButton(const FluxboxWindow &listen_to,
39 39
40void WinButton::exposeEvent(XExposeEvent &event) { 40void WinButton::exposeEvent(XExposeEvent &event) {
41 FbTk::Button::exposeEvent(event); 41 FbTk::Button::exposeEvent(event);
42 drawType(); 42 drawType(false, false);
43} 43}
44 44
45void WinButton::buttonReleaseEvent(XButtonEvent &event) { 45void WinButton::buttonReleaseEvent(XButtonEvent &event) {
46 FbTk::Button::buttonReleaseEvent(event); 46 FbTk::Button::buttonReleaseEvent(event);
47 clear(); 47 clear();
48 updateTransparent();
48} 49}
49 50
50void WinButton::drawType() { 51// clear is used to force this to clear the window (e.g. called from clear())
52void WinButton::drawType(bool clear, bool no_trans) {
51 bool used = false; 53 bool used = false;
52 54
53 // if it's odd and we're centring, we need to add one 55 // if it's odd and we're centring, we need to add one
@@ -79,13 +81,14 @@ void WinButton::drawType() {
79 used = true; 81 used = true;
80 } 82 }
81 } 83 }
82 if (used) 84 if (used || clear)
83 FbTk::FbWindow::clear(); 85 FbTk::FbWindow::clear();
84 86
85 // if no pixmap was used, use old style 87 // if no pixmap was used, use old style
86 if (!used) { 88 if (!used) {
87 if (gc() == 0) // must have valid graphic context 89 if (gc() == 0) // must have valid graphic context
88 return; 90 return;
91
89 drawRectangle(gc(), 92 drawRectangle(gc(),
90 2, 2, width() - 5, height() - 5); 93 2, 2, width() - 5, height() - 5);
91 drawLine(gc(), 94 drawLine(gc(),
@@ -120,9 +123,10 @@ void WinButton::drawType() {
120 123
121 } 124 }
122 125
123 if (used) { 126 if (used || clear) {
124 FbTk::FbWindow::clear(); 127 FbTk::FbWindow::clear();
125 } else if (gc() != 0) { // must have valid graphic context 128 }
129 if (!used && gc() != 0) { // must have valid graphic context
126 FbTk::FbWindow::drawRectangle(gc(), 130 FbTk::FbWindow::drawRectangle(gc(),
127 2, height() - 5, width() - 5, 2); 131 2, height() - 5, width() - 5, 2);
128 } 132 }
@@ -178,9 +182,10 @@ void WinButton::drawType() {
178 182
179 } 183 }
180 184
181 if (used) 185 if (used || clear)
182 FbTk::FbWindow::clear(); 186 FbTk::FbWindow::clear();
183 else if (gc() != 0) { 187
188 if (!used && gc() != 0) {
184 // width/4 != width/2, so we use /4*2 so that it's properly centred 189 // width/4 != width/2, so we use /4*2 so that it's properly centred
185 if (m_listen_to.isStuck()) { 190 if (m_listen_to.isStuck()) {
186 fillRectangle(gc(), 191 fillRectangle(gc(),
@@ -221,9 +226,10 @@ void WinButton::drawType() {
221 } 226 }
222 227
223 228
224 if (used) 229 if (used || clear)
225 FbTk::FbWindow::clear(); 230 FbTk::FbWindow::clear();
226 else if (gc() != 0) { // must have valid graphic context 231
232 if (!used && gc() != 0) { // must have valid graphic context
227 233
228 drawLine(gc(), 234 drawLine(gc(),
229 2, 2, 235 2, 2,
@@ -265,20 +271,19 @@ void WinButton::drawType() {
265 } 271 }
266 } 272 }
267 273
268 274 if (used || clear)
269 FbTk::FbWindow::clear(); 275 FbTk::FbWindow::clear();
270 276
271 break; 277 break;
272 } 278 }
273 updateTransparent(); 279 if ((used || clear) && !no_trans)
280 updateTransparent();
274} 281}
275 282
276void WinButton::clear() { 283void WinButton::clear() {
277 FbTk::Button::clear(); 284 drawType(true, true);
278 drawType();
279} 285}
280 286
281void WinButton::update(FbTk::Subject *subj) { 287void WinButton::update(FbTk::Subject *subj) {
282 clear(); 288 clear();
283 drawType();
284} 289}
diff --git a/src/WinButton.hh b/src/WinButton.hh
index 0cbc4c1..bd673fe 100644
--- a/src/WinButton.hh
+++ b/src/WinButton.hh
@@ -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.hh,v 1.4 2003/04/28 22:39:12 fluxgen Exp $ 22/// $Id: WinButton.hh,v 1.5 2004/01/10 00:37:35 rathnor Exp $
23 23
24#include "Button.hh" 24#include "Button.hh"
25#include "Observer.hh" 25#include "Observer.hh"
@@ -43,7 +43,7 @@ public:
43 void clear(); 43 void clear();
44 void update(FbTk::Subject *subj); 44 void update(FbTk::Subject *subj);
45private: 45private:
46 void drawType(); 46 void drawType(bool clear, bool no_trans); // don't update transparency (eg in clear)
47 Type m_type; ///< the button type 47 Type m_type; ///< the button type
48 const FluxboxWindow &m_listen_to; 48 const FluxboxWindow &m_listen_to;
49 WinButtonTheme &m_theme; 49 WinButtonTheme &m_theme;