CMS 3D CMS Logo

IgQtObjectMenu.h

Go to the documentation of this file.
00001 #ifndef IGUANA_STUDIO_IG_QT_OBJECT_MENU_H
00002 # define IGUANA_STUDIO_IG_QT_OBJECT_MENU_H
00003 
00004 //<<<<<< INCLUDES                                                       >>>>>>
00005 
00006 # include "Iguana/Studio/interface/config.h"
00007 # include <qkeysequence.h>
00008 # include <vector>
00009 
00010 //<<<<<< PUBLIC DEFINES                                                 >>>>>>
00011 //<<<<<< PUBLIC CONSTANTS                                               >>>>>>
00012 //<<<<<< PUBLIC TYPES                                                   >>>>>>
00013 
00014 class QPopupMenu;
00015 class QString;
00016 class QObject;
00017 class QKeySequence;
00018 class QIconSet;
00019 class QPixmap;
00020 
00021 //<<<<<< PUBLIC VARIABLES                                               >>>>>>
00022 //<<<<<< PUBLIC FUNCTIONS                                               >>>>>>
00023 //<<<<<< CLASS DECLARATIONS                                             >>>>>>
00024 
00057 class IGUANA_STUDIO_API IgQtObjectMenu
00058 {
00059 public:
00060     struct ItemDef
00061     {
00062         int             subid;          //< Optional sub-menu id
00063         int             id;             //< Menu item id
00064         const char      *name;          //< Menu item text
00065         const char      *member;        //< Slot
00066         int             param;          //< Action parameter
00067     };
00068 
00069     IgQtObjectMenu (QPopupMenu *menu);
00070     // implicit copy constructor
00071     // implicit assignment operator
00072     // implicit destructor
00073 
00074 
00075     // Bulk operations
00076     void                        insertFromDefs (const QObject *receiver,
00077                                                 const ItemDef *defs,
00078                                                 unsigned n);
00079     void                        removeFromDefs (const ItemDef *defs,
00080                                                 unsigned n);
00081 
00082     // Individual operations
00083     IgQtObjectMenu *            subMenu (int id) const;
00084     bool                        hasItem (int id) const;
00085     void                        removeItem (int id);
00086 
00087     IgQtObjectMenu *            insertSubMenu (int id, const QString &text);
00088     IgQtObjectMenu *            insertSubMenu (int id, const QIconSet &icon,
00089                                                const QString &text);
00090     IgQtObjectMenu *            insertSubMenu (int id, const QPixmap &pixmap);
00091     IgQtObjectMenu *            insertSubMenu (int id, const QIconSet &icon,
00092                                                const QPixmap &pixmap);
00093 
00094     int                         insertItem (int id, const QString &text);
00095     int                         insertItem (int id, const QIconSet &icon,
00096                                             const QString &text);
00097     int                         insertItem (int id, const QPixmap &pixmap);
00098     int                         insertItem (int id, const QIconSet &icon,
00099                                             const QPixmap &pixmap);
00100 
00101     int                         insertItem (int id,
00102                                             const QString &text,
00103                                             const QObject *receiver,
00104                                             const char *member,
00105                                             const QKeySequence &accel = 0);
00106     int                         insertItem (int id,
00107                                             const QIconSet &icon,
00108                                             const QString &text,
00109                                             const QObject *receiver,
00110                                             const char *member,
00111                                             const QKeySequence &accel = 0);
00112     int                         insertItem (int id,
00113                                             const QPixmap &pixmap,
00114                                             const QObject *receiver,
00115                                             const char *member,
00116                                             const QKeySequence &accel = 0);
00117     int                         insertItem (int id,
00118                                             const QIconSet &icon,
00119                                             const QPixmap &pixmap,
00120                                             const QObject *receiver,
00121                                             const char *member,
00122                                             const QKeySequence &accel = 0);
00123 
00124     // int                      insertItem (int id, QWidget *widget);
00125     // int                      insertItem (int id, const QIconSet &icon,
00126     //                                      QCustomMenuItem *custom);
00127     // int                      insertItem (int id, QCustomMenuItem *custom);
00128 
00129     int                         insertSeparator (int id);
00130 
00131     QKeySequence                accel (int id) const;
00132     QIconSet *                  iconSet (int id) const;
00133     QString                     text (int id) const;
00134     QPixmap *                   pixmap (int id) const;
00135     QString                     whatsThis (int id) const;
00136     int                         itemParameter (int id) const;
00137 
00138     void                        setAccel (int id, const QKeySequence &key);
00139     void                        changeItem (int id, const QString &text);
00140     void                        changeItem (int id, const QPixmap &pixmap);
00141     void                        changeItem (int id, const QIconSet &icon, const QString &text);
00142     void                        changeItem (int id, const QIconSet &icon, const QPixmap &pixmap);
00143     void                        setWhatsThis (int id, const QString &text);
00144     bool                        connectItem (int id, const QObject *receiver, const char *member);
00145     bool                        disconnectItem (int id, const QObject *receiver, const char *member);
00146     bool                        setItemParameter (int id, int param);
00147 
00148     bool                        isItemActive (int id) const;
00149     bool                        isItemEnabled (int id) const;
00150     bool                        isItemChecked (int id) const;
00151 
00152     void                        setItemEnabled (int id, bool enable);
00153     void                        setItemChecked (int id, bool check);
00154 
00155 private:
00156     unsigned                    itemPosition (int id) const;
00157     unsigned                    subMenuPosition (int id, bool exact) const;
00158     void                        clearDummy (void);
00159     void                        setDummy (void);
00160 
00161     typedef std::vector<IgQtObjectMenu *>       SubMenus;
00162 
00163     QPopupMenu *                m_menu;
00164     SubMenus                    m_submenus;
00165     int                         m_dummy;
00166 };
00167 
00168 //<<<<<< INLINE PUBLIC FUNCTIONS                                        >>>>>>
00169 //<<<<<< INLINE MEMBER FUNCTIONS                                        >>>>>>
00170 
00171 #endif // IGUANA_STUDIO_IG_QT_OBJECT_MENU_H

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