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,
43 const QString& theStatusTip) = 0;
45 //! Creates a feature (command) in SALOME desktop
46 //! \param theWBName - name of toolbar (workbench)
47 //! \param theInfo - information about action (icon, text, etc)
48 //! \param isAddSeparator boolean flag about adding separator after the action
49 virtual QAction* addFeature(const QString& theWBName,
50 const ActionInfo& theInfo, const bool isAddSeparator) = 0;
52 //! Creates a feature (command) in SALOME desktop
53 //! \param theWBName - name of toolbar (workbench)
54 //! \param theInfo - information about action (icon, text, etc)
55 //! \param theNestedActions a list of nested actions
56 virtual QAction* addFeatureOfNested(const QString& theWBName,
57 const ActionInfo& theInfo,
58 const QList<QAction*>& theNestedActions) = 0;
60 //! Returns true if the feature action is a nested action, in other words,
61 //! it is created by addFeatureOfNested().
62 //! \param theAction - an action of a feature
63 //! returns boolean result
64 virtual bool isFeatureOfNested(const QAction* theAction) = 0;
66 //! Creates a command in Edit menu of SALOME desktop
67 //! \param theId - an id of the feature
68 //! \param theTitle - a menu item string
69 //! \param theTip - a tooltip string (help)
70 //! \param theIcon - icon
71 //! \param isCheckable - is checkable or not
72 //! \param theKeys - hot keys
73 //! \param theMenuSourceText - a source text of the desktop menu
74 //! \param theMenuPosition - a position of the command in the desktop menu
75 //! returns created action
76 virtual QAction* addDesktopCommand(const QString& theId, const QString& theTitle,
77 const QString& theTip, const QIcon& theIcon,
78 const QKeySequence& theKeys, bool isCheckable,
79 const char* theMenuSourceText,
80 const int theMenuPosition = 10) = 0;
82 //! Insert separator into Edit menu of SALOME desktop
83 virtual void addDesktopMenuSeparator(const char* theMenuSourceText,
84 const int theMenuPosition = 10) = 0;
86 /// Add an action into tool bar
87 /// \param theAction the Action object
88 /// \param theToolBarTitle the toolbar name
89 virtual bool addActionInToolbar( QAction* theAction, const QString& theToolBarTitle ) = 0;
91 /// Creates menu/tool bar actions for loaded features stored in the menu manager
92 virtual void createFeatureActions() = 0;
94 //! Returns desktop window of SALOME
95 virtual QMainWindow* desktop() const = 0;
97 //! Returns list of defined actions (just by SHAPER module)
98 virtual QList<QAction*> commandList() const = 0;
100 //! Stores XML information for the feature kind
101 //! \param theFeatureId a feature kind
102 //! \param theMessage a container of the feature XML properties
103 virtual void setFeatureInfo(const QString& theFeatureId,
104 const std::shared_ptr<Config_FeatureMessage>& theMessage) = 0;
106 //! Returns XML information for the feature kind
107 //! \param theFeatureId a feature kind
108 //! \return theMessage a container of the feature XML properties
109 virtual std::shared_ptr<Config_FeatureMessage> featureInfo(const QString& theFeatureId) = 0;
111 //! Returns interface to Salome viewer
112 virtual ModuleBase_IViewer* viewer() const = 0;
114 //! Create preferences
115 virtual void createPreferences() = 0;
117 //! Shows the given text in status bar as a permanent text
118 //! \theInfo a string value
119 //! \theMsecs interval of msec milliseconds when the message will be hidden, if -1, it stays.
120 // If 0, default value is used, it is 3000
121 virtual void putInfo(const QString& theInfo, const int theMSecs = 0) = 0;