Salome HOME
ModuleBase_WidgetChoice is extended to use in a combo box a list of values read from...
[modules/shaper.git] / src / ModuleBase / ModuleBase_PageBase.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef MODULEBASE_PAGEBASE_H_
22 #define MODULEBASE_PAGEBASE_H_
23
24 #include <ModuleBase.h>
25 #include <ModuleBase_Tools.h>
26
27 class ModuleBase_ModelWidget;
28 class QLayout;
29 class QWidget;
30
31 /*!
32  * Represent a property panel's list of ModuleBase_ModelWidgets
33  * or other pages widgets derived from ModuleBase_PageBase.
34  */
35 class MODULEBASE_EXPORT ModuleBase_PageBase
36 {
37  public:
38   /// Base constructor.
39   ModuleBase_PageBase();
40   /// Base virtual destructor.
41   virtual ~ModuleBase_PageBase();
42   /// Cast the page to regular QWidget
43   QWidget* pageWidget();
44   /// Adds the given ModuleBase_ModelWidget to the page
45   void addModelWidget(ModuleBase_ModelWidget* theWidget);
46   /// Adds the given ModuleBase_PageBase to the page
47   void addPageWidget(ModuleBase_PageBase* theWidget);
48   /// Adds the given widget to the page
49   void addWidget(QWidget* theWidget);
50   /// Removes all items from page's layout
51   void clearPage();
52   /// Passes focus from page to the first ModuleBase_ModelWidget contained on the page
53   bool takeFocus();
54   /// Returns list of ModuleBase_ModelWidgets contained on the page
55   QList<ModuleBase_ModelWidget*> modelWidgets() const;
56   /// Aligns top all widgets on page
57   void alignToTop();
58
59  protected:
60   /// Pure Virtual. Allows to derived class to lay out the widget properly;
61   virtual void placeModelWidget(ModuleBase_ModelWidget* theWidget) = 0;
62   /// Pure Virtual. Allows to derived class to lay out the page properly;
63   virtual void placePageWidget(ModuleBase_PageBase* theWidget);
64   /// Pure Virtual. Allows to derived class to lay out the page properly;
65   virtual void placeWidget(QWidget* theWidget) = 0;
66   /// Pure Virtual. Returns layout of the page.
67   virtual QLayout* pageLayout() = 0;
68   /// Pure Virtual. Allows to derived class to insert page stretch properly.
69   virtual void addPageStretch() = 0;
70
71  private:
72   QList<ModuleBase_ModelWidget*> myWidgetList; ///< list of widgets contained on the page
73
74 };
75
76 #endif /* MODULEBASE_PAGEBASE_H_ */