From 0f6b73f36abb1fd31893ef16413f010e78ed84ab Mon Sep 17 00:00:00 2001 From: Mark Tiefenbruck Date: Fri, 28 Dec 2007 01:14:19 -0800 Subject: move shape handling from FbMenu to FbTk::Menu --- src/FbMenu.cc | 25 +------------------------ src/FbMenu.hh | 7 +------ src/FbTk/Menu.cc | 4 ++++ src/FbTk/Menu.hh | 7 ++++--- 4 files changed, 10 insertions(+), 33 deletions(-) diff --git a/src/FbMenu.cc b/src/FbMenu.cc index 65fbecd..941ca0e 100644 --- a/src/FbMenu.cc +++ b/src/FbMenu.cc @@ -25,36 +25,13 @@ #include "FbMenu.hh" #include "fluxbox.hh" -#include "FbTk/MenuTheme.hh" #include "Screen.hh" -#include "FbTk/Shape.hh" - FbMenu::FbMenu(FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl, FbTk::XLayer &layer): FbTk::Menu(tm, imgctrl), - m_layeritem(fbwindow(), layer), - m_shape(new FbTk::Shape(fbwindow(), tm.shapePlaces())) { - -} - -FbMenu::~FbMenu() { - -} - -void FbMenu::updateMenu(int index) { - FbTk::Menu::updateMenu(index); - m_shape->update(); -} - -void FbMenu::clearWindow() { - FbTk::Menu::clearWindow(); - m_shape->update(); -} + m_layeritem(fbwindow(), layer) { -void FbMenu::reconfigure() { - m_shape->setPlaces(theme().shapePlaces()); - FbTk::Menu::reconfigure(); } void FbMenu::buttonReleaseEvent(XButtonEvent &be) { diff --git a/src/FbMenu.hh b/src/FbMenu.hh index ef8670d..9469311 100644 --- a/src/FbMenu.hh +++ b/src/FbMenu.hh @@ -30,7 +30,6 @@ namespace FbTk { class MenuTheme; -class Shape; } /// a layered and shaped menu @@ -38,16 +37,12 @@ class FbMenu:public FbTk::Menu { public: FbMenu(FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl, FbTk::XLayer &layer); - virtual ~FbMenu(); - void updateMenu(int index = -1); - void clearWindow(); + virtual ~FbMenu() { } void raise() { m_layeritem.raise(); } void lower() { m_layeritem.lower(); } - void reconfigure(); void buttonReleaseEvent(XButtonEvent &be); private: FbTk::XLayerItem m_layeritem; - std::auto_ptr m_shape; }; #endif // FBMENU_HH diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index 485b56c..00dcc54 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc @@ -92,6 +92,7 @@ Menu::Menu(MenuTheme &tm, ImageControl &imgctrl): m_screen_height(DisplayHeight(FbTk::App::instance()->display(), tm.screenNum())), m_alignment(ALIGNDONTCARE), m_active_index(-1), + m_shape(new Shape(fbwindow(), tm.shapePlaces())), m_need_update(true) { // setup timers @@ -496,6 +497,7 @@ void Menu::updateMenu(int active_index) { clearWindow(); m_need_update = false; + m_shape->update(); } @@ -563,6 +565,7 @@ void Menu::clearWindow() { for (size_t i = 0; i < menuitems.size(); i++) { clearItem(i, false); // no clear } + m_shape->update(); } void Menu::redrawFrame(FbDrawable &drawable) { @@ -1091,6 +1094,7 @@ void Menu::keyPressEvent(XKeyEvent &event) { void Menu::reconfigure() { + m_shape->setPlaces(theme().shapePlaces()); if (FbTk::Transparent::haveComposite()) { menu.window.setOpaque(alpha()); diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh index f16c443..54c6d62 100644 --- a/src/FbTk/Menu.hh +++ b/src/FbTk/Menu.hh @@ -203,13 +203,12 @@ private: void startHide(); void stopHide(); - - typedef std::vector Menuitems; MenuTheme &m_theme; Menu *m_parent; ImageControl &m_image_ctrl; - Menuitems menuitems; + typedef std::vector Menuitems; + Menuitems menuitems; TypeAhead m_type_ahead; Menuitems m_matches; @@ -242,6 +241,8 @@ private: int m_active_index; ///< current highlighted index + std::auto_ptr m_shape; + Drawable m_root_pm; static Menu *shown; ///< used for determining if there's a menu open at all static Menu *s_focused; ///< holds current input focused menu, so one can determine if a menu is focused -- cgit v0.11.2