SHAPER 9.16.0
ModuleBase_WidgetShapeSelector.h
1// Copyright (C) 2014-2026 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_WidgetShapeSelector_H
21#define ModuleBase_WidgetShapeSelector_H
22
23#include "ModuleBase.h"
24#include "ModuleBase_WidgetSelector.h"
25#include "ModuleBase_ViewerFilters.h"
26
27#include <ModelAPI_Object.h>
28#include <ModelAPI_Attribute.h>
29#include <GeomAPI_Shape.h>
30
31#include <TopAbs_ShapeEnum.hxx>
32
33#include <QStringList>
34
36class QWidget;
37class QLabel;
38class QLineEdit;
39class QToolButton;
43
71{
72Q_OBJECT
73 public:
74
80 const Config_WidgetAPI* theData);
81
83
90 virtual bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
91 const bool theToValidate);
92
95 virtual QList<QWidget*> getControls() const;
96
98 virtual bool isModified() const;
99
100 protected:
103 virtual bool storeValueCustom();
104
105 virtual bool restoreValueCustom();
106
108 virtual void updateSelectionName();
109
110 // Update focus after the attribute value change
111 virtual void updateFocus();
112
115 virtual QIntList shapeTypes() const;
116
119 virtual GeomShapePtr getShape() const;
120
124 virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>> getAttributeSelection() const;
125
126 //----------- Class members -------------
127 protected:
130
133
135 QStringList myShapeTypes;
136};
137
138#endif
Provides low-level API for WidgetFactory for reading xml definitions of widgets.
Definition: Config_WidgetAPI.h:46
Allows to validate the attribute value of a feature or the whole feature.
Definition: ModelAPI_Validator.h:43
Class which provides access to Workshop object services.
Definition: ModuleBase_IWorkshop.h:48
virtual QList< QWidget * > getControls() const =0
Returns list of widget controls.
virtual bool isModified() const
Returns True if data of its attribute was modified.
Definition: ModuleBase_ModelWidget.h:325
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.
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
Presentation.
Definition: ModuleBase_ViewerPrs.h:37
Implementation of widget for selection.
Definition: ModuleBase_WidgetSelector.h:43
virtual QIntList shapeTypes() const =0
Returns a list of possible shape types.
virtual QList< std::shared_ptr< ModuleBase_ViewerPrs > > getAttributeSelection() const
Return the attribute values wrapped in a list of viewer presentations.
Definition: ModuleBase_WidgetSelector.cpp:134
virtual void updateFocus()
Update focus after the attribute value change.
Definition: ModuleBase_WidgetSelector.h:96
virtual void updateSelectionName()
Computes and updates name of selected object in the widget.
Definition: ModuleBase_WidgetSelector.h:108
Implementation of widget for shapes selection.
Definition: ModuleBase_WidgetShapeSelector.h:71
QLabel * myLabel
Label of the widget.
Definition: ModuleBase_WidgetShapeSelector.h:129
QStringList myShapeTypes
List of accepting shapes types.
Definition: ModuleBase_WidgetShapeSelector.h:135
QLineEdit * myTextLine
Input control of the widget.
Definition: ModuleBase_WidgetShapeSelector.h:132