1 // File: PartSet_WidgetPoint2d.h
2 // Created: 25 Apr 2014
3 // Author: Natalia ERMOLAEVA
5 #ifndef PartSet_WidgetPoint2D_H
6 #define PartSet_WidgetPoint2D_H
9 #include <ModelAPI_CompositeFeature.h>
10 #include <ModuleBase_ModelWidget.h>
14 #include <TopoDS_Shape.hxx>
16 class ModelAPI_Feature;
17 class ModuleBase_WidgetValue;
18 class ModuleBase_IWorkshop;
19 class ModuleBase_DoubleSpinBox;
20 class ModuleBase_IViewWindow;
27 /**\class PartSet_WidgetPoint2D
29 * \brief Custom widget. An abstract class to be redefined to fill with some GUI controls
31 class PARTSET_EXPORT PartSet_WidgetPoint2D : public ModuleBase_ModelWidget
36 /// \theParent the parent object
37 /// \theParent the parent object
38 /// \theData the widget configuation. The attribute of the model widget is obtained from
39 PartSet_WidgetPoint2D(QWidget* theParent, const Config_WidgetAPI* theData,
40 const std::string& theParentId);
42 virtual ~PartSet_WidgetPoint2D();
44 /// Set the given wrapped value to the current widget
45 /// This value should be processed in the widget according to the needs
46 /// \param theValue the wrapped widget value
47 virtual bool setValue(ModuleBase_WidgetValue* theValue);
49 /// Saves the internal parameters to the given feature
50 /// \param theObject a model feature to be changed
51 virtual bool storeValue() const;
53 virtual bool restoreValue();
55 /// Returns the internal parent wiget control, that can be shown anywhere
56 /// \returns the widget
57 QWidget* getControl() const;
59 /// Returns list of widget controls
60 /// \return a control list
61 virtual QList<QWidget*> getControls() const;
63 //bool initFromPrevious(ObjectPtr theObject);
65 /// The methiod called when widget is activated
66 virtual void activate();
68 /// The methiod called when widget is deactivated
69 virtual void deactivate();
71 XGUI_Workshop* workshop() const { return myWorkshop; }
73 void setWorkshop(XGUI_Workshop* theWork) { myWorkshop = theWork; }
75 /// \returns the sketch instance
76 CompositeFeaturePtr sketch() const { return mySketch; }
77 void setSketch(CompositeFeaturePtr theSketch) { mySketch = theSketch; }
79 /// Fill the widget values by given point
80 /// \param thePoint the point
81 void setPoint(double theX, double theY);
83 /// Returns coordinate X currently defined in the control
86 /// Returns coordinate Y currently defined in the control
90 /// Signal about selection of an existing vertex from an object
91 /// \param theObject - the selected object
92 /// \param theShape - the selected shape
93 void vertexSelected(ObjectPtr theObject, const TopoDS_Shape& theShape);
96 void onMouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
97 void onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
100 XGUI_Workshop* myWorkshop;
102 QGroupBox* myGroupBox; ///< the parent group box for all intenal widgets
103 ModuleBase_DoubleSpinBox* myXSpin; ///< the spin box for the X coordinate
104 ModuleBase_DoubleSpinBox* myYSpin; ///< the spin box for the Y coordinate
106 //std::string myOptionParam; /// Parameter name which has to be taken from previous feature
108 CompositeFeaturePtr mySketch;