CMS 3D CMS Logo

IgQtAppMenuService.h

Go to the documentation of this file.
00001 #ifndef IGUANA_STUDIO_IG_QT_APP_MENU_SERVICE_H
00002 # define IGUANA_STUDIO_IG_QT_APP_MENU_SERVICE_H
00003 
00004 //<<<<<< INCLUDES                                                       >>>>>>
00005 
00006 # include "Iguana/Studio/interface/config.h"
00007 # include "Iguana/Framework/interface/IgStateElement.h"
00008 
00009 //<<<<<< PUBLIC DEFINES                                                 >>>>>>
00010 //<<<<<< PUBLIC CONSTANTS                                               >>>>>>
00011 //<<<<<< PUBLIC TYPES                                                   >>>>>>
00012 
00013 class QWidget;
00014 class QMainWindow;
00015 class QMenuBar;
00016 class QPopupMenu;
00017 class QMenuData;
00018 class QString;
00019 class QObject;
00020 
00021 //<<<<<< PUBLIC VARIABLES                                               >>>>>>
00022 //<<<<<< PUBLIC FUNCTIONS                                               >>>>>>
00023 //<<<<<< CLASS DECLARATIONS                                             >>>>>>
00024 
00025 class IGUANA_STUDIO_API IgQtAppMenuService : public IgStateElement
00026 {
00027     IG_DECLARE_STATE_ELEMENT (IgQtAppMenuService);
00028 public:
00029     static const int    MENU_GROUP_RANGE = 1000;
00030     static const int    MENU_SUBGROUP_RANGE = 50;
00031 
00032     static const int    MENU_ID_FILE            = 0;
00033     static const int    MENU_ID_FILE_SAVE       = 1;
00034     static const int    MENU_ID_FILE_PRINT      = 2;
00035     static const int    MENU_ID_FILE_QUIT       = (MENU_ID_FILE
00036                                                    + 10 * MENU_SUBGROUP_RANGE);
00037     static const int    MENU_ID_HELP            = 100 * MENU_GROUP_RANGE;
00038 
00039     IgQtAppMenuService (IgState *state, QWidget *mainWindow);
00040     ~IgQtAppMenuService (void);
00041 
00042     // FIXME: Add methods to manage the main menu (and popups?).
00043     // Organise menus by ids given in insertion stuff.  Use the app
00044     // context service to manage the enabling of menu items on popup.
00045     // Insert separators if ids change by certain boundary (1000?).
00046 
00047     QMenuBar *                  menuBar (void);
00048     QPopupMenu *                subMenu (int id);
00049     QPopupMenu *                subMenu (int id1, int id2);
00050     QPopupMenu *                findByName (QMenuData *menu, 
00051                                             const char *itemName);
00052     
00053     static int                  index (QMenuData *menu, int id);
00054     static int                  isIdThere (QMenuData *menu, int id);
00055     static void                 insertItem (QMenuData *parentMenu,
00056                                             const QString &text,
00057                                             QObject *target,
00058                                             const char *slot,
00059                                             int id,
00060                                             IgState *state = 0);
00061 private:
00062     IgState                     *m_state;
00063     QMainWindow                 *m_mainWindow;
00064 
00065     // undefined semantics
00066     IgQtAppMenuService (const IgQtAppMenuService &);
00067     IgQtAppMenuService &operator= (const IgQtAppMenuService &);
00068 };
00069 
00070 //<<<<<< INLINE PUBLIC FUNCTIONS                                        >>>>>>
00071 //<<<<<< INLINE MEMBER FUNCTIONS                                        >>>>>>
00072 
00073 #endif // IGUANA_STUDIO_IG_QT_APP_MENU_SERVICE_H

Generated on Tue Jun 9 17:38:48 2009 for CMSSW by  doxygen 1.5.4