00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _umenu_hpp_
00020 #define _umenu_hpp_
00021
00022 #include <ubit/uboxes.hpp>
00023 #include <ubit/uwin.hpp>
00024 namespace ubit {
00025
00026 class UMenuManager;
00027
00028
00031 class UMenubar: public UBar {
00032 public:
00033 UBIT_ELEMENT_CLASS(UMenubar, UBar)
00034
00035 UMenubar(const UArgs& a = UArgs::none);
00036 friend UMenubar& umenubar(const UArgs& a = UArgs::none) {return *new UMenubar(a);}
00038
00039
00040
00041 static UStyle* createStyle();
00042 virtual UGroup* getBrowsingGroup() {return this;}
00043
00044 protected:
00045 void enterChild(UEvent&);
00046 void leaveChild(UEvent&);
00047 void relaxChild(UEvent&);
00048 void armChild(UEvent&);
00049 };
00050
00051
00074 class UMenu : public UWin {
00075 public:
00076 UBIT_ELEMENT_CLASS(UMenu, UWin)
00077
00078 UMenu(const UArgs& a = UArgs::none);
00080
00081 friend UMenu& umenu(const UArgs& args = UArgs::none) {return *new UMenu(args);}
00083
00084 virtual ~UMenu();
00085 virtual class UMenu* menuCast() {return this;}
00086
00087
00088
00089 virtual void show(bool state, UDisp*);
00090 virtual void show(bool state = true) {UMenu::show(state, null);}
00102 virtual void show(UMouseEvent&, float x = 0, float y = 0);
00104
00105 virtual void open(UMouseEvent& e) {show(e);}
00107
00108 virtual void setPlacement(const UPlacement&);
00113
00114
00115 static UStyle* createStyle();
00116 virtual bool realize();
00117
00118 #ifndef NO_DOC
00119 virtual UGroup* getBrowsingGroup();
00120 virtual void addingTo(UChild*, UGroup *parent);
00121 virtual void removingFrom(UChild*, UGroup *parent);
00123
00124 private:
00125 friend class UAppli;
00126 friend class UMenuManager;
00127 UGroup *menuBrowsingGroup;
00128 UCall *enter_opener, *arm_opener, *disarm_opener;
00129 class UPlacement *placement;
00130
00131 protected:
00132 virtual void enterChild(UEvent&);
00133 virtual void leaveChild(UEvent&);
00134 virtual void relaxChild(UEvent&);
00135 virtual void enterOpener(UEvent&);
00136 virtual void armOpener(UEvent&);
00137 virtual void disarmOpener(UEvent&);
00138 virtual void openImpl(UMenuManager&, UView* opener,
00139 UGroup* menugroup, bool auto_place, UDisp*);
00140 #endif
00141 };
00142
00143
00173 class UPopmenu : public UMenu {
00174 public:
00175 UBIT_ELEMENT_CLASS(UPopmenu, UMenu)
00176
00177 UPopmenu(const UArgs& a = UArgs::none);
00179
00180 friend UPopmenu& upopmenu(const UArgs& a = UArgs::none) {return *new UPopmenu(a);}
00182
00183 static UStyle* createStyle();
00184 };
00185
00186 }
00187 #endif
00188
00189
00190
00191