Salome HOME
b98055fc9dcb640713822ed18b6097cc5041b809
[modules/shaper.git] / src / ModuleBase / ModuleBase_PagedContainer.h
1 /*
2  * ModuleBase_PagedContainer.h
3  *
4  *  Created on: Mar 13, 2015
5  *      Author: sbh
6  */
7
8 #ifndef MODULEBASE_PAGEDCONTAINER_H_
9 #define MODULEBASE_PAGEDCONTAINER_H_
10
11 #include <ModuleBase.h>
12 #include <ModuleBase_ModelWidget.h>
13
14 class ModuleBase_PageBase;
15
16 /**
17 * \ingroup GUI
18 * This is an abstract interface to be used for not model container widget such as switch or tool box.
19 */
20 class MODULEBASE_EXPORT ModuleBase_PagedContainer : public ModuleBase_ModelWidget
21 {
22   Q_OBJECT
23  public:
24    /// A constructor
25    /// \param theParent a parent widget
26    /// \param theData a data of the widget
27    /// \param theParentId an Id of the parent object
28   ModuleBase_PagedContainer(QWidget* theParent, const Config_WidgetAPI* theData,
29                            const std::string& theParentId);
30   virtual ~ModuleBase_PagedContainer();
31
32   /// Add a new page
33   /// \param theWidget a page object
34   /// \param theName a name of the page
35   /// \param theCaseId an Id of the page
36   /// \param theIcon aqn Icon of the page
37   virtual int addPage( ModuleBase_PageBase* theWidget,
38                        const QString& theName,
39                        const QString& theCaseId,
40                        const QPixmap& theIcon );
41
42   /// Redefinition of virtual function
43   virtual QList<QWidget*> getControls() const;
44
45   /// Redefinition of virtual function
46   virtual bool focusTo();
47
48   /// Redefinition of virtual function
49   virtual void setHighlighted(bool isHighlighted);
50
51   /// Redefinition of virtual function
52   virtual void enableFocusProcessing();
53
54  protected:
55    /// Returns index of current page
56   virtual int currentPageIndex() const = 0;
57
58   /// Set current page by index
59   virtual void setCurrentPageIndex(int ) = 0;
60
61   /// Redefinition of virtual function
62   virtual void activateCustom();
63
64   /// Redefinition of virtual function
65   virtual bool storeValueCustom() const;
66
67   /// Redefinition of virtual function
68   virtual bool restoreValueCustom();
69
70  protected slots:
71    /// A slot called on page change
72   void onPageChanged();
73
74  private:
75   bool myIsFocusOnCurrentPage;
76   QStringList myCaseIds;
77   QList<ModuleBase_PageBase*> myPages;
78
79 };
80
81 #endif /* MODULEBASE_PAGEDCONTAINER_H_ */