Salome HOME
b749efd6cee464cb64ee8f7cb2f87997897db067
[modules/shaper.git] / src / ModuleBase / ModuleBase_PageBase.h
1 // Copyright (C) 2014-2021  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 email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef MODULEBASE_PAGEBASE_H_
21 #define MODULEBASE_PAGEBASE_H_
22
23 #include <ModuleBase.h>
24 #include <ModuleBase_Tools.h>
25
26 class ModuleBase_ModelWidget;
27 class QLayout;
28 class QWidget;
29
30 /*!
31  * Represent a property panel's list of ModuleBase_ModelWidgets
32  * or other pages widgets derived from ModuleBase_PageBase.
33  */
34 class MODULEBASE_EXPORT ModuleBase_PageBase
35 {
36  public:
37   /// Base constructor.
38   ModuleBase_PageBase();
39   /// Base virtual destructor.
40   virtual ~ModuleBase_PageBase();
41   /// Cast the page to regular QWidget
42   QWidget* pageWidget();
43   /// Adds the given ModuleBase_ModelWidget to the page
44   void addModelWidget(ModuleBase_ModelWidget* theWidget);
45   /// Adds the given ModuleBase_PageBase to the page
46   void addPageWidget(ModuleBase_PageBase* theWidget);
47   /// Adds the given widget to the page
48   void addWidget(QWidget* theWidget);
49   /// Removes all items from page's layout
50   void clearPage();
51   /// Passes focus from page to the first ModuleBase_ModelWidget contained on the page
52   bool takeFocus();
53   /// Returns list of ModuleBase_ModelWidgets contained on the page
54   QList<ModuleBase_ModelWidget*> modelWidgets() const;
55   /// Aligns top all widgets on page
56   void alignToTop();
57
58  protected:
59   /// Pure Virtual. Allows to derived class to lay out the widget properly;
60   virtual void placeModelWidget(ModuleBase_ModelWidget* theWidget) = 0;
61   /// Pure Virtual. Allows to derived class to lay out the page properly;
62   virtual void placePageWidget(ModuleBase_PageBase* theWidget);
63   /// Pure Virtual. Allows to derived class to lay out the page properly;
64   virtual void placeWidget(QWidget* theWidget) = 0;
65   /// Pure Virtual. Returns layout of the page.
66   virtual QLayout* pageLayout() = 0;
67   /// Pure Virtual. Allows to derived class to insert page stretch properly.
68   virtual void addPageStretch() = 0;
69
70  private:
71   QList<ModuleBase_ModelWidget*> myWidgetList; ///< list of widgets contained on the page
72
73 };
74
75 #endif /* MODULEBASE_PAGEBASE_H_ */