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