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