added showSubmenu in MenuItem
fluxgen fluxgen
3 files changed,
11 insertions(+),
3 deletions(-)
M
src/FbTk/Menu.cc
→
src/FbTk/Menu.cc
@@ -734,7 +734,7 @@ if (! m_moving)
clearItem(index); if (! item->submenu()->isVisible()) { - item->submenu()->show(); + item->showSubmenu(); item->submenu()->raise(); }
M
src/FbTk/MenuItem.cc
→
src/FbTk/MenuItem.cc
@@ -29,6 +29,7 @@ #include "PixmapWithMask.hh"
#include "Image.hh" #include "App.hh" #include "StringUtil.hh" +#include "Menu.hh" namespace FbTk {@@ -295,6 +296,11 @@
m_icon->pixmap.reset(Image::load(m_icon->filename.c_str(), theme.screenNum())); +} + +void MenuItem::showSubmenu() { + if (submenu() != 0) + submenu()->show(); } }; // end namespace FbTk
M
src/FbTk/MenuItem.hh
→
src/FbTk/MenuItem.hh
@@ -94,13 +94,13 @@ virtual inline void setEnabled(bool enabled) { m_enabled = enabled; }
virtual inline void setLabel(const char *label) { m_label = (label ? label : ""); } virtual inline void setToggleItem(bool val) { m_toggle_item = val; } void setIcon(const std::string &filename, int screen_num); - Menu *submenu() { return m_submenu; } + virtual Menu *submenu() { return m_submenu; } /** @name accessors */ //@{ virtual inline const std::string &label() const { return m_label; } - inline const Menu *submenu() const { return m_submenu; } + virtual const Menu *submenu() const { return m_submenu; } virtual inline bool isEnabled() const { return m_enabled; } virtual inline bool isSelected() const { return m_selected; } virtual inline bool isToggleItem() const { return m_toggle_item; }@@ -120,6 +120,8 @@ @param button the button number
@param time the time stamp */ virtual void click(int button, int time); + /// must use this to show submenu to ensure consistency for object like window menu in ClientMenu (see Workspace.cc) + virtual void showSubmenu(); RefCount<Command> &command() { return m_command; } const RefCount<Command> &command() const { return m_command; } //@}