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 //! returns created action
40 virtual QAction* addFeature(const QString& theWBName, const QString& theId,
41 const QString& theTitle, const QString& theTip, const QIcon& theIcon,
42 const QKeySequence& theKeys, bool isCheckable, const bool isAddSeparator) = 0;
44 //! Creates a feature (command) in SALOME desktop
45 //! \param theWBName - name of toolbar (workbench)
46 //! \param theInfo - information about action (icon, text, etc)
47 //! \param isAddSeparator boolean flag about adding separator after the action
48 virtual QAction* addFeature(const QString& theWBName,
49 const ActionInfo& theInfo, const bool isAddSeparator) = 0;
51 //! Creates a feature (command) in SALOME desktop
52 //! \param theWBName - name of toolbar (workbench)
53 //! \param theInfo - information about action (icon, text, etc)
54 //! \param theNestedActions a list of nested actions
55 virtual QAction* addFeatureOfNested(const QString& theWBName,
56 const ActionInfo& theInfo,
57 const QList<QAction*>& theNestedActions) = 0;
59 //! Returns true if the feature action is a nested action, in other words,
60 //! it is created by addFeatureOfNested().
61 //! \param theAction - an action of a feature
62 //! returns boolean result
63 virtual bool isFeatureOfNested(const QAction* theAction) = 0;
65 //! Creates a command in Edit menu of SALOME desktop
66 //! \param theId - an id of the feature
67 //! \param theTitle - a menu item string
68 //! \param theTip - a tooltip string (help)
69 //! \param theIcon - icon
70 //! \param isCheckable - is checkable or not
71 //! \param theKeys - hot keys
72 //! \param theMenuSourceText - a source text of the desktop menu
73 //! \param theMenuPosition - a position of the command in the desktop menu
74 //! returns created action
75 virtual QAction* addDesktopCommand(const QString& theId, const QString& theTitle,
76 const QString& theTip, const QIcon& theIcon,
77 const QKeySequence& theKeys, bool isCheckable,
78 const char* theMenuSourceText,
79 const int theMenuPosition = 10) = 0;
81 //! Insert separator into Edit menu of SALOME desktop
82 virtual void addDesktopMenuSeparator(const char* theMenuSourceText,
83 const int theMenuPosition = 10) = 0;
85 /// Add an action into tool bar
86 /// \param theAction the Action object
87 /// \param theToolBarTitle the toolbar name
88 virtual bool addActionInToolbar( QAction* theAction, const QString& theToolBarTitle ) = 0;
90 /// Creates menu/tool bar actions for loaded features stored in the menu manager
91 virtual void createFeatureActions() = 0;
93 //! Returns desktop window of SALOME
94 virtual QMainWindow* desktop() const = 0;
96 //! Returns list of defined actions (just by SHAPER module)
97 virtual QList<QAction*> commandList() const = 0;
99 //! Stores XML information for the feature kind
100 //! \param theFeatureId a feature kind
101 //! \param theMessage a container of the feature XML properties
102 virtual void setFeatureInfo(const QString& theFeatureId,
103 const std::shared_ptr<Config_FeatureMessage>& theMessage) = 0;
105 //! Returns XML information for the feature kind
106 //! \param theFeatureId a feature kind
107 //! \return theMessage a container of the feature XML properties
108 virtual std::shared_ptr<Config_FeatureMessage> featureInfo(const QString& theFeatureId) = 0;
110 //! Returns interface to Salome viewer
111 virtual ModuleBase_IViewer* viewer() const = 0;
113 //! Create preferences
114 virtual void createPreferences() = 0;