X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_ContextMenuMgr.h;h=64c846b18e2bd1aababd9f6da27b7438b613d69a;hb=ed165fd07e71c11885fdc5f475a8522a5914e00d;hp=a8255ff0cab25dc269bf109b82d373c7574c6280;hpb=ba5252b2aa791ab16b93e89d4da65db73f63aa2c;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_ContextMenuMgr.h b/src/XGUI/XGUI_ContextMenuMgr.h index a8255ff0c..64c846b18 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.h +++ b/src/XGUI/XGUI_ContextMenuMgr.h @@ -1,4 +1,3 @@ - #ifndef XGUI_ContextMenuMgr_H #define XGUI_ContextMenuMgr_H @@ -12,36 +11,53 @@ class QAction; class QContextMenuEvent; class QMenu; -class XGUI_EXPORT XGUI_ContextMenuMgr: public QObject +/** + * A claas wihich provides manement of context menu + */ +class XGUI_EXPORT XGUI_ContextMenuMgr : public QObject { Q_OBJECT -public: + public: XGUI_ContextMenuMgr(XGUI_Workshop* theParent); virtual ~XGUI_ContextMenuMgr(); + /// Create all actions for context menus. It is called on creation of application void createActions(); - void addAction(const QString& theId, QAction* theAction); - + /// Returns action according to the given ID QAction* action(const QString& theId) const; + /// Returns list of registered actions Ids QStringList actionIds() const; + /// update state of internal commands void updateCommandsStatus(); + /// Connect to object browser from workshop. Has to called at creation of viewer. void connectObjectBrowser() const; + /// Connect to viewer from workshop. Has to called at creation of viewer. void connectViewer() const; + /// Add menu atems for viewer into the given menu (used in SALOME mode) + void addViewerItems(QMenu* theMenu) const; + signals: void actionTriggered(const QString& theId, bool isChecked); -private slots: + private slots: void onAction(bool isChecked); void onContextMenuRequest(QContextMenuEvent* theEvent); -private: + private: + /** + * Add action + * \param theId - string ID of the item + * \param theAction - action to add + */ + void addAction(const QString& theId, QAction* theAction); + QMenu* objectBrowserMenu() const; QMenu* viewerMenu() const; @@ -50,4 +66,4 @@ private: XGUI_Workshop* myWorkshop; }; -#endif \ No newline at end of file +#endif