1 // Copyright (C) 2014-2019 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 email : webmaster.salome@opencascade.com
20 #ifndef ModuleBase_PROPERTYPANEL_H_
21 #define ModuleBase_PROPERTYPANEL_H_
23 #include "ModuleBase.h"
25 #include <QDockWidget>
28 class ModuleBase_ModelWidget;
32 * A class for Property panel object definition
34 class MODULEBASE_EXPORT ModuleBase_IPropertyPanel : public QDockWidget
39 /// \param theParent is a parent of the property panel
40 ModuleBase_IPropertyPanel(QWidget* theParent);
42 /// Returns header widget
43 virtual QWidget* headerWidget() const = 0;
45 /// Returns currently active widget. This is a widget from internal container of widgets
46 /// (myWidgets) activated/deactivated by focus in property panel. If parameter is true,
47 /// the method finds firstly the custom widget, after the direct active widget.
48 /// \param isUseCustomWidget boolean state if the custom widget might be a result
49 virtual ModuleBase_ModelWidget* activeWidget(const bool isUseCustomWidget = false) const = 0;
51 /// Returns all property panel's widget created by WidgetFactory
52 virtual const QList<ModuleBase_ModelWidget*>& modelWidgets() const = 0;
54 /// Returns widget, that has the given attribute index
55 /// \param theAttributeId an attribute from XML
56 virtual ModuleBase_ModelWidget* modelWidget(const std::string& theAttributeId) const;
58 /// Removes all widgets in the widget area of the property panel
59 virtual void cleanContent() = 0;
61 /// Editing mode depends on mode of current operation. This value is defined by it.
62 /// \param isEditing state of editing mode flag
63 virtual void setEditingMode(bool isEditing) { myIsEditing = isEditing; }
65 /// \return State of editing mode flag
66 bool isEditingMode() const { return myIsEditing; }
68 /// Set focus on the Ok button
69 virtual void setFocusOnOkButton() = 0;
71 /// Set Enable/Disable state of Cancel button
72 /// \param theEnabled Enable/Disable state of Cancel button
73 virtual void setCancelEnabled(bool theEnabled) = 0;
75 /// \return Enable/Disable state of Cancel button
76 virtual bool isCancelEnabled() const = 0;
78 /// Returns widget processed by preselection
79 virtual ModuleBase_ModelWidget* preselectionWidget() const = 0;
81 /// Sets widget processed by preselection
82 virtual void setPreselectionWidget(ModuleBase_ModelWidget* theWidget) = 0;
84 /// Returns the first widget, where canAcceptFocus returns true
85 /// \return a widget or null
86 ModuleBase_ModelWidget* findFirstAcceptingValueWidget();
88 /// The method is called on accepting of operation
89 virtual void onAcceptData() = 0;
91 /// Returns the first widget, where canAcceptFocus returns true
92 /// \return a widget or null
93 static ModuleBase_ModelWidget* findFirstAcceptingValueWidget(
94 const QList<ModuleBase_ModelWidget*>& theWidgets);
97 /// The signal about key release on the control, that corresponds to the attribute
98 /// \param theObject a sender of the event
99 /// \param theEvent key release event
100 void keyReleased(QObject* theObject, QKeyEvent* theEvent);
102 /// The signal about the widget activation
103 /// \param theWidget the activated widget
104 void beforeWidgetActivated(ModuleBase_ModelWidget* theWidget);
106 /// The signal about the widget activation
107 /// \param theWidget the activated widget
108 //void widgetActivated(ModuleBase_ModelWidget* theWidget);
110 /// Emited when there is no next widget
111 /// \param thePreviousAttributeID an attribute key of the previous active widget
112 void noMoreWidgets(const std::string& thePreviousAttributeID);
115 /// Activate the next widget in the property panel
116 /// \param theWidget a widget. The next widget should be activated
117 virtual void activateNextWidget(ModuleBase_ModelWidget* theWidget) = 0;
119 /// Activate the next from current widget in the property panel
120 virtual void activateNextWidget() = 0;
123 * Makes the given widget active, highlights it and removes
124 * highlighting from the previous active widget
125 * \param theWidget which has to be activated
126 * \param theEmitSignal a flag to prohibit signal emit
128 virtual void activateWidget(ModuleBase_ModelWidget* theWidget,
129 const bool theEmitSignal = true) = 0;
133 /// Flag which shows that current operation is in editing mode