From 0df6609bb94ae51e3fd6f18b1c05667653dfb37f Mon Sep 17 00:00:00 2001 From: fluxgen Date: Thu, 23 Jun 2005 03:09:39 +0000 Subject: added showSubmenu in MenuItem --- src/FbTk/Menu.cc | 2 +- src/FbTk/MenuItem.cc | 6 ++++++ src/FbTk/MenuItem.hh | 6 ++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index e05f531..25c000e 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc @@ -734,7 +734,7 @@ void Menu::drawSubmenu(unsigned int index) { clearItem(index); if (! item->submenu()->isVisible()) { - item->submenu()->show(); + item->showSubmenu(); item->submenu()->raise(); } diff --git a/src/FbTk/MenuItem.cc b/src/FbTk/MenuItem.cc index 1ed3ebd..ee40f63 100644 --- a/src/FbTk/MenuItem.cc +++ b/src/FbTk/MenuItem.cc @@ -29,6 +29,7 @@ #include "Image.hh" #include "App.hh" #include "StringUtil.hh" +#include "Menu.hh" namespace FbTk { @@ -297,4 +298,9 @@ void MenuItem::updateTheme(const MenuTheme &theme) { } +void MenuItem::showSubmenu() { + if (submenu() != 0) + submenu()->show(); +} + }; // end namespace FbTk diff --git a/src/FbTk/MenuItem.hh b/src/FbTk/MenuItem.hh index b3b2f6b..0bf66be 100644 --- a/src/FbTk/MenuItem.hh +++ b/src/FbTk/MenuItem.hh @@ -94,13 +94,13 @@ public: 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 @@ public: @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() { return m_command; } const RefCount &command() const { return m_command; } //@} -- cgit v0.11.2