1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
4 #ifndef NewGeom_Module_H
5 #define NewGeom_Module_H
8 #include "NewGeom_SalomeViewer.h"
10 #include <LightApp_Module.h>
11 #include <XGUI_SalomeConnector.h>
13 #include <QStringList>
17 class NewGeom_OCCSelector;
18 class OCCViewer_Viewer;
21 * An implementation of SALOME connector class for implementation of
22 * XGUI functionality as a module of SALOME
24 class NewGeom_EXPORT NewGeom_Module : public LightApp_Module, public XGUI_SalomeConnector
29 virtual ~NewGeom_Module();
31 //----- LightAPP_Module interface ---------------
32 virtual void initialize(CAM_Application* theApp);
33 virtual void windows(QMap<int, int>& theWndMap) const;
34 virtual void viewManagers(QStringList& theList) const;
35 virtual void selectionChanged();
37 //--- XGUI connector interface -----
38 virtual QAction* addFeature(const QString& theWBName, const QString& theId,
39 const QString& theTitle, const QString& theTip, const QIcon& theIcon,
40 const QKeySequence& theKeys = QKeySequence(),
41 bool isCheckable = false);
43 virtual QAction* addDesktopCommand(const QString& theId, const QString& theTitle,
44 const QString& theTip, const QIcon& theIcon,
45 const QKeySequence& theKeys, bool isCheckable,
46 const char* theMenuSourceText,
47 const int theMenuPosition = 10);
49 virtual void addDesktopMenuSeparator(const char* theMenuSourceText,
50 const int theMenuPosition = 10);
52 virtual QMainWindow* desktop() const;
54 virtual QString commandId(const QAction* theCmd) const;
56 virtual QAction* command(const QString& theId) const;
58 //! Set nested actions dependent on command Id
59 //! \param theId - the command ID
60 //! \param theActions - the list of nested actions
61 virtual void setNestedActions(const QString& theId, const QStringList& theActions);
63 //! Returns list of nested actions according to the given command ID
64 virtual QStringList nestedActions(const QString& theId) const;
66 //! Set the document kind of the action by the given command Id
67 //! \param theId - the command ID
68 //! \param theKind - the document kind
69 virtual void setDocumentKind(const QString& theId, const QString& theKind);
71 //! Returns the document kind of the action by the given command ID
72 virtual QString documentKind(const QString& theId) const;
74 //! Returns interface to Salome viewer
75 virtual ModuleBase_IViewer* viewer() const
80 //! Returns list of defined actions (just by NewGeom module)
81 virtual QList<QAction*> commandList() const;
83 //! Returns list of Ids of defined actions (just by NewGeom module)
84 virtual QStringList commandIdList() const;
86 virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle);
88 virtual void createPreferences();
89 virtual void preferencesChanged(const QString& theSection, const QString& theParam);
91 XGUI_Workshop* workshop() const { return myWorkshop; }
93 void setIsOpened(bool theOpened) { myIsOpened = theOpened; }
95 void inspectSalomeModules();
98 virtual bool activateModule(SUIT_Study* theStudy);
99 virtual bool deactivateModule(SUIT_Study* theStudy);
102 virtual void onViewManagerAdded(SUIT_ViewManager* theMgr);
103 virtual void onViewManagerRemoved(SUIT_ViewManager* theMgr);
105 void onDefaultPreferences();
106 // Obtains the current application and updates its actions
107 void onUpdateCommandStatus();
110 CAM_DataModel* createDataModel();
111 virtual QtxPopupMgr* popupMgr();
114 NewGeom_OCCSelector* createSelector(SUIT_ViewManager* theMgr);
116 QStringList myActionsList;
118 XGUI_Workshop* myWorkshop;
120 NewGeom_OCCSelector* mySelector;
122 NewGeom_SalomeViewer* myProxyViewer;
124 QMap<QString, QStringList> myNestedActions;
125 QMap<QString, QString> myDocumentType;
128 // the next parameters should be restored after this module deactivation
129 bool myIsStorePositions; // the application value of the preferences parameter
130 bool myIsEditEnabled; // the application value
132 QtxPopupMgr* myPopupMgr;