1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
4 * ModuleBase_WidgetSwitch.h
6 * Created on: Apr 16, 2014
10 #ifndef ModuleBase_WidgetSwitch_H_
11 #define ModuleBase_WidgetSwitch_H_
13 #include <ModuleBase.h>
14 #include <ModuleBase_ModelWidget.h>
21 * Implements a model widget for swithch as a container widget. It can be defined in XML with "switch" keyword
23 class MODULEBASE_EXPORT ModuleBase_WidgetSwitch : public ModuleBase_ModelWidget
28 /// \param parent a parent widget
29 ModuleBase_WidgetSwitch(QWidget* theParent,
30 const Config_WidgetAPI* theData,
31 const std::string& theParentId);
32 virtual ~ModuleBase_WidgetSwitch();
34 virtual bool restoreValue() {
38 virtual QList<QWidget*> getControls() const;
40 virtual bool focusTo() {
44 /// Add a page to the widget
45 /// \param theWidget a page widget
46 /// \param theName a name of page
47 int addPage(QWidget* theWidget, const QString & theName);
49 /// Returns count of pages
52 /// Returns index of current page
53 int currentIndex() const;
55 /// Returns current widget (page)
56 QWidget * currentWidget() const;
58 /// Returns index of widget (page)
59 /// \param theWidget a widget page
60 int indexOf(QWidget * theWidget) const;
63 /// \param index an index (position) to insert
64 /// \param theWidget a page widget
65 /// \param theName a name of the page
66 int insertPage(int index, QWidget * theWidget, const QString & theName);
68 /// Returns True if a page by given index is enabled
69 /// \param index index of the page
70 bool isPageEnabled(int index) const;
72 /// Returns text of the page by its id
73 /// \param index index of the page
74 QString pageText(int index) const;
76 /// Returns tooltip of the page by its id
77 /// \param index index of the page
78 QString pageToolTip(int index) const;
80 /// Remove page by its id
81 /// \param index index of the page
82 void removePage(int index);
84 /// Enale/disable a page by its Id
85 /// \param index index of the page
86 /// \param enabled an enable flag
87 void setPageEnabled(int index, bool enabled);
90 /// \param index index of the page
91 /// \param text a name of the page
92 void setPageName(int index, const QString & text);
95 /// \param index index of the page
96 /// \param toolTip a tooltip of the page
97 void setPageToolTip(int index, const QString & toolTip);
100 /// Set current page by index
101 /// \param index index of the page
102 void setCurrentIndex(int index);
105 /// Emitted on current page change
106 void currentPageChanged(int);
109 virtual bool storeValueCustom() const {
117 QVBoxLayout* myMainLay;
126 #endif /* ModuleBase_WidgetSwitch_H_ */