SHAPER  9.12.0
ModuleBase_WidgetFeatureSelector.h
1 // Copyright (C) 2014-2023 CEA, EDF
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
18 //
19 
20 #ifndef ModuleBase_WidgetFeatureSelector_H
21 #define ModuleBase_WidgetFeatureSelector_H
22 
23 #include "ModuleBase.h"
24 #include "ModuleBase_WidgetSelector.h"
25 
26 class Config_WidgetAPI;
27 class QWidget;
28 class QLabel;
29 class QLineEdit;
30 
48 {
49 Q_OBJECT
50  public:
51 
57  const Config_WidgetAPI* theData);
58 
60 
67  virtual bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
68  const bool theToValidate);
69 
73  virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes);
74 
77  virtual QList<QWidget*> getControls() const;
78 
81  virtual bool setSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
82 
83 protected:
85  virtual void activateCustom();
86 
89  virtual bool storeValueCustom();
90 
91  virtual bool restoreValueCustom();
92 
94  virtual void updateSelectionName();
95 
96  // Update focus after the attribute value change
97  virtual void updateFocus();
98 
102  virtual bool isValidInFilters(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
103 
106  virtual void updateOnSelectionChanged(const bool theDone);
107 
108 protected:
110  virtual bool processSelection();
111 
112  //----------- Class members -------------
113 protected:
116 
119 };
120 
121 #endif
Provides low-level API for WidgetFactory for reading xml definitions of widgets.
Definition: Config_WidgetAPI.h:46
Class which provides access to Workshop object services.
Definition: ModuleBase_IWorkshop.h:48
virtual void selectionModes(int &theModuleSelectionModes, QIntList &theModes)
Fills given container with selection modes if the widget has it.
Definition: ModuleBase_ModelWidget.cpp:116
virtual void activateCustom()
The method called when widget is activated.
Definition: ModuleBase_ModelWidget.h:410
virtual bool processSelection()
Returns true if envent is processed. It applyes workshop selection for the widget attribute.
Definition: ModuleBase_ModelWidget.cpp:515
virtual QList< QWidget * > getControls() const =0
Returns list of widget controls.
virtual bool setSelection(QList< std::shared_ptr< ModuleBase_ViewerPrs >> &theValues, const bool theToValidate)
Set the given wrapped value to the current widget This value should be processed in the widget accord...
Definition: ModuleBase_ModelWidget.h:163
virtual bool storeValueCustom()=0
Saves the internal parameters to the given feature.
virtual bool restoreValueCustom()=0
Restore value from attribute data to the widget's control.
Implementation of widget for feature selection.
Definition: ModuleBase_WidgetFeatureSelector.h:48
QLabel * myLabel
Label of the widget.
Definition: ModuleBase_WidgetFeatureSelector.h:115
QLineEdit * myTextLine
Input control of the widget.
Definition: ModuleBase_WidgetFeatureSelector.h:118
Implementation of widget with validators and filters processing.
Definition: ModuleBase_WidgetValidated.h:54
virtual bool setSelectionCustom(const std::shared_ptr< ModuleBase_ViewerPrs > &thePrs)=0
Fills the attribute with the value of the selected owner.
virtual bool isValidInFilters(const std::shared_ptr< ModuleBase_ViewerPrs > &thePrs)
Checks whether all active viewer filters validate the presentation.
Definition: ModuleBase_WidgetValidated.cpp:125