Salome HOME
Selection priority in Sketch, clear selection when sketch goes from entity to neutral...
[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 switch 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 theParent the parent object
29   /// \param theData the widget configuration. The attribute of the model widget is obtained from
30   ModuleBase_WidgetSwitch(QWidget* theParent,
31                           const Config_WidgetAPI* theData);
32   virtual ~ModuleBase_WidgetSwitch();
33
34   /// Defines if it is supported to set the value in this widget
35   /// It returns false because this is an info widget
36   virtual bool canAcceptFocus() const { return false; };
37
38   /// Add a page to the widget
39   /// \param theWidget a page widget
40   /// \param theName a name of page
41   /// \param theCaseId an Id of the page
42   /// \param theIcon an icon of the page
43   virtual int addPage( ModuleBase_PageBase* theWidget,
44                        const QString& theName,
45                        const QString& theCaseId,
46                        const QPixmap& theIcon );
47
48  protected:
49    /// Returns index of the current page
50   virtual int currentPageIndex() const;
51
52   /// Set current page by index
53   /// \param index index of the page
54   virtual void setCurrentPageIndex(int index);
55
56  private:
57   /// Combo box
58   QComboBox* myCombo;
59   QStackedLayout* myPagesLayout;
60 };
61
62 #endif /* ModuleBase_WidgetSwitch_H_ */