X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FNewGeom%2FNewGeom_Module.h;h=6024fa843ee9d90fa7bfb5b8c700ec25bc9e0c44;hb=a969416f74ed6c25b2e1c2199f0a8f13b74b185e;hp=78cc95fba730ed4993f1587facaf8743d325ecad;hpb=b088ac567eda79830c071c32443896ad59d56628;p=modules%2Fshaper.git diff --git a/src/NewGeom/NewGeom_Module.h b/src/NewGeom/NewGeom_Module.h index 78cc95fba..6024fa843 100644 --- a/src/NewGeom/NewGeom_Module.h +++ b/src/NewGeom/NewGeom_Module.h @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D #ifndef NewGeom_Module_H @@ -9,48 +10,74 @@ #include #include +#include + #include #include -class XGUI_Workshop; +class XGUI_Workshop; class NewGeom_OCCSelector; class OCCViewer_Viewer; /** -* An implementation of SALOME connector class for implementation of -* XGUI functionality as a module of SALOME -*/ -class NewGeom_EXPORT NewGeom_Module: public LightApp_Module, public XGUI_SalomeConnector + * \ingroup Salome + * An implementation of SALOME connector class for implementation of + * XGUI functionality as a module of SALOME + */ +class NewGeom_EXPORT NewGeom_Module : public LightApp_Module, public XGUI_SalomeConnector { - Q_OBJECT -public: +Q_OBJECT + public: NewGeom_Module(); virtual ~NewGeom_Module(); //----- LightAPP_Module interface --------------- - virtual void initialize( CAM_Application* theApp); - virtual void windows( QMap& theWndMap) const; - virtual void viewManagers( QStringList& theList) const; + + /// \brief Initializing of the module + /// \param theApp application instance + virtual void initialize(CAM_Application* theApp); + + /// \brief Definition of module standard windows + virtual void windows(QMap& theWndMap) const; + + /// \brief Definition of module viewer + virtual void viewManagers(QStringList& theList) const; + + /// \brief The method is called on selection changed event virtual void selectionChanged(); //--- XGUI connector interface ----- - virtual QAction* addFeature(const QString& theWBName, - const QString& theId, - const QString& theTitle, - const QString& theTip, - const QIcon& theIcon, + + virtual QAction* addFeature(const QString& theWBName, const QString& theId, + const QString& theTitle, const QString& theTip, const QIcon& theIcon, const QKeySequence& theKeys = QKeySequence(), bool isCheckable = false); - virtual QAction* addEditCommand(const QString& theId, - const QString& theTitle, - const QString& theTip, - const QIcon& theIcon, - const QKeySequence& theKeys, - bool isCheckable); + //! Add feature (QAction) in the \a theWBName toolbar with given \a theInfo about action + virtual QAction* addFeature(const QString& theWBName, + const ActionInfo& theInfo); - virtual void addEditMenuSeparator(); + virtual QAction* addNestedFeature(const QString& theWBName, + const ActionInfo& theInfo, + const QList& theNestedActions); + //! Returns true if the feature action is a nested action, in other words, + //! it is created by addNestedFeature(). + //! \param theId - an action of a feature + //! returns boolean result + virtual bool isNestedFeature(const QAction* theAction); + + virtual QAction* addDesktopCommand(const QString& theId, const QString& theTitle, + const QString& theTip, const QIcon& theIcon, + const QKeySequence& theKeys, bool isCheckable, + const char* theMenuSourceText, + const int theMenuPosition = 10); + + virtual void addDesktopMenuSeparator(const char* theMenuSourceText, + const int theMenuPosition = 10); + + virtual bool addActionInToolbar( QAction* theAction, const QString& theToolBarTitle ); + virtual QMainWindow* desktop() const; virtual QString commandId(const QAction* theCmd) const; @@ -65,8 +92,19 @@ public: //! Returns list of nested actions according to the given command ID virtual QStringList nestedActions(const QString& theId) const; + //! Set the document kind of the action by the given command Id + //! \param theId - the command ID + //! \param theKind - the document kind + virtual void setDocumentKind(const QString& theId, const QString& theKind); + + //! Returns the document kind of the action by the given command ID + virtual QString documentKind(const QString& theId) const; + //! Returns interface to Salome viewer - virtual XGUI_SalomeViewer* viewer() const { return myProxyViewer; } + virtual ModuleBase_IViewer* viewer() const + { + return myProxyViewer; + } //! Returns list of defined actions (just by NewGeom module) virtual QList commandList() const; @@ -74,31 +112,96 @@ public: //! Returns list of Ids of defined actions (just by NewGeom module) virtual QStringList commandIdList() const; + /// Redefinition of virtual function. + /// \param theClient name of pop-up client + /// \param theMenu popup menu instance + /// \param theTitle menu title. virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle); -public slots: - virtual bool activateModule( SUIT_Study* theStudy); - virtual bool deactivateModule( SUIT_Study* theStudy); + /// Redefinition of virtual function for preferences creation. + virtual void createPreferences(); + + /// Redefinition of virtual function for preferences changed event. + virtual void preferencesChanged(const QString& theSection, const QString& theParam); + + /// \return Workshop class instance + XGUI_Workshop* workshop() const { return myWorkshop; } -protected slots: - virtual void onViewManagerAdded( SUIT_ViewManager* theMgr ); + /// \brief Set flag about opened document state + void setIsOpened(bool theOpened) { myIsOpened = theOpened; } -protected: + /// Register current modules of SALOME + void inspectSalomeModules(); + + public slots: + /// \brief The method is called on the module activation + /// \param theStudy current study + virtual bool activateModule(SUIT_Study* theStudy); + + /// \brief The method is called on the module activation + /// \param theStudy current study + virtual bool deactivateModule(SUIT_Study* theStudy); + + protected slots: + /// Redefinition of virtual function + /// \param theMgr view manager + virtual void onViewManagerAdded(SUIT_ViewManager* theMgr); + + /// Redefinition of virtual function + /// \param theMgr view manager + virtual void onViewManagerRemoved(SUIT_ViewManager* theMgr); + + /// Set preferences to default + void onDefaultPreferences(); + + /// Obtains the current application and updates its actions + void onUpdateCommandStatus(); + + protected: + /// Create data model CAM_DataModel* createDataModel(); + /// Create popup menu manager + virtual QtxPopupMgr* popupMgr(); -private: + virtual bool abortAllOperations(); + + private: + /// Create selector for OCC Viewer + /// \param theMgr view manager NewGeom_OCCSelector* createSelector(SUIT_ViewManager* theMgr); + /// List of registered actions QStringList myActionsList; + /// Reference to workshop XGUI_Workshop* myWorkshop; + /// OCC viewer selector instance NewGeom_OCCSelector* mySelector; + /// Proxy viewer for connection to OCC Viewer in SALOME NewGeom_SalomeViewer* myProxyViewer; + /// Map of nested actions [ActionID: list of nested actions Id] QMap myNestedActions; + + /// Map of document types + QMap myDocumentType; + + /// Flag of opened document state + bool myIsOpened; + + // the next parameters should be restored after this module deactivation + + /// The application value of the preferences parameter + bool myIsStorePositions; + + /// The application value + bool myIsEditEnabled; + + /// Popup manager + QtxPopupMgr* myPopupMgr; }; #endif