Salome HOME
ExtrusionCut launch
[modules/shaper.git] / src / PartSet / PartSet_WidgetSketchCreator.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        PartSet_WidgetSketchCreator.h
4 // Created:     08 June 2015
5 // Author:      Vitaly SMETANNIKOV
6
7 #ifndef PartSet_WidgetSketchCreator_H
8 #define PartSet_WidgetSketchCreator_H
9
10 #include "PartSet.h"
11
12 #include <ModuleBase_ModelWidget.h>
13
14 class QLabel;
15 class QLineEdit;
16 class PartSet_Module;
17 class ModuleBase_Operation;
18
19 class PARTSET_EXPORT PartSet_WidgetSketchCreator : public ModuleBase_ModelWidget
20 {
21 Q_OBJECT
22  public:
23   /// Constructor
24   /// \param theParent the parent object
25   /// \param theData the widget configuation. The attribute of the model widget is obtained from
26   /// \param theParentId is Id of a parent of the current attribute
27   PartSet_WidgetSketchCreator(QWidget* theParent, PartSet_Module* theModule, 
28     const Config_WidgetAPI* theData, const std::string& theParentId);
29
30   virtual ~PartSet_WidgetSketchCreator();
31
32   /// Set the given wrapped value to the current widget
33   /// This value should be processed in the widget according to the needs
34   /// The method is called by the current operation to process the operation preselection.
35   /// It is redefined to do nothing if the plane of the sketch has been already set.
36   /// \param theValues the wrapped selection values
37   /// \param thePosition an index in the list of values, the values should be get from the index
38   virtual bool setSelection(const QList<ModuleBase_ViewerPrs>& theValues, int& thePosition);
39
40   virtual bool restoreValue();
41
42   /// Returns list of widget controls
43   /// \return a control list
44   virtual QList<QWidget*> getControls() const;
45
46 protected:
47   /// Creates a backup of the current values of the attribute
48   /// It should be realized in the specific widget because of different
49   /// parameters of the current attribute
50   virtual void storeAttributeValue();
51
52   /// Creates a backup of the current values of the attribute
53   /// It should be realized in the specific widget because of different
54   /// parameters of the current attribute
55   /// \param theValid a boolean flag, if restore happens for valid parameters
56   virtual void restoreAttributeValue(const bool theValid);
57
58   /// Fills the attribute with the value of the selected owner
59   /// \param theOwner a selected owner
60   virtual bool setSelectionCustom(const ModuleBase_ViewerPrs& thePrs);
61
62   /// Saves the internal parameters to the given feature
63   /// \return True in success
64   virtual bool storeValueCustom() const;
65
66   /// The methiod called when widget is activated
67   virtual void activateCustom();
68
69 private slots:
70   void onStarted();
71
72 private:
73
74   PartSet_Module* myModule;
75
76   /// Label of the widget
77   QLabel* myLabel;
78
79   /// Input control of the widget
80   QLineEdit* myTextLine;
81
82 };
83
84 #endif