Salome HOME
SQUISH test for refs #576
[modules/shaper.git] / src / NewGeom / NewGeom_Module.h
index 11a2e10355d209d230d91c66fc519d26a77c8779..7c0aa1a6eab7ca13c31f523361bfcd26bfbf7980 100644 (file)
@@ -1,3 +1,5 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
 
 #ifndef NewGeom_Module_H
 #define NewGeom_Module_H
@@ -8,6 +10,8 @@
 #include <LightApp_Module.h>
 #include <XGUI_SalomeConnector.h>
 
+#include <ModuleBase_ActionInfo.h>
+
 #include <QStringList>
 #include <QMap>
 
@@ -16,6 +20,7 @@ class NewGeom_OCCSelector;
 class OCCViewer_Viewer;
 
 /** 
+ * \ingroup Salome
  * An implementation of SALOME connector class for implementation of
  * XGUI functionality as a module of SALOME
  */
@@ -27,23 +32,46 @@ Q_OBJECT
   virtual ~NewGeom_Module();
 
   //----- LightAPP_Module interface ---------------
+
+  /// \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<int, int>& 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,
                               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 QAction* addNestedFeature(const QString& theWBName,
+                                    const ActionInfo& theInfo,
+                                    const QList<QAction*>& theNestedActions);
+
+  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 addEditMenuSeparator();
+  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;
@@ -78,43 +106,94 @@ Q_OBJECT
   //! 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);
 
+  /// Redefinition of virtual function for preferences creation. 
   virtual void createPreferences();
-  virtual void preferencesChanged(const QString& theSection, const QString& theParam);
 
+  /// 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; }
 
+  /// \brief Set flag about opened document state
   void setIsOpened(bool theOpened) { myIsOpened = theOpened; }
 
+  /// 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:
+   /// 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<QString, QStringList> myNestedActions;
+
+  /// Map of document types
   QMap<QString, QString> myDocumentType;
 
+  /// Flag of opened document state
   bool myIsOpened;
-  bool myIsStorePositions;
 
+  // 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