1 // File: ModuleBase_SelectorWidget.h
2 // Created: 2 June 2014
3 // Author: Vitaly Smetannikov
5 #ifndef ModuleBase_SelectorWidget_H
6 #define ModuleBase_SelectorWidget_H
8 #include "ModuleBase.h"
9 #include "ModuleBase_ModelWidget.h"
11 #include <ModelAPI_Feature.h>
14 class Config_WidgetAPI;
19 class ModuleBase_IWorkshop;
21 class MODULEBASE_EXPORT ModuleBase_SelectorWidget: public ModuleBase_ModelWidget
25 ModuleBase_SelectorWidget(QWidget* theParent,
26 ModuleBase_IWorkshop* theWorkshop,
27 const Config_WidgetAPI* theData);
29 virtual ~ModuleBase_SelectorWidget();
31 /// Saves the internal parameters to the given feature
32 /// \param theFeature a model feature to be changed
33 virtual bool storeValue(FeaturePtr theFeature) const;
35 virtual bool restoreValue(FeaturePtr theFeature);
37 /// Returns the internal parent wiget control, that can be shown anywhere
38 /// \returns the widget
39 QWidget* getControl() const { return myContainer; }
41 /// Returns list of widget controls
42 /// \return a control list
43 virtual QList<QWidget*> getControls() const;
45 void setActivationOnStart(bool toActivate) { myActivateOnStart = toActivate; }
46 bool activateOnStart() const { return myActivateOnStart; }
48 FeaturePtr selectedFeature() const { return mySelectedFeature; }
52 /// Activate or deactivate selection
53 void activateSelection(bool toActivate);
56 bool eventFilter(QObject* theObj, QEvent* theEvent);
59 void onSelectionChanged();
62 void enableOthersControls(bool toEnable) const;
63 void updateSelectionName();
64 void raisePanel() const;
68 QLineEdit* myTextLine;
69 QToolButton* myActivateBtn;
71 ModuleBase_IWorkshop* myWorkshop;
73 bool myActivateOnStart;
75 FeaturePtr mySelectedFeature;