Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetSwitch.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 /*
4  * ModuleBase_WidgetSwitch.h
5  *
6  *  Created on: Apr 16, 2014
7  *      Author: sbh
8  */
9
10 #ifndef MODULEBASE_WIDGETSWITCH_H_
11 #define MODULEBASE_WIDGETSWITCH_H_
12
13 #include <ModuleBase.h>
14 #include <ModuleBase_PagedContainer.h>
15
16 class QComboBox;
17 class QStackedLayout;
18
19 /**
20 * \ingroup GUI
21 * Implements a model widget for swithch as a container widget. It can be defined in XML with "switch" keyword
22 */
23 class MODULEBASE_EXPORT ModuleBase_WidgetSwitch : public ModuleBase_PagedContainer
24 {
25   Q_OBJECT
26  public:
27    /// Constructor
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();
33
34   /// Add a page to the widget
35   /// \param theWidget a page widget
36   /// \param theName a name of page
37   virtual int addPage(ModuleBase_PageBase* theWidget,
38                         const QString& theName, const QString& theCaseId);
39
40  protected:
41   virtual int currentPageIndex() const;
42    /// Set current page by index
43   /// \param index index of the page
44   virtual void setCurrentPageIndex(int index);
45
46  private:
47   /// Combo box
48   QComboBox* myCombo;
49   QStackedLayout* myPagesLayout;
50 };
51
52 #endif /* ModuleBase_WidgetSwitch_H_ */