X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetChoice.h;h=f88a56e7f57690911f73070c5f8a469ab484a7fc;hb=69ab96aa2914d1a7d0032b682b968c5f7a791927;hp=15a95054eb8662cc2ef192c7a2b3ee867ab99a31;hpb=542c9d721fbef80eb2040ef248fdd431cad2e631;p=modules%2Fshaper.git
diff --git a/src/ModuleBase/ModuleBase_WidgetChoice.h b/src/ModuleBase/ModuleBase_WidgetChoice.h
index 15a95054e..f88a56e7f 100644
--- a/src/ModuleBase/ModuleBase_WidgetChoice.h
+++ b/src/ModuleBase/ModuleBase_WidgetChoice.h
@@ -1,3 +1,5 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
// File: ModuleBase_WidgetChoice.h
// Created: 03 Sept 2014
// Author: Vitaly Smetannikov
@@ -11,42 +13,79 @@
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
{
Q_OBJECT
public:
- ModuleBase_WidgetChoice(QWidget* theParent, const Config_WidgetAPI* theData,
- const std::string& theParentId);
+ /// Constructor
+ /// \param theParent the parent object
+ /// \param theData the widget configuation. The attribute of the model widget is obtained from
+ ModuleBase_WidgetChoice(QWidget* theParent, const Config_WidgetAPI* theData);
virtual ~ModuleBase_WidgetChoice();
-
- /// Saves the internal parameters to the given feature
- /// \param theObject a model feature to be changed
- 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 control list
+ /// \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:
+ /// Segnal about selected item
+ /// \param theWidget selected widget
+ /// \param theIndex selected index
+ 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:
- QWidget* myContainer;
+ /// The label
QLabel* myLabel;
+
+ /// The control
QComboBox* myCombo;
+ QButtonGroup* myButtons;
+
+ // XML definition of titles
+ QStringList myButtonTitles;
};
#endif