X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FModuleBase%2FModuleBase_IPropertyPanel.h;h=a5b0c017cd5e9040b3257c7085ce313b8c13c02e;hb=63d86e00e1e6a482fcad527ae0b883deccceed11;hp=fdac20d135efb252e1fbd54b82a3ac17938d5fc5;hpb=2d7d83dc1d1a31a8bf6952b1fc6e11b681551cfb;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_IPropertyPanel.h b/src/ModuleBase/ModuleBase_IPropertyPanel.h index fdac20d13..a5b0c017c 100644 --- a/src/ModuleBase/ModuleBase_IPropertyPanel.h +++ b/src/ModuleBase/ModuleBase_IPropertyPanel.h @@ -1,11 +1,21 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -/* - * ModuleBase_IPropertyPanel.h - * - * Created on: Oct 01, 2014 - * Author: vsv - */ +// Copyright (C) 2014-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// #ifndef ModuleBase_PROPERTYPANEL_H_ #define ModuleBase_PROPERTYPANEL_H_ @@ -17,45 +27,92 @@ class ModuleBase_ModelWidget; +/** +* \ingroup GUI +* A class for Property panel object definition +*/ class MODULEBASE_EXPORT ModuleBase_IPropertyPanel : public QDockWidget { Q_OBJECT public: - ModuleBase_IPropertyPanel(QWidget* theParent) : QDockWidget(theParent), myIsEditing(false) {} + /// Constructor + /// \param theParent is a parent of the property panel + ModuleBase_IPropertyPanel(QWidget* theParent); + + /// Returns header widget + virtual QWidget* headerWidget() const = 0; - /// Returns currently active widget - virtual ModuleBase_ModelWidget* activeWidget() const = 0; + /// Returns currently active widget. This is a widget from internal container of widgets + /// (myWidgets) activated/deactivated by focus in property panel. If parameter is true, + /// the method finds firstly the custom widget, after the direct active widget. + /// \param isUseCustomWidget boolean state if the custom widget might be a result + virtual ModuleBase_ModelWidget* activeWidget(const bool isUseCustomWidget = false) const = 0; /// Returns all property panel's widget created by WidgetFactory virtual const QList& modelWidgets() const = 0; + /// Returns widget, that has the given attribute index + /// \param theAttributeId an attribute from XML + virtual ModuleBase_ModelWidget* modelWidget(const std::string& theAttributeId) const; + + /// Removes all widgets in the widget area of the property panel + virtual void cleanContent() = 0; + /// Editing mode depends on mode of current operation. This value is defined by it. - void setEditingMode(bool isEditing) { myIsEditing = isEditing; } - bool isEditingMode() const { return myIsEditing; } + /// \param isEditing state of editing mode flag + virtual void setEditingMode(bool isEditing) { myIsEditing = isEditing; } - /// Set Enable/Disable state of Ok button - virtual void setOkEnabled(bool theEnabled) = 0; + /// \return State of editing mode flag + bool isEditingMode() const { return myIsEditing; } - /// Returns state of Ok button - virtual bool isOkEnabled() const = 0; + /// Set focus on the Ok button + virtual void setFocusOnOkButton() = 0; - /// Set Enable/Disable state of Ok button + /// Set Enable/Disable state of Cancel button + /// \param theEnabled Enable/Disable state of Cancel button virtual void setCancelEnabled(bool theEnabled) = 0; - /// Returns state of Ok button + /// \return Enable/Disable state of Cancel button virtual bool isCancelEnabled() const = 0; + /// Returns widget processed by preselection + virtual ModuleBase_ModelWidget* preselectionWidget() const = 0; + + /// Sets widget processed by preselection + virtual void setPreselectionWidget(ModuleBase_ModelWidget* theWidget) = 0; + + /// Returns the first widget, where canAcceptFocus returns true + /// \return a widget or null + ModuleBase_ModelWidget* findFirstAcceptingValueWidget(); + + /// The method is called on accepting of operation + virtual void onAcceptData() = 0; + + /// Returns True if data of its feature was modified during operation + virtual bool isModified() const; + + /// Returns the first widget, where canAcceptFocus returns true + /// \return a widget or null + static ModuleBase_ModelWidget* findFirstAcceptingValueWidget( + const QList& theWidgets); + signals: /// The signal about key release on the control, that corresponds to the attribute + /// \param theObject a sender of the event /// \param theEvent key release event - void keyReleased(QKeyEvent* theEvent); + void keyReleased(QObject* theObject, QKeyEvent* theEvent); /// The signal about the widget activation /// \param theWidget the activated widget - void widgetActivated(ModuleBase_ModelWidget* theWidget); + void beforeWidgetActivated(ModuleBase_ModelWidget* theWidget); + + /// The signal about the widget activation + /// \param theWidget the activated widget + //void widgetActivated(ModuleBase_ModelWidget* theWidget); /// Emited when there is no next widget - void noMoreWidgets(); + /// \param thePreviousAttributeID an attribute key of the previous active widget + void noMoreWidgets(const std::string& thePreviousAttributeID); public slots: /// Activate the next widget in the property panel @@ -65,12 +122,18 @@ public slots: /// Activate the next from current widget in the property panel virtual void activateNextWidget() = 0; - // Makes the given widget active, highlights it and removes - // highlighting from the previous active widget - // emits widgetActivated(theWidget) signal - virtual void activateWidget(ModuleBase_ModelWidget* theWidget) = 0; + /** + * Makes the given widget active, highlights it and removes + * highlighting from the previous active widget + * \param theWidget which has to be activated + * \param theEmitSignal a flag to prohibit signal emit + */ + virtual void activateWidget(ModuleBase_ModelWidget* theWidget, + const bool theEmitSignal = true) = 0; protected: + + /// Flag which shows that current operation is in editing mode bool myIsEditing; };