]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModuleBase/ModuleBase_IPropertyPanel.h
Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / ModuleBase / ModuleBase_IPropertyPanel.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 email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
18 //
19
20 /*
21  * ModuleBase_IPropertyPanel.h
22  *
23  *  Created on: Oct 01, 2014
24  *      Author: vsv
25  */
26
27 #ifndef ModuleBase_PROPERTYPANEL_H_
28 #define ModuleBase_PROPERTYPANEL_H_
29
30 #include "ModuleBase.h"
31
32 #include <QDockWidget>
33 #include <QKeyEvent>
34
35 class ModuleBase_ModelWidget;
36
37 /**
38 * \ingroup GUI
39 * A class for Property panel object definition
40 */
41 class MODULEBASE_EXPORT ModuleBase_IPropertyPanel : public QDockWidget
42 {
43 Q_OBJECT
44 public:
45   /// Constructor
46   /// \param theParent is a parent of the property panel
47   ModuleBase_IPropertyPanel(QWidget* theParent);
48
49   /// Returns header widget
50   virtual QWidget* headerWidget() const = 0;
51
52   /// Returns currently active widget
53   virtual ModuleBase_ModelWidget* activeWidget() const = 0;
54
55   /// Returns all property panel's widget created by WidgetFactory
56   virtual const QList<ModuleBase_ModelWidget*>& modelWidgets() const = 0;
57
58   /// Returns widget, that has the given attribute index
59   /// \param theAttributeId an attribute from XML
60   virtual ModuleBase_ModelWidget* modelWidget(const std::string& theAttributeId) const;
61
62   /// Removes all widgets in the widget area of the property panel
63   virtual void cleanContent() = 0;
64
65   /// Editing mode depends on mode of current operation. This value is defined by it.
66   /// \param isEditing state of editing mode flag
67   virtual void setEditingMode(bool isEditing) { myIsEditing = isEditing; }
68
69   /// \return State of editing mode flag
70   bool isEditingMode() const { return myIsEditing; }
71
72   /// Set focus on the Ok button
73   virtual void setFocusOnOkButton() = 0;
74
75   /// Set Enable/Disable state of Cancel button
76   /// \param theEnabled Enable/Disable state of Cancel button
77   virtual void setCancelEnabled(bool theEnabled) = 0;
78
79   /// \return Enable/Disable state of Cancel button
80   virtual bool isCancelEnabled() const = 0;
81
82   /// Returns widget processed by preselection
83   virtual ModuleBase_ModelWidget* preselectionWidget() const = 0;
84
85   /// Sets widget processed by preselection
86   virtual void setPreselectionWidget(ModuleBase_ModelWidget* theWidget) = 0;
87
88   /// Returns the first widget, where canAcceptFocus returns true
89   /// \return a widget or null
90   ModuleBase_ModelWidget* findFirstAcceptingValueWidget();
91
92   /// Returns the first widget, where canAcceptFocus returns true
93   /// \return a widget or null
94   static ModuleBase_ModelWidget* findFirstAcceptingValueWidget(
95                           const QList<ModuleBase_ModelWidget*>& theWidgets);
96
97 signals:
98   /// The signal about key release on the control, that corresponds to the attribute
99   /// \param theObject a sender of the event
100   /// \param theEvent key release event
101   void keyReleased(QObject* theObject, QKeyEvent* theEvent);
102
103   /// The signal about the widget activation
104   /// \param theWidget the activated widget
105   void beforeWidgetActivated(ModuleBase_ModelWidget* theWidget);
106
107   /// The signal about the widget activation
108   /// \param theWidget the activated widget
109   void widgetActivated(ModuleBase_ModelWidget* theWidget);
110
111   /// Emited when there is no next widget
112   /// \param thePreviousAttributeID an attribute key of the previous active widget
113   void noMoreWidgets(const std::string& thePreviousAttributeID);
114
115 public slots:
116   /// Activate the next widget in the property panel
117   /// \param theWidget a widget. The next widget should be activated
118   virtual void activateNextWidget(ModuleBase_ModelWidget* theWidget) = 0;
119
120   /// Activate the next from current widget in the property panel
121   virtual void activateNextWidget() = 0;
122
123   /**
124   * Makes the given widget active, highlights it and removes
125   * highlighting from the previous active widget
126   * emits widgetActivated(theWidget) signal
127   * \param theWidget which has to be activated
128   * \param theEmitSignal a flag to prohibit signal emit
129   */
130   virtual void activateWidget(ModuleBase_ModelWidget* theWidget,
131                               const bool theEmitSignal = true) = 0;
132
133 protected:
134
135   /// Flag which shows that current operation is in editing mode
136   bool myIsEditing;
137 };
138
139 #endif