Salome HOME
Issue #1368: Creation of a Qt panel. Code improvement.
[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
20 /**
21 * \ingroup Modules
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
26 */
27 class PARTSET_EXPORT PartSet_WidgetSketchCreator : public ModuleBase_ModelWidget
28 {
29 Q_OBJECT
30  public:
31   /// Constructor
32   /// \param theParent the parent object
33   /// \param theModule a reference to a module object
34   /// \param theData the widget configuation. The attribute of the model widget is obtained from
35   PartSet_WidgetSketchCreator(QWidget* theParent, PartSet_Module* theModule,
36                               const Config_WidgetAPI* theData);
37
38   virtual ~PartSet_WidgetSketchCreator();
39
40   /// Returns list of widget controls
41   /// \return a control list
42   virtual QList<QWidget*> getControls() const;
43
44   /// Set focus to the first control of the current widget. The focus policy of the control is checked.
45   /// If the widget has the NonFocus focus policy, it is skipped.
46   /// \return the state whether the widget can accept the focus
47   virtual bool focusTo();
48
49 protected:
50   /// Saves the internal parameters to the given feature
51   /// \return True in success
52   virtual bool storeValueCustom() const;
53
54   virtual bool restoreValueCustom();
55
56   /// The methiod called when widget is activated
57   virtual void activateCustom();
58
59 private slots:
60   void onStarted();
61
62   void onResumed(ModuleBase_Operation* theOp);
63
64 private:
65
66   PartSet_Module* myModule;
67
68   /// Label of the widget
69   QLabel* myLabel;
70
71   /// Input control of the widget
72   QLineEdit* myTextLine;
73
74   /// To check if we need to use body for composite feature or not
75   bool myUseBody;
76
77 };
78
79 #endif