]> SALOME platform Git repositories - modules/shaper.git/blob - src/NewGeom/NewGeom_Module.h
Salome HOME
Merge branch 'master' of newgeom:newgeom
[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 QAction* addFeature(const QString& theWBName,
38                               const QString& theId, 
39                               const QString& theTitle, 
40                               const QString& theTip,
41                               const QIcon& theIcon, 
42                               const QKeySequence& theKeys = QKeySequence(),
43                               bool isCheckable = false);
44
45   virtual QAction* addEditCommand(const QString& theId,
46                                   const QString& theTitle,
47                                   const QString& theTip,
48                                   const QIcon& theIcon, 
49                                   const QKeySequence& theKeys,
50                                   bool isCheckable);
51
52   virtual void addEditMenuSeparator();
53
54   virtual QMainWindow* desktop() const;
55
56   virtual QString commandId(const QAction* theCmd) const;
57
58   virtual QAction* command(const QString& theId) const;
59
60   //! Set nested actions dependent on command Id
61   //! \param theId - the command ID
62   //! \param theActions - the list of nested actions
63   virtual void setNestedActions(const QString& theId, const QStringList& theActions);
64
65   //! Returns list of nested actions according to the given command ID
66   virtual QStringList nestedActions(const QString& theId) const;
67
68   //! Returns interface to Salome viewer
69   virtual XGUI_SalomeViewer* viewer() const { return myProxyViewer; }
70
71   //! Returns list of defined actions (just by NewGeom module)
72   virtual QList<QAction*> commandList() const;
73
74   //! Returns list of Ids of defined actions (just by NewGeom module)
75   virtual QStringList commandIdList() const;
76
77   virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle);
78
79 public slots:
80   virtual bool activateModule( SUIT_Study* theStudy);
81   virtual bool deactivateModule( SUIT_Study* theStudy);
82
83 protected slots:
84   virtual void onViewManagerAdded( SUIT_ViewManager* theMgr );
85
86 protected:
87   CAM_DataModel* createDataModel();
88
89
90 private:
91   NewGeom_OCCSelector* createSelector(SUIT_ViewManager* theMgr);
92
93   QStringList myActionsList;
94
95   XGUI_Workshop* myWorkshop;
96
97   NewGeom_OCCSelector* mySelector;
98
99   NewGeom_SalomeViewer* myProxyViewer;
100
101   QMap<QString, QStringList> myNestedActions;
102 };
103
104 #endif