Salome HOME
Better management of errors.
[modules/shaper.git] / src / XGUI / XGUI_SalomeConnector.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 #ifndef XGUI_SALOMECONNECTOR_H
4 #define XGUI_SALOMECONNECTOR_H
5
6 #include "XGUI.h"
7
8 #include <QString>
9 #include <QStringList>
10
11 #include <ModuleBase_ActionInfo.h>
12
13 class QMainWindow;
14 class Config_FeatureMessage;
15 class ModuleBase_IViewer;
16
17 /**
18  * \ingroup GUI
19  * An interface which provides a connection of XGUI functionality 
20  * with functionality of SALOME module interface.
21  */
22 class XGUI_EXPORT XGUI_SalomeConnector
23 {
24  public:
25   /// Default constructor
26   XGUI_SalomeConnector();
27   /// Virtual destructor
28   virtual ~XGUI_SalomeConnector();
29
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,
42                               const QIcon& theIcon,
43                               const QKeySequence& theKeys, bool isCheckable,
44                               const bool isAddSeparator,
45                               const QString& theStatusTip) = 0;
46
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   virtual QAction* addFeature(const QString& theWBName,
52                               const ActionInfo& theInfo, const bool isAddSeparator) = 0;
53
54   //! Creates a feature (command) in SALOME desktop
55   //! \param theWBName - name of toolbar (workbench)
56   //! \param theInfo - information about action (icon, text, etc)
57   //! \param theNestedActions a list of nested actions
58   virtual QAction* addFeatureOfNested(const QString& theWBName,
59                                       const ActionInfo& theInfo,
60                                       const QList<QAction*>& theNestedActions) = 0;
61
62   //! Returns true if the feature action is a nested action, in other words,
63   //! it is created by addFeatureOfNested().
64   //! \param theAction - an action of a feature
65   //! returns boolean result
66   virtual bool isFeatureOfNested(const QAction* theAction) = 0;
67
68   //! Creates a command in Edit menu of SALOME desktop
69   //! \param theId - an id of the feature
70   //! \param theTitle - a menu item string
71   //! \param theTip - a tooltip string (help)
72   //! \param theIcon - icon
73   //! \param isCheckable - is checkable or not
74   //! \param theKeys - hot keys
75   //! \param theMenuSourceText - a source text of the desktop menu
76   //! \param theMenuPosition - a position of the command in the desktop menu
77   //! returns created action
78   virtual QAction* addDesktopCommand(const QString& theId, const QString& theTitle,
79                                      const QString& theTip, const QIcon& theIcon,
80                                      const QKeySequence& theKeys, bool isCheckable,
81                                      const char* theMenuSourceText,
82                                      const int theMenuPosition = 10) = 0;
83
84   //! Insert separator into Edit menu of SALOME desktop
85   virtual void addDesktopMenuSeparator(const char* theMenuSourceText,
86                                        const int theMenuPosition = 10) = 0;
87
88   /// Add an action into tool bar
89   /// \param theAction the Action object
90   /// \param theToolBarTitle the toolbar name
91   virtual bool addActionInToolbar( QAction* theAction, const QString& theToolBarTitle ) = 0;
92
93   /// Creates menu/tool bar actions for loaded features stored in the menu manager
94   virtual void createFeatureActions() = 0;
95
96   //! Returns desktop window of SALOME
97   virtual QMainWindow* desktop() const = 0;
98
99   //! Returns list of defined actions (just by SHAPER module)
100   virtual QList<QAction*> commandList() const = 0;
101
102   //! Stores XML information for the feature kind
103   //! \param theFeatureId a feature kind
104   //! \param theMessage a container of the feature XML properties
105   virtual void setFeatureInfo(const QString& theFeatureId,
106                               const std::shared_ptr<Config_FeatureMessage>& theMessage) = 0;
107
108   //! Returns XML information for the feature kind
109   //! \param theFeatureId a feature kind
110   //! \return theMessage a container of the feature XML properties
111   virtual std::shared_ptr<Config_FeatureMessage> featureInfo(const QString& theFeatureId) = 0;
112
113   //! Returns interface to Salome viewer
114   virtual ModuleBase_IViewer* viewer() const = 0;
115
116   //! Create preferences
117   virtual void createPreferences() = 0;
118
119   //! Shows the given text in status bar as a permanent text
120   //! \theInfo a string value
121   //! \theMsecs interval of msec milliseconds when the message will be hidden, if -1, it stays.
122   //            If 0, default value is used, it is 3000
123   virtual void putInfo(const QString& theInfo, const int theMSecs = 0) = 0;
124 };
125
126 #endif