umenu.hpp

00001 /* ==================================================== ======== ======= *
00002 *
00003 *  umenu.hpp
00004 *  Ubit Project
00005 *  Part of the Ubit Toolkit: A Brick Construction Game Model for Creating GUIs
00006 *  (C) 1999-2006 Eric Lecolinet / ENST Paris / http://www.enst.fr/~elc/ubit
00007 *
00008 * ***********************************************************************
00009 * COPYRIGHT NOTICE :
00010 * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE
00011 * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
00012 * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU
00013 * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
00014 * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
00015 * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS.
00016 * ***********************************************************************
00017 * ==================================================== [(c)Elc] ======= */
00018 
00019 #ifndef _umenu_hpp_
00020 #define _umenu_hpp_
00021 //pragma ident  "@(#)umenu.hpp  ubit:05.05.00"
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   // - - -impl - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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   // - - - Impl. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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 /* ==================================================== [TheEnd] ======= */
00189 /* ==================================================== [(c)Elc] ======= */
00190 
00191 

Generated on Mon Jan 29 00:20:39 2007 for Ubit by  doxygen 1.4.7