X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetFeature.h;h=ec74136542e54c80890f2274e86c4d5d3f7a8f30;hb=8f56432d03ce0cbce36d2190c0afc83f3f781f72;hp=45891e9226cca19cf9af394d83879c06d66c525e;hpb=8f0712c06f339f4da39e951ca83e35b59e447018;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetFeature.h b/src/ModuleBase/ModuleBase_WidgetFeature.h index 45891e922..ec7413654 100644 --- a/src/ModuleBase/ModuleBase_WidgetFeature.h +++ b/src/ModuleBase/ModuleBase_WidgetFeature.h @@ -11,10 +11,12 @@ #include #include +class ModuleBase_WidgetValue; class ModelAPI_Feature; class QWidget; class QLabel; class QLineEdit; +class QToolButton; /**\class ModuleBase_WidgetFeature * \ingroup GUI @@ -22,25 +24,27 @@ class QLineEdit; */ class MODULEBASE_EXPORT ModuleBase_WidgetFeature : public ModuleBase_ModelWidget { - Q_OBJECT -public: +Q_OBJECT + public: /// Constructor /// \theParent the parent object /// \theParent the parent object /// \theData the widget configuation. The attribute of the model widget is obtained from - ModuleBase_WidgetFeature(QWidget* theParent, const Config_WidgetAPI* theData); + ModuleBase_WidgetFeature(QWidget* theParent, const Config_WidgetAPI* theData, + const std::string& theParentId); /// Destructor virtual ~ModuleBase_WidgetFeature(); - /// Fill the widget values by given point - /// \param thePoint the point - bool setFeature(const FeaturePtr& theFeature); + /// Set the given wrapped value to the current widget + /// This value should be processed in the widget according to the needs + /// \param theValue the wrapped widget value + virtual bool setValue(ModuleBase_WidgetValue* theValue); /// Saves the internal parameters to the given feature /// \param theFeature a model feature to be changed - virtual bool storeValue(FeaturePtr theFeature) const; + virtual bool storeValue() const; - virtual bool restoreValue(FeaturePtr theFeature); + virtual bool restoreValue(); /// Returns the internal parent wiget control, that can be shown anywhere /// \returns the widget @@ -49,14 +53,44 @@ public: /// Returns list of widget controls /// \return a control list virtual QList getControls() const; + /// Defines if it is supposed that the widget should interact with the viewer. + virtual bool isViewerSelector() { return true; } + + protected: + /// Fill the widget values by given point + /// \param thePoint the point + /// \return the boolean result of the feature set + bool setObject(const ObjectPtr& theObject, bool theSendEvent = true); + + /// Returns current widget feature + /// \return the feature + const ObjectPtr object() const + { + return myObject; + } + + /// Returns the widget editor + /// \return the editor + QLineEdit* editor() const + { + return myEditor; + } + + /// Returns the possible feature kinds + /// \return the list of kinds + const QStringList& featureKinds() const + { + return myObjectKinds; + } -private: - FeaturePtr myFeature; ///< the current widget feature - QStringList myFeatureKinds; ///< the kinds of possible features + protected: + ObjectPtr myObject; ///< the current widget feature + QStringList myObjectKinds; ///< the kinds of possible features - QWidget* myContainer; /// the parent top control - QLabel* myLabel; /// the editor information label - QLineEdit* myEditor; ///< the feature editor to visualize the feature name + private: + QWidget* myContainer; /// the parent top control + QLabel* myLabel; /// the editor information label + QLineEdit* myEditor; ///< the feature editor to visualize the feature name }; #endif