Salome HOME
312342e14e149a74d59eb5db486851325061f79b
[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 ModuleBase_IViewer;
15
16 /**
17  * \ingroup GUI
18  * An interface which provides a connection of XGUI functionality 
19  * with functionality of SALOME module interface.
20  */
21 class XGUI_EXPORT XGUI_SalomeConnector
22 {
23  public:
24   //! Creates a feature (command) in SALOME desktop
25   //! \param theWBName - a workbench name
26   //! \param theId - an id of the feature
27   //! \param theTitle - a menu item string
28   //! \param theTip - a tooltip string (help)
29   //! \param theIcon - icon
30   //! \param isCheckable - is checkable or not
31   //! \param theKeys - hot keys
32   //! returns created action
33   virtual QAction* addFeature(const QString& theWBName, const QString& theId,
34                               const QString& theTitle, const QString& theTip, const QIcon& theIcon,
35                               const QKeySequence& theKeys, bool isCheckable) = 0;
36
37   //! Creates a feature (command) in SALOME desktop
38   //! \param theWBName - name of toolbar (workbench)
39   //! \param theInfo - information about action (icon, text, etc)
40   virtual QAction* addFeature(const QString& theWBName,
41                               const ActionInfo& theInfo) = 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* addNestedFeature(const QString& theWBName,
47                                     const ActionInfo& theInfo,
48                                     const QList<QAction*>& theNestedActions) = 0;
49
50   //! Creates a command in Edit menu of SALOME desktop
51   //! \param theId - an id of the feature
52   //! \param theTitle - a menu item string
53   //! \param theTip - a tooltip string (help)
54   //! \param theIcon - icon
55   //! \param isCheckable - is checkable or not
56   //! \param theKeys - hot keys
57   //! \param theMenuSourceText - a source text of the desktop menu
58   //! \param theMenuPosition - a position of the command in the desktop menu
59   //! returns created action
60   virtual QAction* addDesktopCommand(const QString& theId, const QString& theTitle,
61                                      const QString& theTip, const QIcon& theIcon,
62                                      const QKeySequence& theKeys, bool isCheckable,
63                                      const char* theMenuSourceText,
64                                      const int theMenuPosition = 10) = 0;
65
66   //! Insert separator into Edit menu of SALOME desktop
67   virtual void addDesktopMenuSeparator(const char* theMenuSourceText,
68                                        const int theMenuPosition = 10) = 0;
69
70   //! Returns desktop window of SALOME
71   virtual QMainWindow* desktop() const = 0;
72
73   //! Returns command string Id by QAction instance
74   virtual QString commandId(const QAction* theCmd) const = 0;
75
76   //! Returns QAction instance by command string Id
77   virtual QAction* command(const QString& theId) const = 0;
78
79   //! Returns list of defined actions (just by NewGeom module)
80   virtual QList<QAction*> commandList() const = 0;
81
82   //! Returns list of Ids of defined actions (just by NewGeom module)
83   virtual QStringList commandIdList() const = 0;
84
85   //! Set nested actions dependent on command Id
86   //! \param theId - the command ID
87   //! \param theActions - the list of nested actions
88   virtual void setNestedActions(const QString& theId, const QStringList& theActions) = 0;
89
90   //! Returns list of nested actions according to the given command ID
91   virtual QStringList nestedActions(const QString& theId) const = 0;
92
93   //! Set the document kind of the action by the given command Id
94   //! \param theId - the command ID
95   //! \param theKind - the document kind
96   virtual void setDocumentKind(const QString& theId, const QString& theKind) = 0;
97
98   //! Returns the document kind of the action by the given command ID
99   virtual QString documentKind(const QString& theId) const = 0;
100
101   //! Returns interface to Salome viewer
102   virtual ModuleBase_IViewer* viewer() const = 0;
103
104   //! Create preferences
105   virtual void createPreferences() = 0;
106 };
107
108 #endif