00001 #ifndef __CPopupButton__ 00002 #define __CPopupButton__ 00003 00004 #include "CLatchingButton.hpp" 00005 #include "CMenu.hpp" 00006 #include "../Windowing/CMenuWindow.hpp" 00007 #include "../Listeners/IMenuListener.hpp" 00008 00009 // =========================================================================== 00010 00011 using Exponent::GUI::Windowing::CMenuWindow; 00012 using Exponent::GUI::Controls::CLatchingButton; 00013 using Exponent::GUI::Controls::CMenu; 00014 using Exponent::GUI::Listeners::IMenuListener; 00015 00016 // =========================================================================== 00017 00018 namespace Exponent 00019 { 00020 namespace GUI 00021 { 00022 namespace Controls 00023 { 00041 class CPopupButton : public CLatchingButton, public IMenuListener 00042 { 00044 EXPONENT_CLASS_DECLARATION; 00047 // =========================================================================== 00048 00049 public: 00050 00051 // =========================================================================== 00052 00061 CPopupButton(IControlRoot *root, const long uniqueId, const CRect &area, CMenu *menu, IActionListener *listener); 00062 00066 virtual ~CPopupButton(); 00067 00068 // =========================================================================== 00069 00074 virtual void handleLeftButtonUp(CMouseEvent &event); 00075 00080 virtual void handleMenuSelection(const CMenuEvent &event); 00081 00086 virtual void handleMenuOpening(const CMenuEvent &event) {} 00087 00092 virtual void handleMenuClosing(const CMenuEvent &event); 00093 00094 // =========================================================================== 00095 00100 virtual void setMenu(CMenu *menu); 00101 00106 virtual CMenu *getMutableMenu() { return m_menu; } 00107 00112 virtual const CMenu *getMenu() const { return m_menu; } 00113 00118 virtual CMenuEvent *getLastMenuEvent() const { return myMenuEvent; } 00119 00120 // =========================================================================== 00121 00127 virtual void setMenuWindowAttributes(CWindowAttributes *windowAttributes, const bool useIcons = true); 00128 00133 virtual CMenuWindow *getMenuWindow() const { return m_menuWindow; } 00134 00135 // =========================================================================== 00136 00137 protected: 00138 00139 // =========================================================================== 00140 00141 CMenu *m_menu; 00142 CMenuWindow *m_menuWindow; 00143 CWindowAttributes *m_windowAttributes; 00144 CMenuEvent *myMenuEvent; 00145 bool m_useIcons; 00146 }; 00147 } 00148 } 00149 } 00150 #endif // End of CPopupButton.hpp