1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PartSet_WidgetSketchCreator.h
4 // Created: 08 June 2015
5 // Author: Vitaly SMETANNIKOV
7 #ifndef PartSet_WidgetSketchCreator_H
8 #define PartSet_WidgetSketchCreator_H
12 #include <ModuleBase_WidgetSelector.h>
17 class ModuleBase_Operation;
18 class PartSet_PreviewPlanes;
22 * A widget which allow creation of a sketch in another operation.
23 * It creates sketch on aqctivation of this widget. If sketch object is already created then
24 * it will transfer a focus to next widget. It is supposed that the widget will be placed as
25 * a first widget in property panel
27 class PARTSET_EXPORT PartSet_WidgetSketchCreator : public ModuleBase_WidgetSelector
33 /// \param theParent the parent object
34 /// \param theModule a reference to a module object
35 /// \param theData the widget configuation. The attribute of the model widget is obtained from
36 PartSet_WidgetSketchCreator(QWidget* theParent, PartSet_Module* theModule,
37 const Config_WidgetAPI* theData);
39 virtual ~PartSet_WidgetSketchCreator();
41 /// Returns list of widget controls
42 /// \return a control list
43 virtual QList<QWidget*> getControls() const;
45 /// Set focus to the first control of the current widget. The focus policy of the control is checked.
46 /// If the widget has the NonFocus focus policy, it is skipped.
47 /// \return the state whether the widget can accept the focus
48 virtual bool focusTo();
50 /// The methiod called when widget is deactivated
51 virtual void deactivate();
53 /// Editing mode depends on mode of current operation. This value is defined by it.
54 virtual void setEditingMode(bool isEditing);
57 /// Saves the internal parameters to the given feature
58 /// \return True in success
59 virtual bool storeValueCustom() const;
61 virtual bool restoreValueCustom();
63 /// Visualization of the current control or others in PP
64 /// \param theSelectionControl state whether the control should be shown/hidden
65 void setVisibleSelectionControl(const bool theSelectionControl);
67 /// Retunrs a list of possible shape types
68 /// \return a list of shapes
69 virtual QIntList getShapeTypes() const;
71 /// Store the values to the model attribute of the widget. It casts this attribute to
72 /// the specific type and set the given values
73 /// \param theSelectedObject an object
74 /// \param theShape a selected shape, which is used in the selection attribute
75 /// \return true if it is succeed
76 virtual void setObject(ObjectPtr theSelectedObject, GeomShapePtr theShape);
79 /// Returns true if the selection mode is active. This is when composition feature has no
80 /// a sub-object and the attribute list is empty
81 /// \return boolean value
82 bool isSelectionMode() const;
85 /// Slot which is called on selection event
86 // NDS: virtual is temporary
87 virtual void onSelectionChanged();
90 void onResumed(ModuleBase_Operation* theOp);
93 /// Append new Sketch, set the selected plane for the sketch and start Edit operation.
94 /// \param theValues a selection list
95 /// \return true if the sketch is started
96 bool startSketchOperation(const QList<ModuleBase_ViewerPrs>& theValues);
99 std::string myAttributeListID;
101 PartSet_Module* myModule;
103 /// Label of the widget
106 /// Input control of the widget
107 QLineEdit* myTextLine;
109 /// List of accepting shapes types
110 QStringList myShapeTypes;
112 /// class to show/hide preview planes
113 PartSet_PreviewPlanes* myPreviewPlanes;