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 Config_FeatureMessage;
15 class ModuleBase_IViewer;
19 * An interface which provides a connection of XGUI functionality
20 * with functionality of SALOME module interface.
22 class XGUI_EXPORT XGUI_SalomeConnector
25 /// Default constructor
26 XGUI_SalomeConnector();
27 /// Virtual destructor
28 virtual ~XGUI_SalomeConnector();
30 //! Creates a feature (command) in SALOME desktop
31 //! \param theWBName - a workbench name
32 //! \param theId - an id of the feature
33 //! \param theTitle - a menu item string
34 //! \param theTip - a tooltip string (help)
35 //! \param theIcon - icon
36 //! \param isCheckable - is checkable or not
37 //! \param theKeys - hot keys
38 //! \param isAddSeparator boolean flag about adding separator after the action
39 //! \param isMenuAction boolean flag about adding the action to application menu bar
40 //! \param isToolAction boolean flag about adding the action to application tool bar
41 //! returns created action
42 virtual QAction* addFeature(const QString& theWBName, const QString& theId,
43 const QString& theTitle, const QString& theTip, const QIcon& theIcon,
44 const QKeySequence& theKeys, bool isCheckable, const bool isAddSeparator,
45 bool isMenuAction = true, bool isToolAction = true) = 0;
47 //! Creates a feature (command) in SALOME desktop
48 //! \param theWBName - name of toolbar (workbench)
49 //! \param theInfo - information about action (icon, text, etc)
50 //! \param isAddSeparator boolean flag about adding separator after the action
51 //! \param isMenuAction boolean flag about adding the action to application menu bar
52 //! \param isToolAction boolean flag about adding the action to application tool bar
53 virtual QAction* addFeature(const QString& theWBName,
54 const ActionInfo& theInfo, const bool isAddSeparator,
55 bool isMenuAction = true, bool isToolAction = true) = 0;
57 //! Creates a feature (command) in SALOME desktop
58 //! \param theWBName - name of toolbar (workbench)
59 //! \param theInfo - information about action (icon, text, etc)
60 //! \param theNestedActions a list of nested actions
61 //! \param isMenuAction boolean flag about adding the action to application menu bar
62 //! \param isToolAction boolean flag about adding the action to application tool bar
63 virtual QAction* addFeatureOfNested(const QString& theWBName,
64 const ActionInfo& theInfo,
65 const QList<QAction*>& theNestedActions,
66 bool isMenuAction = true, bool isToolAction = true) = 0;
68 //! Returns true if the feature action is a nested action, in other words,
69 //! it is created by addFeatureOfNested().
70 //! \param theAction - an action of a feature
71 //! returns boolean result
72 virtual bool isFeatureOfNested(const QAction* theAction) = 0;
74 //! Creates a command in Edit menu of SALOME desktop
75 //! \param theId - an id of the feature
76 //! \param theTitle - a menu item string
77 //! \param theTip - a tooltip string (help)
78 //! \param theIcon - icon
79 //! \param isCheckable - is checkable or not
80 //! \param theKeys - hot keys
81 //! \param theMenuSourceText - a source text of the desktop menu
82 //! \param theMenuPosition - a position of the command in the desktop menu
83 //! returns created action
84 virtual QAction* addDesktopCommand(const QString& theId, const QString& theTitle,
85 const QString& theTip, const QIcon& theIcon,
86 const QKeySequence& theKeys, bool isCheckable,
87 const char* theMenuSourceText,
88 const int theMenuPosition = 10) = 0;
90 //! Insert separator into Edit menu of SALOME desktop
91 virtual void addDesktopMenuSeparator(const char* theMenuSourceText,
92 const int theMenuPosition = 10) = 0;
94 /// Add an action into tool bar
95 /// \param theAction the Action object
96 /// \param theToolBarTitle the toolbar name
97 virtual bool addActionInToolbar( QAction* theAction, const QString& theToolBarTitle ) = 0;
99 /// Creates menu/tool bar actions for loaded features stored in the menu manager
100 virtual void createFeatureActions() = 0;
102 //! Returns desktop window of SALOME
103 virtual QMainWindow* desktop() const = 0;
105 //! Returns command string Id by QAction instance
106 virtual QString commandId(const QAction* theCmd) const = 0;
108 //! Returns QAction instance by command string Id
109 virtual QAction* command(const QString& theId) const = 0;
111 //! Returns list of defined actions (just by SHAPER module)
112 virtual QList<QAction*> commandList() const = 0;
114 //! Returns list of Ids of defined actions (just by NewGeom module)
115 virtual QStringList commandIdList() const = 0;
117 //! Stores XML information for the feature kind
118 //! \param theFeatureId a feature kind
119 //! \param theMessage a container of the feature XML properties
120 virtual void setFeatureInfo(const QString& theFeatureId,
121 const std::shared_ptr<Config_FeatureMessage>& theMessage) = 0;
123 //! Returns XML information for the feature kind
124 //! \param theFeatureId a feature kind
125 //! \return theMessage a container of the feature XML properties
126 virtual std::shared_ptr<Config_FeatureMessage> featureInfo(const QString& theFeatureId) = 0;
128 //! Returns interface to Salome viewer
129 virtual ModuleBase_IViewer* viewer() const = 0;
131 //! Create preferences
132 virtual void createPreferences() = 0;