1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 #ifndef XGUI_SALOMECONNECTOR_H
4 #define XGUI_SALOMECONNECTOR_H
11 #include <ModuleBase_ActionInfo.h>
14 class ModuleBase_IViewer;
18 * An interface which provides a connection of XGUI functionality
19 * with functionality of SALOME module interface.
21 class XGUI_EXPORT XGUI_SalomeConnector
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;
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;
43 //! Creates a command in Edit menu of SALOME desktop
44 //! \param theId - an id of the feature
45 //! \param theTitle - a menu item string
46 //! \param theTip - a tooltip string (help)
47 //! \param theIcon - icon
48 //! \param isCheckable - is checkable or not
49 //! \param theKeys - hot keys
50 //! \param theMenuSourceText - a source text of the desktop menu
51 //! \param theMenuPosition - a position of the command in the desktop menu
52 //! returns created action
53 virtual QAction* addDesktopCommand(const QString& theId, const QString& theTitle,
54 const QString& theTip, const QIcon& theIcon,
55 const QKeySequence& theKeys, bool isCheckable,
56 const char* theMenuSourceText,
57 const int theMenuPosition = 10) = 0;
59 //! Insert separator into Edit menu of SALOME desktop
60 virtual void addDesktopMenuSeparator(const char* theMenuSourceText,
61 const int theMenuPosition = 10) = 0;
63 //! Returns desktop window of SALOME
64 virtual QMainWindow* desktop() const = 0;
66 //! Returns command string Id by QAction instance
67 virtual QString commandId(const QAction* theCmd) const = 0;
69 //! Returns QAction instance by command string Id
70 virtual QAction* command(const QString& theId) const = 0;
72 //! Returns list of defined actions (just by NewGeom module)
73 virtual QList<QAction*> commandList() const = 0;
75 //! Returns list of Ids of defined actions (just by NewGeom module)
76 virtual QStringList commandIdList() const = 0;
78 //! Set nested actions dependent on command Id
79 //! \param theId - the command ID
80 //! \param theActions - the list of nested actions
81 virtual void setNestedActions(const QString& theId, const QStringList& theActions) = 0;
83 //! Returns list of nested actions according to the given command ID
84 virtual QStringList nestedActions(const QString& theId) const = 0;
86 //! Set the document kind of the action by the given command Id
87 //! \param theId - the command ID
88 //! \param theKind - the document kind
89 virtual void setDocumentKind(const QString& theId, const QString& theKind) = 0;
91 //! Returns the document kind of the action by the given command ID
92 virtual QString documentKind(const QString& theId) const = 0;
94 //! Returns interface to Salome viewer
95 virtual ModuleBase_IViewer* viewer() const = 0;
97 //! Create preferences
98 virtual void createPreferences() = 0;