diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2008-01-05 01:39:19 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2008-01-05 01:39:19 (GMT) |
commit | ac1bd7e0981222bf340ce7defb2bb8307d42a0a2 (patch) | |
tree | c8fb9c618184e7ac44f6138409cab3fab86b23e4 /src/FbTk/Menu.cc | |
parent | 60ba709c2f47cc2c7b877aef1b0f297b097853e5 (diff) | |
download | fluxbox-ac1bd7e0981222bf340ce7defb2bb8307d42a0a2.zip fluxbox-ac1bd7e0981222bf340ce7defb2bb8307d42a0a2.tar.bz2 |
update code to use ThemeProxy
Diffstat (limited to 'src/FbTk/Menu.cc')
-rw-r--r-- | src/FbTk/Menu.cc | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index 48dd4d9..51fca9d 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc | |||
@@ -81,17 +81,17 @@ Menu *Menu::shown = 0; | |||
81 | 81 | ||
82 | Menu *Menu::s_focused = 0; | 82 | Menu *Menu::s_focused = 0; |
83 | 83 | ||
84 | Menu::Menu(MenuTheme &tm, ImageControl &imgctrl): | 84 | Menu::Menu(FbTk::ThemeProxy<MenuTheme> &tm, ImageControl &imgctrl): |
85 | m_theme(tm), | 85 | m_theme(tm), |
86 | m_parent(0), | 86 | m_parent(0), |
87 | m_image_ctrl(imgctrl), | 87 | m_image_ctrl(imgctrl), |
88 | m_screen_x(0), | 88 | m_screen_x(0), |
89 | m_screen_y(0), | 89 | m_screen_y(0), |
90 | m_screen_width(DisplayWidth(FbTk::App::instance()->display(), tm.screenNum())), | 90 | m_screen_width(DisplayWidth(FbTk::App::instance()->display(), tm->screenNum())), |
91 | m_screen_height(DisplayHeight(FbTk::App::instance()->display(), tm.screenNum())), | 91 | m_screen_height(DisplayHeight(FbTk::App::instance()->display(), tm->screenNum())), |
92 | m_alignment(ALIGNDONTCARE), | 92 | m_alignment(ALIGNDONTCARE), |
93 | m_active_index(-1), | 93 | m_active_index(-1), |
94 | m_shape(new Shape(fbwindow(), tm.shapePlaces())), | 94 | m_shape(new Shape(fbwindow(), tm->shapePlaces())), |
95 | m_need_update(true) { | 95 | m_need_update(true) { |
96 | // setup timers | 96 | // setup timers |
97 | 97 | ||
@@ -128,7 +128,7 @@ Menu::Menu(MenuTheme &tm, ImageControl &imgctrl): | |||
128 | menu.hilite_pixmap = None; | 128 | menu.hilite_pixmap = None; |
129 | 129 | ||
130 | menu.item_w = menu.frame_h = | 130 | menu.item_w = menu.frame_h = |
131 | theme().titleFont().height() + theme().bevelWidth() * 2; | 131 | theme()->titleFont().height() + theme()->bevelWidth() * 2; |
132 | 132 | ||
133 | menu.sublevels = | 133 | menu.sublevels = |
134 | menu.persub = | 134 | menu.persub = |
@@ -137,7 +137,7 @@ Menu::Menu(MenuTheme &tm, ImageControl &imgctrl): | |||
137 | long event_mask = ButtonPressMask | ButtonReleaseMask | | 137 | long event_mask = ButtonPressMask | ButtonReleaseMask | |
138 | ButtonMotionMask | KeyPressMask | ExposureMask | FocusChangeMask; | 138 | ButtonMotionMask | KeyPressMask | ExposureMask | FocusChangeMask; |
139 | // create menu window | 139 | // create menu window |
140 | menu.window = FbTk::FbWindow(tm.screenNum(), | 140 | menu.window = FbTk::FbWindow(tm->screenNum(), |
141 | 0, 0, 10, 10, | 141 | 0, 0, 10, 10, |
142 | event_mask, | 142 | event_mask, |
143 | true, // override redirect | 143 | true, // override redirect |
@@ -153,7 +153,7 @@ Menu::Menu(MenuTheme &tm, ImageControl &imgctrl): | |||
153 | event_mask |= EnterWindowMask | LeaveWindowMask; | 153 | event_mask |= EnterWindowMask | LeaveWindowMask; |
154 | //create menu title | 154 | //create menu title |
155 | menu.title = FbTk::FbWindow(menu.window, // parent | 155 | menu.title = FbTk::FbWindow(menu.window, // parent |
156 | 0, 0, width(), theme().titleHeight(), // pos and size | 156 | 0, 0, width(), theme()->titleHeight(), // pos and size |
157 | event_mask, // mask | 157 | event_mask, // mask |
158 | false, // override redirect | 158 | false, // override redirect |
159 | true); // save under | 159 | true); // save under |
@@ -163,7 +163,7 @@ Menu::Menu(MenuTheme &tm, ImageControl &imgctrl): | |||
163 | 163 | ||
164 | event_mask |= PointerMotionMask; | 164 | event_mask |= PointerMotionMask; |
165 | menu.frame = FbTk::FbWindow(menu.window, // parent | 165 | menu.frame = FbTk::FbWindow(menu.window, // parent |
166 | 0, theme().titleHeight(), // pos | 166 | 0, theme()->titleHeight(), // pos |
167 | width(), menu.frame_h ? menu.frame_h : 1, // size | 167 | width(), menu.frame_h ? menu.frame_h : 1, // size |
168 | event_mask, // mask | 168 | event_mask, // mask |
169 | false, // override redirect | 169 | false, // override redirect |
@@ -366,9 +366,9 @@ void Menu::enableTitle() { | |||
366 | 366 | ||
367 | void Menu::updateMenu(int active_index) { | 367 | void Menu::updateMenu(int active_index) { |
368 | if (m_title_vis) { | 368 | if (m_title_vis) { |
369 | menu.item_w = theme().titleFont().textWidth(menu.label, | 369 | menu.item_w = theme()->titleFont().textWidth(menu.label, |
370 | menu.label.size()); | 370 | menu.label.size()); |
371 | menu.item_w += (theme().bevelWidth() * 2); | 371 | menu.item_w += (theme()->bevelWidth() * 2); |
372 | } else | 372 | } else |
373 | menu.item_w = 1; | 373 | menu.item_w = 1; |
374 | 374 | ||
@@ -386,8 +386,8 @@ void Menu::updateMenu(int active_index) { | |||
386 | if (!menuitems.empty()) { | 386 | if (!menuitems.empty()) { |
387 | menu.sublevels = 1; | 387 | menu.sublevels = 1; |
388 | 388 | ||
389 | while (theme().itemHeight() * (menuitems.size() + 1) / menu.sublevels + | 389 | while (theme()->itemHeight() * (menuitems.size() + 1) / menu.sublevels + |
390 | theme().titleHeight() + theme().borderWidth() > m_screen_height) { | 390 | theme()->titleHeight() + theme()->borderWidth() > m_screen_height) { |
391 | menu.sublevels++; | 391 | menu.sublevels++; |
392 | } | 392 | } |
393 | 393 | ||
@@ -401,14 +401,14 @@ void Menu::updateMenu(int active_index) { | |||
401 | menu.persub = 0; | 401 | menu.persub = 0; |
402 | } | 402 | } |
403 | 403 | ||
404 | int itmp = (theme().itemHeight() * menu.persub); | 404 | int itmp = (theme()->itemHeight() * menu.persub); |
405 | menu.frame_h = itmp < 1 ? 1 : itmp; | 405 | menu.frame_h = itmp < 1 ? 1 : itmp; |
406 | 406 | ||
407 | unsigned int new_width = (menu.sublevels * menu.item_w); | 407 | unsigned int new_width = (menu.sublevels * menu.item_w); |
408 | unsigned int new_height = menu.frame_h; | 408 | unsigned int new_height = menu.frame_h; |
409 | 409 | ||
410 | if (m_title_vis) | 410 | if (m_title_vis) |
411 | new_height += theme().titleHeight() + ((menu.frame_h > 0)?menu.title.borderWidth():0); | 411 | new_height += theme()->titleHeight() + ((menu.frame_h > 0)?menu.title.borderWidth():0); |
412 | 412 | ||
413 | 413 | ||
414 | if (new_width == 0) | 414 | if (new_width == 0) |
@@ -431,29 +431,29 @@ void Menu::updateMenu(int active_index) { | |||
431 | menu.frame.setAlpha(alpha()); | 431 | menu.frame.setAlpha(alpha()); |
432 | 432 | ||
433 | Pixmap tmp = menu.hilite_pixmap; | 433 | Pixmap tmp = menu.hilite_pixmap; |
434 | const FbTk::Texture &hilite_tex = theme().hiliteTexture(); | 434 | const FbTk::Texture &hilite_tex = theme()->hiliteTexture(); |
435 | if (!hilite_tex.usePixmap()) { | 435 | if (!hilite_tex.usePixmap()) { |
436 | menu.hilite_pixmap = None; | 436 | menu.hilite_pixmap = None; |
437 | } else | 437 | } else |
438 | menu.hilite_pixmap = | 438 | menu.hilite_pixmap = |
439 | m_image_ctrl.renderImage(menu.item_w, theme().itemHeight(), hilite_tex); | 439 | m_image_ctrl.renderImage(menu.item_w, theme()->itemHeight(), hilite_tex); |
440 | if (tmp) | 440 | if (tmp) |
441 | m_image_ctrl.removeImage(tmp); | 441 | m_image_ctrl.removeImage(tmp); |
442 | 442 | ||
443 | 443 | ||
444 | if (!theme().selectedPixmap().pixmap().drawable()) { | 444 | if (!theme()->selectedPixmap().pixmap().drawable()) { |
445 | int hw = theme().itemHeight() / 2; | 445 | int hw = theme()->itemHeight() / 2; |
446 | m_theme.setSelectedPixmap(m_image_ctrl.renderImage(hw, hw, theme().hiliteTexture()), true); | 446 | theme()->setSelectedPixmap(m_image_ctrl.renderImage(hw, hw, theme()->hiliteTexture()), true); |
447 | 447 | ||
448 | if (!theme().highlightSelectedPixmap().pixmap().drawable()) { | 448 | if (!theme()->highlightSelectedPixmap().pixmap().drawable()) { |
449 | int hw = theme().itemHeight() / 2; | 449 | int hw = theme()->itemHeight() / 2; |
450 | m_theme.setHighlightSelectedPixmap(m_image_ctrl.renderImage(hw, hw, theme().frameTexture()), true); | 450 | theme()->setHighlightSelectedPixmap(m_image_ctrl.renderImage(hw, hw, theme()->frameTexture()), true); |
451 | } | 451 | } |
452 | } | 452 | } |
453 | 453 | ||
454 | if (m_title_vis) { | 454 | if (m_title_vis) { |
455 | menu.title.moveResize(-menu.title.borderWidth(), -menu.title.borderWidth(), | 455 | menu.title.moveResize(-menu.title.borderWidth(), -menu.title.borderWidth(), |
456 | width() + menu.title.borderWidth(), theme().titleHeight()); | 456 | width() + menu.title.borderWidth(), theme()->titleHeight()); |
457 | } | 457 | } |
458 | 458 | ||
459 | menu.frame.moveResize(0, ((m_title_vis) ? menu.title.y() + menu.title.height() + | 459 | menu.frame.moveResize(0, ((m_title_vis) ? menu.title.y() + menu.title.height() + |
@@ -462,13 +462,13 @@ void Menu::updateMenu(int active_index) { | |||
462 | 462 | ||
463 | if (m_title_vis && m_need_update) { | 463 | if (m_title_vis && m_need_update) { |
464 | tmp = menu.title_pixmap; | 464 | tmp = menu.title_pixmap; |
465 | const FbTk::Texture &tex = theme().titleTexture(); | 465 | const FbTk::Texture &tex = theme()->titleTexture(); |
466 | if (!tex.usePixmap()) { | 466 | if (!tex.usePixmap()) { |
467 | menu.title_pixmap = None; | 467 | menu.title_pixmap = None; |
468 | menu.title.setBackgroundColor(tex.color()); | 468 | menu.title.setBackgroundColor(tex.color()); |
469 | } else { | 469 | } else { |
470 | menu.title_pixmap = | 470 | menu.title_pixmap = |
471 | m_image_ctrl.renderImage(width(), theme().titleHeight(), tex); | 471 | m_image_ctrl.renderImage(width(), theme()->titleHeight(), tex); |
472 | // set pixmap that we have as real face to the user | 472 | // set pixmap that we have as real face to the user |
473 | menu.title.setBackgroundPixmap(menu.title_pixmap); | 473 | menu.title.setBackgroundPixmap(menu.title_pixmap); |
474 | } | 474 | } |
@@ -478,7 +478,7 @@ void Menu::updateMenu(int active_index) { | |||
478 | } | 478 | } |
479 | 479 | ||
480 | tmp = menu.frame_pixmap; | 480 | tmp = menu.frame_pixmap; |
481 | const FbTk::Texture &frame_tex = theme().frameTexture(); | 481 | const FbTk::Texture &frame_tex = theme()->frameTexture(); |
482 | if (m_need_update) { | 482 | if (m_need_update) { |
483 | if (!frame_tex.usePixmap()) { | 483 | if (!frame_tex.usePixmap()) { |
484 | menu.frame_pixmap = None; | 484 | menu.frame_pixmap = None; |
@@ -630,12 +630,12 @@ void Menu::move(int x, int y) { | |||
630 | 630 | ||
631 | void Menu::redrawTitle(FbDrawable &drawable) { | 631 | void Menu::redrawTitle(FbDrawable &drawable) { |
632 | 632 | ||
633 | const FbTk::Font &font = theme().titleFont(); | 633 | const FbTk::Font &font = theme()->titleFont(); |
634 | int dx = theme().bevelWidth(); | 634 | int dx = theme()->bevelWidth(); |
635 | size_t len = menu.label.size(); | 635 | size_t len = menu.label.size(); |
636 | unsigned int l = font.textWidth(menu.label, len) + theme().bevelWidth()*2; | 636 | unsigned int l = font.textWidth(menu.label, len) + theme()->bevelWidth()*2; |
637 | 637 | ||
638 | switch (theme().titleFontJustify()) { | 638 | switch (theme()->titleFontJustify()) { |
639 | case FbTk::RIGHT: | 639 | case FbTk::RIGHT: |
640 | dx += width() - l; | 640 | dx += width() - l; |
641 | break; | 641 | break; |
@@ -648,12 +648,12 @@ void Menu::redrawTitle(FbDrawable &drawable) { | |||
648 | } | 648 | } |
649 | 649 | ||
650 | // difference between height based on font, and style-set height | 650 | // difference between height based on font, and style-set height |
651 | int height_offset = theme().titleHeight() - (font.height() + 2*theme().bevelWidth()); | 651 | int height_offset = theme()->titleHeight() - (font.height() + 2*theme()->bevelWidth()); |
652 | font.drawText(drawable, // drawable | 652 | font.drawText(drawable, // drawable |
653 | screenNumber(), | 653 | screenNumber(), |
654 | theme().titleTextGC().gc(), // graphic context | 654 | theme()->titleTextGC().gc(), // graphic context |
655 | menu.label, len, // text string with length | 655 | menu.label, len, // text string with length |
656 | dx, font.ascent() + theme().bevelWidth() + height_offset/2); // position | 656 | dx, font.ascent() + theme()->bevelWidth() + height_offset/2); // position |
657 | } | 657 | } |
658 | 658 | ||
659 | 659 | ||
@@ -683,14 +683,14 @@ void Menu::drawSubmenu(unsigned int index) { | |||
683 | int new_y; | 683 | int new_y; |
684 | 684 | ||
685 | if (m_alignment == ALIGNTOP) { | 685 | if (m_alignment == ALIGNTOP) { |
686 | new_y = (y() + ((m_title_vis) ? theme().titleHeight() + menu.title.borderWidth() : 0) - | 686 | new_y = (y() + ((m_title_vis) ? theme()->titleHeight() + menu.title.borderWidth() : 0) - |
687 | ((item->submenu()->m_title_vis) ? | 687 | ((item->submenu()->m_title_vis) ? |
688 | item->submenu()->theme().titleHeight() + menu.window.borderWidth() : 0)); | 688 | item->submenu()->theme()->titleHeight() + menu.window.borderWidth() : 0)); |
689 | } else { | 689 | } else { |
690 | new_y = (y() + (theme().itemHeight() * i) + | 690 | new_y = (y() + (theme()->itemHeight() * i) + |
691 | ((m_title_vis) ? theme().titleHeight() + menu.window.borderWidth() : 0) - | 691 | ((m_title_vis) ? theme()->titleHeight() + menu.window.borderWidth() : 0) - |
692 | ((item->submenu()->m_title_vis) ? | 692 | ((item->submenu()->m_title_vis) ? |
693 | item->submenu()->theme().titleHeight() + menu.window.borderWidth() : 0)); | 693 | item->submenu()->theme()->titleHeight() + menu.window.borderWidth() : 0)); |
694 | } | 694 | } |
695 | 695 | ||
696 | if (m_alignment == ALIGNBOTTOM && | 696 | if (m_alignment == ALIGNBOTTOM && |
@@ -745,7 +745,7 @@ int Menu::drawItem(FbDrawable &drawable, unsigned int index, | |||
745 | if (! item) return 0; | 745 | if (! item) return 0; |
746 | 746 | ||
747 | int sbl = index / menu.persub, i = index - (sbl * menu.persub); | 747 | int sbl = index / menu.persub, i = index - (sbl * menu.persub); |
748 | int item_x = (sbl * menu.item_w), item_y = (i * theme().itemHeight()); | 748 | int item_x = (sbl * menu.item_w), item_y = (i * theme()->itemHeight()); |
749 | 749 | ||
750 | if (exclusive_drawable) | 750 | if (exclusive_drawable) |
751 | item_x = item_y = 0; | 751 | item_x = item_y = 0; |
@@ -753,7 +753,7 @@ int Menu::drawItem(FbDrawable &drawable, unsigned int index, | |||
753 | item->draw(drawable, theme(), highlight, | 753 | item->draw(drawable, theme(), highlight, |
754 | exclusive_drawable, true, // draw fg, draw bg | 754 | exclusive_drawable, true, // draw fg, draw bg |
755 | item_x, item_y, | 755 | item_x, item_y, |
756 | menu.item_w, theme().itemHeight()); | 756 | menu.item_w, theme()->itemHeight()); |
757 | 757 | ||
758 | return item_y; | 758 | return item_y; |
759 | } | 759 | } |
@@ -845,7 +845,7 @@ void Menu::buttonPressEvent(XButtonEvent &be) { | |||
845 | 845 | ||
846 | if (be.window == menu.frame && menu.item_w != 0) { | 846 | if (be.window == menu.frame && menu.item_w != 0) { |
847 | 847 | ||
848 | int sbl = (be.x / menu.item_w), i = (be.y / theme().itemHeight()); | 848 | int sbl = (be.x / menu.item_w), i = (be.y / theme()->itemHeight()); |
849 | int w = (sbl * menu.persub) + i; | 849 | int w = (sbl * menu.persub) + i; |
850 | 850 | ||
851 | if (validIndex(w) && isItemSelectable(static_cast<unsigned int>(w))) { | 851 | if (validIndex(w) && isItemSelectable(static_cast<unsigned int>(w))) { |
@@ -885,14 +885,14 @@ void Menu::buttonReleaseEvent(XButtonEvent &re) { | |||
885 | 885 | ||
886 | } else if (re.window == menu.frame) { | 886 | } else if (re.window == menu.frame) { |
887 | 887 | ||
888 | int sbl = (re.x / menu.item_w), i = (re.y / theme().itemHeight()), | 888 | int sbl = (re.x / menu.item_w), i = (re.y / theme()->itemHeight()), |
889 | ix = sbl * menu.item_w, iy = i * theme().itemHeight(), | 889 | ix = sbl * menu.item_w, iy = i * theme()->itemHeight(), |
890 | w = (sbl * menu.persub) + i; | 890 | w = (sbl * menu.persub) + i; |
891 | 891 | ||
892 | if (validIndex(w) && isItemSelectable(static_cast<unsigned int>(w))) { | 892 | if (validIndex(w) && isItemSelectable(static_cast<unsigned int>(w))) { |
893 | if (m_active_index == w && isItemEnabled(w) && | 893 | if (m_active_index == w && isItemEnabled(w) && |
894 | re.x > ix && re.x < (signed) (ix + menu.item_w) && | 894 | re.x > ix && re.x < (signed) (ix + menu.item_w) && |
895 | re.y > iy && re.y < (signed) (iy + theme().itemHeight())) { | 895 | re.y > iy && re.y < (signed) (iy + theme()->itemHeight())) { |
896 | menuitems[w]->click(re.button, re.time, re.state); | 896 | menuitems[w]->click(re.button, re.time, re.state); |
897 | } else { | 897 | } else { |
898 | int old = m_active_index; | 898 | int old = m_active_index; |
@@ -930,7 +930,7 @@ void Menu::motionNotifyEvent(XMotionEvent &me) { | |||
930 | } else if (!(me.state & Button1Mask) && me.window == menu.frame) { | 930 | } else if (!(me.state & Button1Mask) && me.window == menu.frame) { |
931 | stopHide(); | 931 | stopHide(); |
932 | int sbl = (me.x / menu.item_w), | 932 | int sbl = (me.x / menu.item_w), |
933 | i = (me.y / theme().itemHeight()), | 933 | i = (me.y / theme()->itemHeight()), |
934 | w = (sbl * menu.persub) + i; | 934 | w = (sbl * menu.persub) + i; |
935 | 935 | ||
936 | if (w == m_active_index || !validIndex(w)) | 936 | if (w == m_active_index || !validIndex(w)) |
@@ -960,11 +960,11 @@ void Menu::motionNotifyEvent(XMotionEvent &me) { | |||
960 | 960 | ||
961 | } | 961 | } |
962 | 962 | ||
963 | if (itmp->submenu() && theme().menuMode() == MenuTheme::DELAY_OPEN) { | 963 | if (itmp->submenu() && theme()->menuMode() == MenuTheme::DELAY_OPEN) { |
964 | // start submenu open delay | 964 | // start submenu open delay |
965 | timeval timeout; | 965 | timeval timeout; |
966 | timeout.tv_sec = 0; | 966 | timeout.tv_sec = 0; |
967 | timeout.tv_usec = theme().delayOpen() * 1000; // transformed to usec | 967 | timeout.tv_usec = theme()->delayOpen() * 1000; // transformed to usec |
968 | m_submenu_timer.setTimeout(timeout); | 968 | m_submenu_timer.setTimeout(timeout); |
969 | m_submenu_timer.start(); | 969 | m_submenu_timer.start(); |
970 | } else if (isItemSelectable(w)){ | 970 | } else if (isItemSelectable(w)){ |
@@ -986,11 +986,11 @@ void Menu::exposeEvent(XExposeEvent &ee) { | |||
986 | // first... we see in which sub level the expose starts... and how many | 986 | // first... we see in which sub level the expose starts... and how many |
987 | // items down in that sublevel | 987 | // items down in that sublevel |
988 | 988 | ||
989 | int sbl = (ee.x / menu.item_w), id = (ee.y / theme().itemHeight()), | 989 | int sbl = (ee.x / menu.item_w), id = (ee.y / theme()->itemHeight()), |
990 | // next... figure out how many sublevels over the redrawspans | 990 | // next... figure out how many sublevels over the redrawspans |
991 | sbl_d = ((ee.x + ee.width) / menu.item_w), | 991 | sbl_d = ((ee.x + ee.width) / menu.item_w), |
992 | // then we see how many items down to redraw | 992 | // then we see how many items down to redraw |
993 | id_d = ((ee.y + ee.height) / theme().itemHeight()); | 993 | id_d = ((ee.y + ee.height) / theme()->itemHeight()); |
994 | 994 | ||
995 | if (id_d > menu.persub) id_d = menu.persub; | 995 | if (id_d > menu.persub) id_d = menu.persub; |
996 | // draw the sublevels and the number of items the exposure spans | 996 | // draw the sublevels and the number of items the exposure spans |
@@ -1093,7 +1093,7 @@ void Menu::keyPressEvent(XKeyEvent &event) { | |||
1093 | 1093 | ||
1094 | 1094 | ||
1095 | void Menu::reconfigure() { | 1095 | void Menu::reconfigure() { |
1096 | m_shape->setPlaces(theme().shapePlaces()); | 1096 | m_shape->setPlaces(theme()->shapePlaces()); |
1097 | 1097 | ||
1098 | if (FbTk::Transparent::haveComposite()) { | 1098 | if (FbTk::Transparent::haveComposite()) { |
1099 | menu.window.setOpaque(alpha()); | 1099 | menu.window.setOpaque(alpha()); |
@@ -1107,12 +1107,12 @@ void Menu::reconfigure() { | |||
1107 | 1107 | ||
1108 | m_need_update = true; // redraw items | 1108 | m_need_update = true; // redraw items |
1109 | 1109 | ||
1110 | menu.window.setBorderColor(theme().borderColor()); | 1110 | menu.window.setBorderColor(theme()->borderColor()); |
1111 | menu.title.setBorderColor(theme().borderColor()); | 1111 | menu.title.setBorderColor(theme()->borderColor()); |
1112 | menu.frame.setBorderColor(theme().borderColor()); | 1112 | menu.frame.setBorderColor(theme()->borderColor()); |
1113 | 1113 | ||
1114 | menu.window.setBorderWidth(theme().borderWidth()); | 1114 | menu.window.setBorderWidth(theme()->borderWidth()); |
1115 | menu.title.setBorderWidth(theme().borderWidth()); | 1115 | menu.title.setBorderWidth(theme()->borderWidth()); |
1116 | 1116 | ||
1117 | updateMenu(); | 1117 | updateMenu(); |
1118 | } | 1118 | } |
@@ -1145,7 +1145,7 @@ void Menu::closeMenu() { | |||
1145 | void Menu::startHide() { | 1145 | void Menu::startHide() { |
1146 | timeval timeout; | 1146 | timeval timeout; |
1147 | timeout.tv_sec = 0; | 1147 | timeout.tv_sec = 0; |
1148 | timeout.tv_usec = theme().delayClose() * 1000; // transformed to usec | 1148 | timeout.tv_usec = theme()->delayClose() * 1000; // transformed to usec |
1149 | m_hide_timer.setTimeout(timeout); | 1149 | m_hide_timer.setTimeout(timeout); |
1150 | m_hide_timer.start(); | 1150 | m_hide_timer.start(); |
1151 | } | 1151 | } |
@@ -1192,7 +1192,7 @@ void Menu::clearItem(int index, bool clear, int search_index) { | |||
1192 | return; | 1192 | return; |
1193 | 1193 | ||
1194 | int sbl = index / menu.persub, i = index - (sbl * menu.persub); | 1194 | int sbl = index / menu.persub, i = index - (sbl * menu.persub); |
1195 | unsigned int item_w = menu.item_w, item_h = theme().itemHeight(); | 1195 | unsigned int item_w = menu.item_w, item_h = theme()->itemHeight(); |
1196 | int item_x = (sbl * item_w), item_y = (i * item_h); | 1196 | int item_x = (sbl * item_w), item_y = (i * item_h); |
1197 | bool highlight = (index == m_active_index && isItemSelectable(index)); | 1197 | bool highlight = (index == m_active_index && isItemSelectable(index)); |
1198 | 1198 | ||
@@ -1224,7 +1224,7 @@ void Menu::clearItem(int index, bool clear, int search_index) { | |||
1224 | // Area must have been cleared before calling highlight | 1224 | // Area must have been cleared before calling highlight |
1225 | void Menu::highlightItem(int index) { | 1225 | void Menu::highlightItem(int index) { |
1226 | int sbl = index / menu.persub, i = index - (sbl * menu.persub); | 1226 | int sbl = index / menu.persub, i = index - (sbl * menu.persub); |
1227 | unsigned int item_w = menu.item_w, item_h = theme().itemHeight(); | 1227 | unsigned int item_w = menu.item_w, item_h = theme()->itemHeight(); |
1228 | int item_x = (sbl * menu.item_w), item_y = (i * item_h); | 1228 | int item_x = (sbl * menu.item_w), item_y = (i * item_h); |
1229 | 1229 | ||
1230 | FbPixmap buffer = FbPixmap(menu.frame, item_w, item_h, menu.frame.depth()); | 1230 | FbPixmap buffer = FbPixmap(menu.frame, item_w, item_h, menu.frame.depth()); |
@@ -1234,18 +1234,18 @@ void Menu::highlightItem(int index) { | |||
1234 | int pixmap_x = parent_rel ? item_x : 0, pixmap_y = parent_rel ? item_y : 0; | 1234 | int pixmap_x = parent_rel ? item_x : 0, pixmap_y = parent_rel ? item_y : 0; |
1235 | if (pixmap) { | 1235 | if (pixmap) { |
1236 | buffer.copyArea(pixmap, | 1236 | buffer.copyArea(pixmap, |
1237 | theme().hiliteGC().gc(), pixmap_x, pixmap_y, | 1237 | theme()->hiliteGC().gc(), pixmap_x, pixmap_y, |
1238 | 0, 0, | 1238 | 0, 0, |
1239 | item_w, item_h); | 1239 | item_w, item_h); |
1240 | } else { | 1240 | } else { |
1241 | buffer.fillRectangle(theme().hiliteGC().gc(), | 1241 | buffer.fillRectangle(theme()->hiliteGC().gc(), |
1242 | 0, 0, item_w, item_h); | 1242 | 0, 0, item_w, item_h); |
1243 | } | 1243 | } |
1244 | menu.frame.updateTransparent(item_x, item_y, item_w, item_h, buffer.drawable(), true); | 1244 | menu.frame.updateTransparent(item_x, item_y, item_w, item_h, buffer.drawable(), true); |
1245 | 1245 | ||
1246 | drawItem(buffer, index, true, true); | 1246 | drawItem(buffer, index, true, true); |
1247 | 1247 | ||
1248 | menu.frame.copyArea(buffer.drawable(), theme().hiliteGC().gc(), | 1248 | menu.frame.copyArea(buffer.drawable(), theme()->hiliteGC().gc(), |
1249 | 0, 0, | 1249 | 0, 0, |
1250 | item_x, item_y, | 1250 | item_x, item_y, |
1251 | item_w, item_h); | 1251 | item_w, item_h); |
@@ -1278,7 +1278,7 @@ void Menu::drawLine(int index, int size){ | |||
1278 | return; | 1278 | return; |
1279 | 1279 | ||
1280 | int sbl = index / menu.persub, i = index - (sbl * menu.persub); | 1280 | int sbl = index / menu.persub, i = index - (sbl * menu.persub); |
1281 | int item_x = (sbl * menu.item_w), item_y = (i * theme().itemHeight()); | 1281 | int item_x = (sbl * menu.item_w), item_y = (i * theme()->itemHeight()); |
1282 | 1282 | ||
1283 | FbTk::MenuItem *item = find(index); | 1283 | FbTk::MenuItem *item = find(index); |
1284 | item->drawLine(menu.frame, theme(), size, item_x, item_y, menu.item_w); | 1284 | item->drawLine(menu.frame, theme(), size, item_x, item_y, menu.item_w); |