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 /// Default constructor
25 XGUI_SalomeConnector();
26 /// Virtual destructor
27 virtual ~XGUI_SalomeConnector();
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;
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;
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* addFeatureOfNested(const QString& theWBName,
52 const ActionInfo& theInfo,
53 const QList<QAction*>& theNestedActions) = 0;
55 //! Returns true if the feature action is a nested action, in other words,
56 //! it is created by addFeatureOfNested().
57 //! \param theId - an action of a feature
58 //! returns boolean result
59 virtual bool isFeatureOfNested(const QAction* theAction) = 0;
61 //! Creates a command in Edit menu of SALOME desktop
62 //! \param theId - an id of the feature
63 //! \param theTitle - a menu item string
64 //! \param theTip - a tooltip string (help)
65 //! \param theIcon - icon
66 //! \param isCheckable - is checkable or not
67 //! \param theKeys - hot keys
68 //! \param theMenuSourceText - a source text of the desktop menu
69 //! \param theMenuPosition - a position of the command in the desktop menu
70 //! returns created action
71 virtual QAction* addDesktopCommand(const QString& theId, const QString& theTitle,
72 const QString& theTip, const QIcon& theIcon,
73 const QKeySequence& theKeys, bool isCheckable,
74 const char* theMenuSourceText,
75 const int theMenuPosition = 10) = 0;
77 //! Insert separator into Edit menu of SALOME desktop
78 virtual void addDesktopMenuSeparator(const char* theMenuSourceText,
79 const int theMenuPosition = 10) = 0;
81 virtual bool addActionInToolbar( QAction* theAction, const QString& theToolBarTitle ) = 0;
83 //! Returns desktop window of SALOME
84 virtual QMainWindow* desktop() const = 0;
86 //! Returns command string Id by QAction instance
87 virtual QString commandId(const QAction* theCmd) const = 0;
89 //! Returns QAction instance by command string Id
90 virtual QAction* command(const QString& theId) const = 0;
92 //! Returns list of defined actions (just by NewGeom module)
93 virtual QList<QAction*> commandList() const = 0;
95 //! Returns list of Ids of defined actions (just by NewGeom module)
96 virtual QStringList commandIdList() const = 0;
98 //! Set nested actions dependent on command Id
99 //! \param theId - the command ID
100 //! \param theActions - the list of nested actions
101 virtual void setNestedActions(const QString& theId, const QStringList& theActions) = 0;
103 //! Returns list of nested actions according to the given command ID
104 virtual QStringList nestedActions(const QString& theId) const = 0;
106 //! Set the document kind of the action by the given command Id
107 //! \param theId - the command ID
108 //! \param theKind - the document kind
109 virtual void setDocumentKind(const QString& theId, const QString& theKind) = 0;
111 //! Returns the document kind of the action by the given command ID
112 virtual QString documentKind(const QString& theId) const = 0;
114 //! Returns interface to Salome viewer
115 virtual ModuleBase_IViewer* viewer() const = 0;
117 //! Create preferences
118 virtual void createPreferences() = 0;