Salome HOME
Object Browser tree needed method implementation
[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   virtual QAction* addNestedFeature(const QString& theWBName,
52                                     const ActionInfo& theInfo,
53                                     const QList<QAction*>& theNestedActions) = 0;
54
55   //! Creates a command in Edit menu of SALOME desktop
56   //! \param theId - an id of the feature
57   //! \param theTitle - a menu item string
58   //! \param theTip - a tooltip string (help)
59   //! \param theIcon - icon
60   //! \param isCheckable - is checkable or not
61   //! \param theKeys - hot keys
62   //! \param theMenuSourceText - a source text of the desktop menu
63   //! \param theMenuPosition - a position of the command in the desktop menu
64   //! returns created action
65   virtual QAction* addDesktopCommand(const QString& theId, const QString& theTitle,
66                                      const QString& theTip, const QIcon& theIcon,
67                                      const QKeySequence& theKeys, bool isCheckable,
68                                      const char* theMenuSourceText,
69                                      const int theMenuPosition = 10) = 0;
70
71   //! Insert separator into Edit menu of SALOME desktop
72   virtual void addDesktopMenuSeparator(const char* theMenuSourceText,
73                                        const int theMenuPosition = 10) = 0;
74
75   virtual bool addActionInToolbar( QAction* theAction, const QString& theToolBarTitle ) = 0;
76
77   //! Returns desktop window of SALOME
78   virtual QMainWindow* desktop() const = 0;
79
80   //! Returns command string Id by QAction instance
81   virtual QString commandId(const QAction* theCmd) const = 0;
82
83   //! Returns QAction instance by command string Id
84   virtual QAction* command(const QString& theId) const = 0;
85
86   //! Returns list of defined actions (just by NewGeom module)
87   virtual QList<QAction*> commandList() const = 0;
88
89   //! Returns list of Ids of defined actions (just by NewGeom module)
90   virtual QStringList commandIdList() const = 0;
91
92   //! Set nested actions dependent on command Id
93   //! \param theId - the command ID
94   //! \param theActions - the list of nested actions
95   virtual void setNestedActions(const QString& theId, const QStringList& theActions) = 0;
96
97   //! Returns list of nested actions according to the given command ID
98   virtual QStringList nestedActions(const QString& theId) const = 0;
99
100   //! Set the document kind of the action by the given command Id
101   //! \param theId - the command ID
102   //! \param theKind - the document kind
103   virtual void setDocumentKind(const QString& theId, const QString& theKind) = 0;
104
105   //! Returns the document kind of the action by the given command ID
106   virtual QString documentKind(const QString& theId) const = 0;
107
108   //! Returns interface to Salome viewer
109   virtual ModuleBase_IViewer* viewer() const = 0;
110
111   //! Create preferences
112   virtual void createPreferences() = 0;
113 };
114
115 #endif