X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetShapeSelector.h;h=7284d8ae59ec8c7e305457122850d1a75f53c1b3;hb=d29ed3f3f7c0e119d2917b2d4120aa7b473220f4;hp=c1decfa56450fdf6eb19c3aa2d1b6362a131ecbe;hpb=19bc85698899d6bee8704e7b0953ee045b0eb66f;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.h b/src/ModuleBase/ModuleBase_WidgetShapeSelector.h index c1decfa56..7284d8ae5 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.h @@ -7,13 +7,14 @@ #include "ModuleBase.h" #include "ModuleBase_ModelWidget.h" +#include "ModuleBase_ViewerFilters.h" #include +#include #include #include -#include class Config_WidgetAPI; class QWidget; @@ -26,6 +27,8 @@ class MODULEBASE_EXPORT ModuleBase_WidgetShapeSelector : public ModuleBase_Model { Q_OBJECT public: + static TopAbs_ShapeEnum shapeType(const QString& theType); + ModuleBase_WidgetShapeSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, const Config_WidgetAPI* theData, const std::string& theParentId); @@ -60,41 +63,56 @@ Q_OBJECT /// \param theValue the wrapped widget value virtual bool setValue(ModuleBase_WidgetValue* theValue); -public slots: + public slots: /// Activate or deactivate selection void activateSelection(bool toActivate); -private slots: + private slots: void onSelectionChanged(); -protected: + protected: bool eventFilter(QObject* theObj, QEvent* theEvent); -private: void updateSelectionName(); void raisePanel() const; - bool isAccepted(const ObjectPtr theObject) const; - // Set the given object as a value of the widget - void setObject(ObjectPtr theObj); + /// Returns true if shape of given object corresponds to requested shape type + /// This method is called only in non sub-shapes selection mode + virtual bool acceptObjectShape(const ObjectPtr theObject) const; - static TopAbs_ShapeEnum shapeType(const QString& theType); + /// Returns true if selected shape corresponds to requested shape types + /// This method is called only in sub-shapes selection mode + virtual bool acceptSubShape(std::shared_ptr theShape) const; + + /// Returns true if selected object corresponds to requested Object type + /// Thid method is used in any selection mode + virtual bool acceptObjectType(const ObjectPtr theObject) const; + + // Set the given object as a value of the widget + void setObject(ObjectPtr theObj, std::shared_ptr theShape = std::shared_ptr()); + + //----------- Class members ------------- + private: QWidget* myContainer; QLabel* myLabel; QLineEdit* myTextLine; - //QToolButton* myActivateBtn; ModuleBase_IWorkshop* myWorkshop; ObjectPtr mySelectedObject; + std::shared_ptr myShape; + QStringList myShapeTypes; + QStringList myObjectTypes; - QPalette myBasePalet; - QPalette myInactivePalet; + /// If true then local selector has to be activated in context + bool myUseSubShapes; bool myIsActive; + + Handle(ModuleBase_ObjectTypesFilter) myObjTypeFilter; }; #endif