Salome HOME
Nested operations
[modules/shaper.git] / src / NewGeom / NewGeom_Module.h
1
2
3 #ifndef NewGeom_Module_H
4 #define NewGeom_Module_H
5
6 #include "NewGeom.h"
7 #include "NewGeom_SalomeViewer.h"
8
9 #include <LightApp_Module.h>
10 #include <XGUI_SalomeConnector.h>
11
12 #include <QStringList>
13 #include <QMap>
14
15 class XGUI_Workshop; 
16 class NewGeom_OCCSelector;
17 class OCCViewer_Viewer;
18
19 /** 
20 * An implementation of SALOME connector class for implementation of
21 * XGUI functionality as a module of SALOME
22 */
23 class NewGeom_EXPORT NewGeom_Module: public LightApp_Module, public XGUI_SalomeConnector
24 {
25   Q_OBJECT
26 public:
27   NewGeom_Module();
28   virtual ~NewGeom_Module();
29
30   //----- LightAPP_Module interface ---------------
31   virtual void initialize( CAM_Application* theApp);
32   virtual void windows( QMap<int, int>& theWndMap) const;
33   virtual void viewManagers( QStringList& theList) const;
34   virtual void selectionChanged();
35
36   //--- XGUI connector interface -----
37   virtual void addFeature(const QString& theWBName,
38                           const QString& theId, 
39                           const QString& theTitle, 
40                           const QString& theTip,
41                           const QIcon& theIcon, 
42                           bool isCheckable = false,
43                           QObject* reciever = 0,
44                           const char* member = 0,
45                           const QKeySequence& theKeys = QKeySequence());
46
47   virtual void addEditCommand(const QString& theId,
48                               const QString& theTitle,
49                               const QString& theTip,
50                               const QIcon& theIcon, 
51                               bool isCheckable,
52                               QObject* reciever,
53                               const char* member,
54                               const QKeySequence& theKeys);
55
56   virtual void addEditMenuSeparator();
57
58   virtual QMainWindow* desktop() const;
59
60   virtual QString commandId(const QAction* theCmd) const;
61
62   virtual QAction* command(const QString& theId) const;
63
64   //! Set nested actions dependent on command Id
65   //! \param theId - the command ID
66   //! \param theActions - the list of nested actions
67   virtual void setNestedActions(const QString& theId, const QStringList& theActions);
68
69   //! Returns list of nested actions according to the given command ID
70   virtual QStringList nestedActions(const QString& theId) const;
71
72   //! Returns interface to Salome viewer
73   virtual XGUI_SalomeViewer* viewer() const { return myProxyViewer; }
74
75 public slots:
76   virtual bool activateModule( SUIT_Study* theStudy);
77   virtual bool deactivateModule( SUIT_Study* theStudy);
78
79 protected slots:
80   virtual void onViewManagerAdded( SUIT_ViewManager* theMgr );
81
82 protected:
83   CAM_DataModel* createDataModel();
84
85
86 private:
87   NewGeom_OCCSelector* createSelector(SUIT_ViewManager* theMgr);
88
89   QStringList myActionsList;
90
91   XGUI_Workshop* myWorkshop;
92
93   NewGeom_OCCSelector* mySelector;
94
95   NewGeom_SalomeViewer* myProxyViewer;
96
97   QMap<QString, QStringList> myNestedActions;
98 };
99
100 #endif