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 email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 * ModuleBase_IPropertyPanel.h
23 * Created on: Oct 01, 2014
27 #ifndef ModuleBase_PROPERTYPANEL_H_
28 #define ModuleBase_PROPERTYPANEL_H_
30 #include "ModuleBase.h"
32 #include <QDockWidget>
35 class ModuleBase_ModelWidget;
39 * A class for Property panel object definition
41 class MODULEBASE_EXPORT ModuleBase_IPropertyPanel : public QDockWidget
46 /// \param theParent is a parent of the property panel
47 ModuleBase_IPropertyPanel(QWidget* theParent);
49 /// Returns header widget
50 virtual QWidget* headerWidget() const = 0;
52 /// Returns currently active widget
53 virtual ModuleBase_ModelWidget* activeWidget() const = 0;
55 /// Returns all property panel's widget created by WidgetFactory
56 virtual const QList<ModuleBase_ModelWidget*>& modelWidgets() const = 0;
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;
62 /// Removes all widgets in the widget area of the property panel
63 virtual void cleanContent() = 0;
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; }
69 /// \return State of editing mode flag
70 bool isEditingMode() const { return myIsEditing; }
72 /// Set focus on the Ok button
73 virtual void setFocusOnOkButton() = 0;
75 /// Set Enable/Disable state of Cancel button
76 /// \param theEnabled Enable/Disable state of Cancel button
77 virtual void setCancelEnabled(bool theEnabled) = 0;
79 /// \return Enable/Disable state of Cancel button
80 virtual bool isCancelEnabled() const = 0;
82 /// Returns widget processed by preselection
83 virtual ModuleBase_ModelWidget* preselectionWidget() const = 0;
85 /// Sets widget processed by preselection
86 virtual void setPreselectionWidget(ModuleBase_ModelWidget* theWidget) = 0;
88 /// Returns the first widget, where canAcceptFocus returns true
89 /// \return a widget or null
90 ModuleBase_ModelWidget* findFirstAcceptingValueWidget();
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 * emits widgetActivated(theWidget) signal
127 * \param theWidget which has to be activated
128 * \param theEmitSignal a flag to prohibit signal emit
130 virtual void activateWidget(ModuleBase_ModelWidget* theWidget,
131 const bool theEmitSignal = true) = 0;
135 /// Flag which shows that current operation is in editing mode