aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-08-13 16:36:37 (GMT)
committerfluxgen <fluxgen>2003-08-13 16:36:37 (GMT)
commit884928264a5cc52c6f255478cdfa4b7d8354f0c6 (patch)
tree7309d823dc9ec9e118e0e8e309f109c2ed34b15e
parent9ffcd43e703f0e1d669087999eac6c834da8da8a (diff)
downloadfluxbox-884928264a5cc52c6f255478cdfa4b7d8354f0c6.zip
fluxbox-884928264a5cc52c6f255478cdfa4b7d8354f0c6.tar.bz2
fixed rendering problem on focused textbutton
-rw-r--r--src/FbWinFrame.cc67
-rw-r--r--src/FbWinFrame.hh20
2 files changed, 61 insertions, 26 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index 9b2a9e8..c65f0b6 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.35 2003/08/13 09:34:40 fluxgen Exp $ 22// $Id: FbWinFrame.cc,v 1.36 2003/08/13 16:36:37 fluxgen Exp $
23 23
24#include "FbWinFrame.hh" 24#include "FbWinFrame.hh"
25#include "ImageControl.hh" 25#include "ImageControl.hh"
@@ -271,7 +271,7 @@ void FbWinFrame::removeAllButtons() {
271 } 271 }
272} 272}
273 273
274void FbWinFrame::addLabelButton(FbTk::Button &btn) { 274void FbWinFrame::addLabelButton(TextButton &btn) {
275 LabelList::iterator found_it = find(m_labelbuttons.begin(), 275 LabelList::iterator found_it = find(m_labelbuttons.begin(),
276 m_labelbuttons.end(), 276 m_labelbuttons.end(),
277 &btn); 277 &btn);
@@ -282,7 +282,7 @@ void FbWinFrame::addLabelButton(FbTk::Button &btn) {
282 m_labelbuttons.push_back(&btn); 282 m_labelbuttons.push_back(&btn);
283} 283}
284 284
285void FbWinFrame::removeLabelButton(FbTk::Button &btn) { 285void FbWinFrame::removeLabelButton(TextButton &btn) {
286 LabelList::iterator erase_it = remove(m_labelbuttons.begin(), 286 LabelList::iterator erase_it = remove(m_labelbuttons.begin(),
287 m_labelbuttons.end(), 287 m_labelbuttons.end(),
288 &btn); 288 &btn);
@@ -293,7 +293,7 @@ void FbWinFrame::removeLabelButton(FbTk::Button &btn) {
293} 293}
294 294
295 295
296void FbWinFrame::moveLabelButtonLeft(const FbTk::Button &btn) { 296void FbWinFrame::moveLabelButtonLeft(const TextButton &btn) {
297 LabelList::iterator it = find(m_labelbuttons.begin(), 297 LabelList::iterator it = find(m_labelbuttons.begin(),
298 m_labelbuttons.end(), 298 m_labelbuttons.end(),
299 &btn); 299 &btn);
@@ -303,7 +303,7 @@ void FbWinFrame::moveLabelButtonLeft(const FbTk::Button &btn) {
303 303
304 LabelList::iterator new_pos = it; 304 LabelList::iterator new_pos = it;
305 new_pos--; 305 new_pos--;
306 FbTk::Button *item = *it; 306 TextButton *item = *it;
307 // remove from list 307 // remove from list
308 m_labelbuttons.erase(it); 308 m_labelbuttons.erase(it);
309 // insert on the new place 309 // insert on the new place
@@ -312,7 +312,7 @@ void FbWinFrame::moveLabelButtonLeft(const FbTk::Button &btn) {
312 redrawTitle(); 312 redrawTitle();
313} 313}
314 314
315void FbWinFrame::moveLabelButtonRight(const FbTk::Button &btn) { 315void FbWinFrame::moveLabelButtonRight(const TextButton &btn) {
316 LabelList::iterator it = find(m_labelbuttons.begin(), 316 LabelList::iterator it = find(m_labelbuttons.begin(),
317 m_labelbuttons.end(), 317 m_labelbuttons.end(),
318 &btn); 318 &btn);
@@ -320,7 +320,7 @@ void FbWinFrame::moveLabelButtonRight(const FbTk::Button &btn) {
320 if (it == m_labelbuttons.end() || *it == m_labelbuttons.back()) 320 if (it == m_labelbuttons.end() || *it == m_labelbuttons.back())
321 return; 321 return;
322 322
323 FbTk::Button *item = *it; 323 TextButton *item = *it;
324 // remove from list 324 // remove from list
325 LabelList::iterator new_pos = m_labelbuttons.erase(it); 325 LabelList::iterator new_pos = m_labelbuttons.erase(it);
326 new_pos++; 326 new_pos++;
@@ -330,15 +330,23 @@ void FbWinFrame::moveLabelButtonRight(const FbTk::Button &btn) {
330 redrawTitle(); 330 redrawTitle();
331} 331}
332 332
333void FbWinFrame::setLabelButtonFocus(FbTk::Button &btn) { 333void FbWinFrame::setLabelButtonFocus(TextButton &btn) {
334 LabelList::iterator it = find(m_labelbuttons.begin(), 334 LabelList::iterator it = find(m_labelbuttons.begin(),
335 m_labelbuttons.end(), 335 m_labelbuttons.end(),
336 &btn); 336 &btn);
337 if (it == m_labelbuttons.end()) 337 if (it == m_labelbuttons.end())
338 return; 338 return;
339 339
340
341 // render label buttons
342
343
344 if (m_current_label != 0)
345 renderButtonUnfocus(*m_current_label);
346
340 m_current_label = *it; // current focused button 347 m_current_label = *it; // current focused button
341 renderLabelButtons(); 348
349 renderButtonFocus(*m_current_label);
342} 350}
343 351
344void FbWinFrame::setClientWindow(FbTk::FbWindow &win) { 352void FbWinFrame::setClientWindow(FbTk::FbWindow &win) {
@@ -986,16 +994,11 @@ void FbWinFrame::renderLabelButtons() {
986 LabelList::iterator btn_it = m_labelbuttons.begin(); 994 LabelList::iterator btn_it = m_labelbuttons.begin();
987 LabelList::iterator btn_it_end = m_labelbuttons.end(); 995 LabelList::iterator btn_it_end = m_labelbuttons.end();
988 for (; btn_it != btn_it_end; ++btn_it) { 996 for (; btn_it != btn_it_end; ++btn_it) {
989 997 if (*btn_it == m_current_label)
990 (*btn_it)->setGC(theme().labelTextFocusGC()); 998 renderButtonFocus(**btn_it);
991 (*btn_it)->setBorderWidth(1);
992 (*btn_it)->setAlpha(theme().alpha());
993
994 if (m_label_unfocused_pm != 0)
995 (*btn_it)->setBackgroundPixmap(m_label_unfocused_pm);
996 else 999 else
997 (*btn_it)->setBackgroundColor(m_label_unfocused_color); 1000 renderButtonUnfocus(**btn_it);
998 1001
999 } 1002 }
1000 1003
1001 if (m_current_label != 0) { 1004 if (m_current_label != 0) {
@@ -1028,3 +1031,31 @@ void FbWinFrame::setBorderWidth(unsigned int borderW) {
1028 resize(width(), height() + bw_changes); 1031 resize(width(), height() + bw_changes);
1029} 1032}
1030 1033
1034void FbWinFrame::renderButtonFocus(TextButton &button) {
1035
1036 button.setGC(theme().labelTextFocusGC());
1037 button.setJustify(theme().justify());
1038 button.setBorderWidth(1);
1039 button.setAlpha(theme().alpha());
1040
1041 if (m_label_focused_pm != 0)
1042 button.setBackgroundPixmap(m_label_focused_pm);
1043 else
1044 button.setBackgroundColor(m_label_focused_color);
1045
1046 button.clear();
1047}
1048
1049void FbWinFrame::renderButtonUnfocus(TextButton &button) {
1050 button.setGC(theme().labelTextUnfocusGC());
1051 button.setJustify(theme().justify());
1052 button.setBorderWidth(1);
1053 button.setAlpha(theme().alpha());
1054
1055 if (m_label_unfocused_pm != 0)
1056 button.setBackgroundPixmap(m_label_unfocused_pm);
1057 else
1058 button.setBackgroundColor(m_label_unfocused_color);
1059
1060 button.clear();
1061}
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh
index 1b7b197..ce3fa2a 100644
--- a/src/FbWinFrame.hh
+++ b/src/FbWinFrame.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: FbWinFrame.hh,v 1.11 2003/07/28 12:11:57 fluxgen Exp $ 22// $Id: FbWinFrame.hh,v 1.12 2003/08/13 16:36:37 fluxgen Exp $
23 23
24#ifndef FBWINFRAME_HH 24#ifndef FBWINFRAME_HH
25#define FBWINFRAME_HH 25#define FBWINFRAME_HH
@@ -38,6 +38,8 @@
38 38
39class Shape; 39class Shape;
40class FbWinFrameTheme; 40class FbWinFrameTheme;
41class TextButton;
42
41namespace FbTk { 43namespace FbTk {
42class ImageControl; 44class ImageControl;
43class Command; 45class Command;
@@ -91,15 +93,15 @@ public:
91 /// remove all buttons from titlebar 93 /// remove all buttons from titlebar
92 void removeAllButtons(); 94 void removeAllButtons();
93 /// adds a button to label window 95 /// adds a button to label window
94 void addLabelButton(FbTk::Button &btn); 96 void addLabelButton(TextButton &btn);
95 /// removes a specific button from label window 97 /// removes a specific button from label window
96 void removeLabelButton(FbTk::Button &btn); 98 void removeLabelButton(TextButton &btn);
97 /// move label button to the left 99 /// move label button to the left
98 void moveLabelButtonLeft(const FbTk::Button &btn); 100 void moveLabelButtonLeft(const TextButton &btn);
99 /// move label button to the right 101 /// move label button to the right
100 void moveLabelButtonRight(const FbTk::Button &btn); 102 void moveLabelButtonRight(const TextButton &btn);
101 /// which button is to be rendered focused 103 /// which button is to be rendered focused
102 void setLabelButtonFocus(FbTk::Button &btn); 104 void setLabelButtonFocus(TextButton &btn);
103 /// attach a client window for client area 105 /// attach a client window for client area
104 void setClientWindow(Window win); 106 void setClientWindow(Window win);
105 /// same as above but with FbWindow 107 /// same as above but with FbWindow
@@ -180,6 +182,8 @@ private:
180 void renderTitlebar(); 182 void renderTitlebar();
181 void renderHandles(); 183 void renderHandles();
182 void renderButtons(); 184 void renderButtons();
185 void renderButtonFocus(TextButton &button);
186 void renderButtonUnfocus(TextButton &button);
183 void renderLabel(); 187 void renderLabel();
184 /// renders to pixmap or sets color 188 /// renders to pixmap or sets color
185 void render(const FbTk::Texture &tex, FbTk::Color &col, Pixmap &pm, 189 void render(const FbTk::Texture &tex, FbTk::Color &col, Pixmap &pm,
@@ -213,9 +217,9 @@ private:
213 typedef std::vector<FbTk::Button *> ButtonList; 217 typedef std::vector<FbTk::Button *> ButtonList;
214 ButtonList m_buttons_left, ///< buttons to the left 218 ButtonList m_buttons_left, ///< buttons to the left
215 m_buttons_right; ///< buttons to the right 219 m_buttons_right; ///< buttons to the right
216 typedef std::list<FbTk::Button *> LabelList; 220 typedef std::list<TextButton *> LabelList;
217 LabelList m_labelbuttons; ///< holds label buttons inside label window 221 LabelList m_labelbuttons; ///< holds label buttons inside label window
218 FbTk::Button *m_current_label; ///< which client button is focused at the moment 222 TextButton *m_current_label; ///< which client button is focused at the moment
219 std::string m_titletext; ///< text to be displayed int m_label 223 std::string m_titletext; ///< text to be displayed int m_label
220 int m_bevel; ///< bevel between titlebar items and titlebar 224 int m_bevel; ///< bevel between titlebar items and titlebar
221 bool m_use_titlebar; ///< if we should use titlebar 225 bool m_use_titlebar; ///< if we should use titlebar