Salome HOME
7596878a1de0e6eab8fdc382b59c1a6cb0432538
[modules/shaper.git] / src / XGUI / XGUI_SalomeConnector.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 #ifndef XGUI_SALOMECONNECTOR_H
4 #define XGUI_SALOMECONNECTOR_H
5
6 #include "XGUI.h"
7
8 #include <QString>
9 #include <QStringList>
10
11 #include <ModuleBase_ActionInfo.h>
12
13 class QMainWindow;
14 class Config_FeatureMessage;
15 class ModuleBase_IViewer;
16
17 /**
18  * \ingroup GUI
19  * An interface which provides a connection of XGUI functionality 
20  * with functionality of SALOME module interface.
21  */
22 class XGUI_EXPORT XGUI_SalomeConnector
23 {
24  public:
25   /// Default constructor
26   XGUI_SalomeConnector();
27   /// Virtual destructor
28   virtual ~XGUI_SalomeConnector();
29
30   //! Creates a feature (command) in SALOME desktop
31   //! \param theWBName - a workbench name
32   //! \param theId - an id of the feature
33   //! \param theTitle - a menu item string
34   //! \param theTip - a tooltip string (help)
35   //! \param theIcon - icon
36   //! \param isCheckable - is checkable or not
37   //! \param theKeys - hot keys
38   //! returns created action
39   virtual QAction* addFeature(const QString& theWBName, const QString& theId,
40                               const QString& theTitle, const QString& theTip, const QIcon& theIcon,
41                               const QKeySequence& theKeys, bool isCheckable) = 0;
42
43   //! Creates a feature (command) in SALOME desktop
44   //! \param theWBName - name of toolbar (workbench)
45   //! \param theInfo - information about action (icon, text, etc)
46   virtual QAction* addFeature(const QString& theWBName,
47                               const ActionInfo& theInfo) = 0;
48
49   //! Creates a feature (command) in SALOME desktop
50   //! \param theWBName - name of toolbar (workbench)
51   //! \param theInfo - information about action (icon, text, etc)
52   //! \param theNestedActions a list of nested actions
53   virtual QAction* addFeatureOfNested(const QString& theWBName,
54                                     const ActionInfo& theInfo,
55                                     const QList<QAction*>& theNestedActions) = 0;
56
57   //! Returns true if the feature action is a nested action, in other words,
58   //! it is created by addFeatureOfNested().
59   //! \param theAction - an action of a feature
60   //! returns boolean result
61   virtual bool isFeatureOfNested(const QAction* theAction) = 0;
62
63   //! Creates a command in Edit menu of SALOME desktop
64   //! \param theId - an id of the feature
65   //! \param theTitle - a menu item string
66   //! \param theTip - a tooltip string (help)
67   //! \param theIcon - icon
68   //! \param isCheckable - is checkable or not
69   //! \param theKeys - hot keys
70   //! \param theMenuSourceText - a source text of the desktop menu
71   //! \param theMenuPosition - a position of the command in the desktop menu
72   //! returns created action
73   virtual QAction* addDesktopCommand(const QString& theId, const QString& theTitle,
74                                      const QString& theTip, const QIcon& theIcon,
75                                      const QKeySequence& theKeys, bool isCheckable,
76                                      const char* theMenuSourceText,
77                                      const int theMenuPosition = 10) = 0;
78
79   //! Insert separator into Edit menu of SALOME desktop
80   virtual void addDesktopMenuSeparator(const char* theMenuSourceText,
81                                        const int theMenuPosition = 10) = 0;
82
83   /// Add an action into tool bar
84   /// \param theAction the Action object
85   /// \param theToolBarTitle the toolbar name
86   virtual bool addActionInToolbar( QAction* theAction, const QString& theToolBarTitle ) = 0;
87
88   //! Returns desktop window of SALOME
89   virtual QMainWindow* desktop() const = 0;
90
91   //! Returns command string Id by QAction instance
92   virtual QString commandId(const QAction* theCmd) const = 0;
93
94   //! Returns QAction instance by command string Id
95   virtual QAction* command(const QString& theId) const = 0;
96
97   //! Returns list of defined actions (just by SHAPER module)
98   virtual QList<QAction*> commandList() const = 0;
99
100   //! Returns list of Ids of defined actions (just by NewGeom module)
101   virtual QStringList commandIdList() const = 0;
102
103   //! Stores XML information for the feature kind
104   //! \param theFeatureId a feature kind
105   //! \param theMessage a container of the feature XML properties
106   virtual void setFeatureInfo(const QString& theFeatureId,
107                               const std::shared_ptr<Config_FeatureMessage>& theMessage) = 0;
108
109   //! Returns XML information for the feature kind
110   //! \param theFeatureId a feature kind
111   //! \return theMessage a container of the feature XML properties
112   virtual std::shared_ptr<Config_FeatureMessage> featureInfo(const QString& theFeatureId) = 0;
113
114   //! Returns interface to Salome viewer
115   virtual ModuleBase_IViewer* viewer() const = 0;
116
117   //! Create preferences
118   virtual void createPreferences() = 0;
119 };
120
121 #endif