ubit
umenuImpl.hpp
1 /* ==================================================== ======== ======= *
2  *
3  * umenuImpl.hpp
4  * Ubit GUI Toolkit - Version 6
5  * (C) 2009 | Eric Lecolinet | TELECOM ParisTech | http://www.enst.fr/~elc/ubit
6  *
7  * ***********************************************************************
8  * COPYRIGHT NOTICE :
9  * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE
10  * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
11  * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU
12  * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
13  * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
14  * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS.
15  * ***********************************************************************/
16 
17 #ifndef _umenuImpl_hpp_
18 #define _umenuImpl_hpp_ 1
19 #include <vector>
20 namespace ubit {
21 
24 class UMenuManager {
25 public:
27  ~UMenuManager();
28 
29  UMenu* getDeepestMenu() const {return active_menu;}
31 
32  bool contains(UMenu* menu) const;
33  // returns true if this menu is in the menu stack.
34 
35  bool contains(UView*) const;
36  // returns true if this view is contained in a menu in the menu stack.
37 
38  void closeAllMenus(bool clear_top_menu);
40 
41  void closeSubMenus(UMenu* from_menu, bool including_this_menu);
43 
44  void openMenu(UView* opener, UMenu*, UDisp*);
45  void openMenuAfterDelay();
46  void closeMenuAfterDelay();
47 
48  void menuChildCB(UInputEvent&, UBox* menu_or_menubar);
49 
50 protected:
51  friend class UMenu;
52  friend class UMenubar;
53  friend class UEventFlow;
54  std::vector<UMenu*> menustack; // stack of menus that are currently being grabbed
55  int menu_count;
56  UDisp* disp;
57  UEventFlow& eflow;
58  UView *active_opener, *possible_opener, *possible_closer;
59  UMenu *active_menu, *possible_opener_menu, *possible_closer_menu;
60  uptr<UTimer> kk_open_timer, kk_close_timer; // uptr: dont destroy Timers $$$
61  UBox* top_menu;
62 };
63 
64 }
65 #endif
66 /* ==================================================== [TheEnd] ======= */
67 /* ==================================================== [(c)Elc] ======= */
68 
UMenu * getDeepestMenu() const
returns the deepest menu in the menu stack (if any, null otherwise).
Definition: umenuImpl.hpp:29
Box container.
Definition: ubox.hpp:64
Display Context.
Definition: udisp.hpp:44
Menu bar.
Definition: umenu.hpp:27
Smart Pointer for UObject instances (.
Definition: uobject.hpp:365
void closeAllMenus(bool clear_top_menu)
closes all menus in the menu stack.
Definition: umenu.cpp:462
UMenu: pulldown and cascaded menux.
Definition: umenu.hpp:64
Event Flow.
Definition: ueventflow.hpp:34
Box View.
Definition: uview.hpp:65
Definition: uhardfont.hpp:31
Base class for UMouseEvent and UKeyEvent Note that this class inherits from class UModifier that defi...
Definition: uevent.hpp:75
[Implementation] manages the stack of menus that are currently opened on a given EventFlow.
Definition: umenuImpl.hpp:24
void closeSubMenus(UMenu *from_menu, bool including_this_menu)
closes the submenus of this menu (calls closeAllMenus if menu is not found).
Definition: umenu.cpp:482