X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetChoice.h;h=e5c66a9cc0327f0c7d6ab2c7ca3f5f16434cee38;hb=e32f95642855a63da2727cb324ce2a75632a712f;hp=9b5206b083f74ab2ebd8a54997c634930116e39b;hpb=0233fc4277a766a0db60d017664ee1178b40002e;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetChoice.h b/src/ModuleBase/ModuleBase_WidgetChoice.h index 9b5206b08..e5c66a9cc 100644 --- a/src/ModuleBase/ModuleBase_WidgetChoice.h +++ b/src/ModuleBase/ModuleBase_WidgetChoice.h @@ -13,17 +13,25 @@ class QWidget; class QLabel; class QComboBox; +class QButtonGroup; /** +* \ingroup GUI * Implementation of model widget for choice widget definition (combo box) * It can be defined as following: * \code * * \endcode +* Aditionally can be used: +* A key "widget_type". It can have values "combobox" or "radiobuttons". +* By default it uses "combobox". +* A key "buttons_dir" which is applicable only for "radiobuttons" mode. +* It defines direction of radiobuttons layout. it can be "vertical" or "horizontal" +* Default value is "vertical" */ class MODULEBASE_EXPORT ModuleBase_WidgetChoice : public ModuleBase_ModelWidget { @@ -32,42 +40,49 @@ Q_OBJECT /// Constructor /// \param theParent the parent object /// \param theData the widget configuation. The attribute of the model widget is obtained from - /// \param theParentId is Id of a parent of the current attribute - ModuleBase_WidgetChoice(QWidget* theParent, const Config_WidgetAPI* theData, - const std::string& theParentId); + ModuleBase_WidgetChoice(QWidget* theParent, const Config_WidgetAPI* theData); virtual ~ModuleBase_WidgetChoice(); - - virtual bool storeValue() const; - virtual bool restoreValue(); + /// Defines if it is supported to set the value in this widget + /// It returns false because this is an info widget + virtual bool canAcceptFocus() const { return false; }; virtual bool focusTo(); - /// Returns the internal parent wiget control, that can be shown anywhere - /// \returns the widget - QWidget* getControl() const - { - return myContainer; - } - /// Returns list of widget controls /// \return a controls list virtual QList getControls() const; + /// Returns text value for the property panel title + /// \param theIndex a button index + /// \return the title value + QString getPropertyPanelTitle(int theIndex); + +signals: + void itemSelected(ModuleBase_ModelWidget* theWidget, int theIndex); + +protected: + /// Saves the internal parameters to the given feature + /// \return True in success + virtual bool storeValueCustom(); + + virtual bool restoreValueCustom(); + private slots: /// Slot called on combo box index change void onCurrentIndexChanged(int theIndex); private: - /// Container widget - QWidget* myContainer; - /// The label QLabel* myLabel; /// The control QComboBox* myCombo; + QButtonGroup* myButtons; + + // XML definition of titles + QStringList myButtonTitles; }; #endif