aboutsummaryrefslogtreecommitdiff
path: root/src/FbWinFrame.cc
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 /src/FbWinFrame.cc
parent9ffcd43e703f0e1d669087999eac6c834da8da8a (diff)
downloadfluxbox_pavel-884928264a5cc52c6f255478cdfa4b7d8354f0c6.zip
fluxbox_pavel-884928264a5cc52c6f255478cdfa4b7d8354f0c6.tar.bz2
fixed rendering problem on focused textbutton
Diffstat (limited to 'src/FbWinFrame.cc')
-rw-r--r--src/FbWinFrame.cc67
1 files changed, 49 insertions, 18 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}