Salome HOME
Issue #2830: Compilation bug fix
[modules/shaper.git] / src / XGUI / XGUI_SalomeConnector.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef XGUI_SALOMECONNECTOR_H
22 #define XGUI_SALOMECONNECTOR_H
23
24 #include "XGUI.h"
25
26 #include <QString>
27 #include <QStringList>
28
29 #include <ModuleBase_ActionInfo.h>
30
31 class QMainWindow;
32 class Config_FeatureMessage;
33 class ModuleBase_IViewer;
34
35 /**
36  * \ingroup GUI
37  * An interface which provides a connection of XGUI functionality
38  * with functionality of SALOME module interface.
39  */
40 class XGUI_EXPORT XGUI_SalomeConnector
41 {
42  public:
43   /// Default constructor
44   XGUI_SalomeConnector();
45   /// Virtual destructor
46   virtual ~XGUI_SalomeConnector();
47
48   //! Creates a feature (command) in SALOME desktop
49   //! \param theWBName - a workbench name
50   //! \param theTBName - a toolbar name
51   //! \param theId - an id of the feature
52   //! \param theTitle - a menu item string
53   //! \param theTip - a tooltip string (help)
54   //! \param theIcon - icon
55   //! \param isCheckable - is checkable or not
56   //! \param theKeys - hot keys
57   //! \param isAddSeparator boolean flag about adding separator after the action
58   //! returns created action
59   virtual QAction* addFeature(const QString& theWBName, const QString& theTBName,
60                               const QString& theId,
61                               const QString& theTitle, const QString& theTip,
62                               const QIcon& theIcon,
63                               const QKeySequence& theKeys, bool isCheckable,
64                               const bool isAddSeparator,
65                               const QString& theStatusTip) = 0;
66
67   //! Creates a feature (command) in SALOME desktop
68   //! \param theWBName - name of toolbar (workbench)
69   //! \param theInfo - information about action (icon, text, etc)
70   //! \param isAddSeparator boolean flag about adding separator after the action
71   virtual QAction* addFeature(const QString& theWBName,
72                               const ActionInfo& theInfo, const bool isAddSeparator) = 0;
73
74   //! Creates a feature (command) in SALOME desktop
75   //! \param theWBName - name of toolbar (workbench)
76   //! \param theInfo - information about action (icon, text, etc)
77   //! \param theNestedActions a list of nested actions
78   virtual QAction* addFeatureOfNested(const QString& theWBName,
79                                       const ActionInfo& theInfo,
80                                       const QList<QAction*>& theNestedActions) = 0;
81
82   //! Returns true if the feature action is a nested action, in other words,
83   //! it is created by addFeatureOfNested().
84   //! \param theAction - an action of a feature
85   //! returns boolean result
86   virtual bool isFeatureOfNested(const QAction* theAction) = 0;
87
88   //! Creates a command in Edit menu of SALOME desktop
89   //! \param theId - an id of the feature
90   //! \param theTitle - a menu item string
91   //! \param theTip - a tooltip string (help)
92   //! \param theIcon - icon
93   //! \param isCheckable - is checkable or not
94   //! \param theKeys - hot keys
95   //! \param theMenuSourceText - a source text of the desktop menu
96   //! \param theMenuPosition - a position of the command in the desktop menu
97   //! returns created action
98   virtual QAction* addDesktopCommand(const QString& theId, const QString& theTitle,
99                                      const QString& theTip, const QIcon& theIcon,
100                                      const QKeySequence& theKeys, bool isCheckable,
101                                      const char* theMenuSourceText,
102                                      const int theMenuPosition = 10) = 0;
103
104   //! Insert separator into Edit menu of SALOME desktop
105   virtual void addDesktopMenuSeparator(const char* theMenuSourceText,
106                                        const int theMenuPosition = 10) = 0;
107
108   /// Add an action into tool bar
109   /// \param theAction the Action object
110   /// \param theToolBarTitle the toolbar name
111   virtual bool addActionInToolbar( QAction* theAction, const QString& theToolBarTitle ) = 0;
112
113   /// Creates menu/tool bar actions for loaded features stored in the menu manager
114   virtual void createFeatureActions() = 0;
115
116   //! Returns desktop window of SALOME
117   virtual QMainWindow* desktop() const = 0;
118
119   //! Returns list of defined actions (just by SHAPER module)
120   virtual QList<QAction*> commandList() const = 0;
121
122   //! Stores XML information for the feature kind
123   //! \param theFeatureId a feature kind
124   //! \param theMessage a container of the feature XML properties
125   virtual void setFeatureInfo(const QString& theFeatureId,
126                               const std::shared_ptr<Config_FeatureMessage>& theMessage) = 0;
127
128   //! Returns XML information for the feature kind
129   //! \param theFeatureId a feature kind
130   //! \return theMessage a container of the feature XML properties
131   virtual std::shared_ptr<Config_FeatureMessage> featureInfo(const QString& theFeatureId) = 0;
132
133   //! Returns interface to Salome viewer
134   virtual ModuleBase_IViewer* viewer() const = 0;
135
136   //! Create preferences
137   virtual void createPreferences() = 0;
138
139   //! Shows the given text in status bar as a permanent text
140   //! \theInfo a string value
141   //! \theMsecs interval of msec milliseconds when the message will be hidden, if -1, it stays.
142   //            If 0, default value is used, it is 3000
143   virtual void putInfo(const QString& theInfo, const int theMSecs = 0) = 0;
144 };
145
146 #endif