1 // File: ModuleBase_WidgetSelector.h
2 // Created: 2 June 2014
3 // Author: Vitaly Smetannikov
5 #ifndef ModuleBase_WidgetSelector_H
6 #define ModuleBase_WidgetSelector_H
8 #include "ModuleBase.h"
9 #include "ModuleBase_ModelWidget.h"
11 #include <ModelAPI_Object.h>
13 #include <TopAbs_ShapeEnum.hxx>
15 #include <QStringList>
18 class Config_WidgetAPI;
23 class ModuleBase_IWorkshop;
25 class MODULEBASE_EXPORT ModuleBase_WidgetSelector : public ModuleBase_ModelWidget
29 ModuleBase_WidgetSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
30 const Config_WidgetAPI* theData, const std::string& theParentId);
32 virtual ~ModuleBase_WidgetSelector();
34 /// Saves the internal parameters to the given feature
35 /// \param theObject a model feature to be changed
36 virtual bool storeValue() const;
38 virtual bool restoreValue();
40 virtual bool focusTo();
42 /// Returns the internal parent wiget control, that can be shown anywhere
43 /// \returns the widget
44 QWidget* getControl() const
49 /// Returns list of widget controls
50 /// \return a control list
51 virtual QList<QWidget*> getControls() const;
53 ObjectPtr selectedFeature() const
55 return mySelectedObject;
60 /// Activate or deactivate selection
61 void activateSelection(bool toActivate);
64 bool eventFilter(QObject* theObj, QEvent* theEvent);
67 void onSelectionChanged();
70 void enableOthersControls(bool toEnable) const;
71 void updateSelectionName();
72 void raisePanel() const;
73 bool isAccepted(const ObjectPtr theObject) const;
75 static TopAbs_ShapeEnum shapeType(const QString& theType);
79 QLineEdit* myTextLine;
80 QToolButton* myActivateBtn;
82 ModuleBase_IWorkshop* myWorkshop;
84 ObjectPtr mySelectedObject;
85 QStringList myShapeTypes;
88 QPalette myInactivePalet;