Updraft  1.0
Open source glider flight visualisation tool.
menu.h
Go to the documentation of this file.
00001 #ifndef UPDRAFT_SRC_CORE_UI_MENU_H_
00002 #define UPDRAFT_SRC_CORE_UI_MENU_H_
00003 
00004 #include <QtGui>
00005 
00006 #include "../../menuinterface.h"
00007 
00008 class QMenu;
00009 class QAction;
00010 
00011 namespace Updraft {
00012 namespace Core {
00013 
00014 
00016 class Menu : public MenuInterface {
00017   // TODO(cestmir): We should take care about the destruction of parent menu.
00018   // So far, it's not a problem because we don't create the menus dynamically
00019  public:
00025   Menu(QMenu* setMenu, bool ownsQMenu)
00026     : menu(setMenu), ownsMenu(ownsQMenu) {}
00027 
00028   ~Menu();
00029 
00032   void lightClear();
00033 
00035   void clear();
00036 
00044   void insertAction(int position, QAction* action, bool own = false);
00045 
00051   void appendAction(QAction* action, bool own = false);
00052 
00055   QMenu* getQMenu() { return menu; }
00056 
00059   QMenu* giveQMenu();
00060 
00061  private:
00062   QMenu* menu;
00063   bool ownsMenu;
00064 
00066   QMultiMap<int, QAction*> actions;
00067 
00069   QList<QAction*> ownedActions;
00070 
00072   void reorganizeMenu();
00073 };
00074 
00075 }  // End namespace Core
00076 }  // End namespace Updraft
00077 
00078 #endif  // UPDRAFT_SRC_CORE_UI_MENU_H_
00079 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines