Salome HOME
Improve viewer performance
[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   /// Default constructor
25   XGUI_SalomeConnector();
26   /// Virtual destructor
27   virtual ~XGUI_SalomeConnector();
28
29   //! Creates a feature (command) in SALOME desktop
30   //! \param theWBName - a workbench name
31   //! \param theId - an id of the feature
32   //! \param theTitle - a menu item string
33   //! \param theTip - a tooltip string (help)
34   //! \param theIcon - icon
35   //! \param isCheckable - is checkable or not
36   //! \param theKeys - hot keys
37   //! returns created action
38   virtual QAction* addFeature(const QString& theWBName, const QString& theId,
39                               const QString& theTitle, const QString& theTip, const QIcon& theIcon,
40                               const QKeySequence& theKeys, bool isCheckable) = 0;
41
42   //! Creates a feature (command) in SALOME desktop
43   //! \param theWBName - name of toolbar (workbench)
44   //! \param theInfo - information about action (icon, text, etc)
45   virtual QAction* addFeature(const QString& theWBName,
46                               const ActionInfo& theInfo) = 0;
47
48   //! Creates a feature (command) in SALOME desktop
49   //! \param theWBName - name of toolbar (workbench)
50   //! \param theInfo - information about action (icon, text, etc)
51   //! \param theNestedActions a list of nested actions
52   virtual QAction* addFeatureOfNested(const QString& theWBName,
53                                     const ActionInfo& theInfo,
54                                     const QList<QAction*>& theNestedActions) = 0;
55
56   //! Returns true if the feature action is a nested action, in other words,
57   //! it is created by addFeatureOfNested().
58   //! \param theAction - an action of a feature
59   //! returns boolean result
60   virtual bool isFeatureOfNested(const QAction* theAction) = 0;
61
62   //! Creates a command in Edit menu of SALOME desktop
63   //! \param theId - an id of the feature
64   //! \param theTitle - a menu item string
65   //! \param theTip - a tooltip string (help)
66   //! \param theIcon - icon
67   //! \param isCheckable - is checkable or not
68   //! \param theKeys - hot keys
69   //! \param theMenuSourceText - a source text of the desktop menu
70   //! \param theMenuPosition - a position of the command in the desktop menu
71   //! returns created action
72   virtual QAction* addDesktopCommand(const QString& theId, const QString& theTitle,
73                                      const QString& theTip, const QIcon& theIcon,
74                                      const QKeySequence& theKeys, bool isCheckable,
75                                      const char* theMenuSourceText,
76                                      const int theMenuPosition = 10) = 0;
77
78   //! Insert separator into Edit menu of SALOME desktop
79   virtual void addDesktopMenuSeparator(const char* theMenuSourceText,
80                                        const int theMenuPosition = 10) = 0;
81
82   /// Add an action into tool bar
83   /// \param theAction the Action object
84   /// \param theToolBarTitle the toolbar name
85   virtual bool addActionInToolbar( QAction* theAction, const QString& theToolBarTitle ) = 0;
86
87   //! Returns desktop window of SALOME
88   virtual QMainWindow* desktop() const = 0;
89
90   //! Returns command string Id by QAction instance
91   virtual QString commandId(const QAction* theCmd) const = 0;
92
93   //! Returns QAction instance by command string Id
94   virtual QAction* command(const QString& theId) const = 0;
95
96   //! Returns list of defined actions (just by NewGeom module)
97   virtual QList<QAction*> commandList() const = 0;
98
99   //! Returns list of Ids of defined actions (just by NewGeom module)
100   virtual QStringList commandIdList() const = 0;
101
102   //! Set nested actions dependent on command Id
103   //! \param theId - the command ID
104   //! \param theActions - the list of nested actions
105   virtual void setNestedActions(const QString& theId, const QStringList& theActions) = 0;
106
107   //! Returns list of nested actions according to the given command ID
108   virtual QStringList nestedActions(const QString& theId) const = 0;
109
110   //! Set the document kind of the action by the given command Id
111   //! \param theId - the command ID
112   //! \param theKind - the document kind
113   virtual void setDocumentKind(const QString& theId, const QString& theKind) = 0;
114
115   //! Returns the document kind of the action by the given command ID
116   virtual QString documentKind(const QString& theId) const = 0;
117
118   //! Returns interface to Salome viewer
119   virtual ModuleBase_IViewer* viewer() const = 0;
120
121   //! Create preferences
122   virtual void createPreferences() = 0;
123 };
124
125 #endif