1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef ModuleBase_PROPERTYPANEL_H_
22 #define ModuleBase_PROPERTYPANEL_H_
24 #include "ModuleBase.h"
26 #include <QDockWidget>
29 class ModuleBase_ModelWidget;
33 * A class for Property panel object definition
35 class MODULEBASE_EXPORT ModuleBase_IPropertyPanel : public QDockWidget
40 /// \param theParent is a parent of the property panel
41 ModuleBase_IPropertyPanel(QWidget* theParent);
43 /// Returns header widget
44 virtual QWidget* headerWidget() const = 0;
46 /// Returns currently active widget. This is a widget from internal container of widgets
47 /// (myWidgets) activated/deactivated by focus in property panel. If parameter is true,
48 /// the method finds firstly the custom widget, after the direct active widget.
49 /// \param isUseCustomWidget boolean state if the custom widget might be a result
50 virtual ModuleBase_ModelWidget* activeWidget(const bool isUseCustomWidget = false) const = 0;
52 /// Returns all property panel's widget created by WidgetFactory
53 virtual const QList<ModuleBase_ModelWidget*>& modelWidgets() const = 0;
55 /// Returns widget, that has the given attribute index
56 /// \param theAttributeId an attribute from XML
57 virtual ModuleBase_ModelWidget* modelWidget(const std::string& theAttributeId) const;
59 /// Removes all widgets in the widget area of the property panel
60 virtual void cleanContent() = 0;
62 /// Editing mode depends on mode of current operation. This value is defined by it.
63 /// \param isEditing state of editing mode flag
64 virtual void setEditingMode(bool isEditing) { myIsEditing = isEditing; }
66 /// \return State of editing mode flag
67 bool isEditingMode() const { return myIsEditing; }
69 /// Set focus on the Ok button
70 virtual void setFocusOnOkButton() = 0;
72 /// Set Enable/Disable state of Cancel button
73 /// \param theEnabled Enable/Disable state of Cancel button
74 virtual void setCancelEnabled(bool theEnabled) = 0;
76 /// \return Enable/Disable state of Cancel button
77 virtual bool isCancelEnabled() const = 0;
79 /// Returns widget processed by preselection
80 virtual ModuleBase_ModelWidget* preselectionWidget() const = 0;
82 /// Sets widget processed by preselection
83 virtual void setPreselectionWidget(ModuleBase_ModelWidget* theWidget) = 0;
85 /// Returns the first widget, where canAcceptFocus returns true
86 /// \return a widget or null
87 ModuleBase_ModelWidget* findFirstAcceptingValueWidget();
89 /// The method is called on accepting of operation
90 virtual void onAcceptData() = 0;
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);
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);
103 /// The signal about the widget activation
104 /// \param theWidget the activated widget
105 void beforeWidgetActivated(ModuleBase_ModelWidget* theWidget);
107 /// The signal about the widget activation
108 /// \param theWidget the activated widget
109 //void widgetActivated(ModuleBase_ModelWidget* theWidget);
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);
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;
120 /// Activate the next from current widget in the property panel
121 virtual void activateNextWidget() = 0;
124 * Makes the given widget active, highlights it and removes
125 * highlighting from the previous active widget
126 * \param theWidget which has to be activated
127 * \param theEmitSignal a flag to prohibit signal emit
129 virtual void activateWidget(ModuleBase_ModelWidget* theWidget,
130 const bool theEmitSignal = true) = 0;
134 /// Flag which shows that current operation is in editing mode