Salome HOME
Issue #1015: The validate icon must be greyed and inactive instead of red and active
[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, const QIcon& theIcon,
42                               const QKeySequence& theKeys, bool isCheckable, const bool isAddSeparator) = 0;
43
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;
50
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;
58
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;
64
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;
80
81   //! Insert separator into Edit menu of SALOME desktop
82   virtual void addDesktopMenuSeparator(const char* theMenuSourceText,
83                                        const int theMenuPosition = 10) = 0;
84
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;
89
90   /// Creates menu/tool bar actions for loaded features stored in the menu manager
91   virtual void createFeatureActions() = 0;
92
93   //! Returns desktop window of SALOME
94   virtual QMainWindow* desktop() const = 0;
95
96   //! Returns list of defined actions (just by SHAPER module)
97   virtual QList<QAction*> commandList() const = 0;
98
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;
104
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;
109
110   //! Returns interface to Salome viewer
111   virtual ModuleBase_IViewer* viewer() const = 0;
112
113   //! Create preferences
114   virtual void createPreferences() = 0;
115
116   //! Shows the given text in status bar as a permanent text
117   //! \theInfo a string value
118   //! \theMsecs interval of msec milliseconds when the message will be hidden, if -1, it stays.
119   //            If 0, default value is used, it is 3000
120   virtual void putInfo(const QString& theInfo, const int theMSecs = 0) = 0;
121 };
122
123 #endif