Salome HOME
Improvement for key "Delete" processing: should be done only on possible objects...
[modules/shaper.git] / src / ModuleBase / ModuleBase_PageBase.h
1 /*
2  * ModuleBase_PageBase.h
3  *
4  *  Created on: Mar 4, 2015
5  *      Author: sbh
6  */
7
8 #ifndef MODULEBASE_PAGEBASE_H_
9 #define MODULEBASE_PAGEBASE_H_
10
11 #include <ModuleBase.h>
12 #include <ModuleBase_Tools.h>
13
14 class ModuleBase_ModelWidget;
15 class QLayout;
16 class QWidget;
17
18 /*!
19  * Represent a property panel's list of ModuleBase_ModelWidgets
20  * or other pages widgets derived from ModuleBase_PageBase.
21  */
22 class MODULEBASE_EXPORT ModuleBase_PageBase
23 {
24  public:
25   /// Base constructor.
26   ModuleBase_PageBase();
27   /// Base virtual destructor.
28   virtual ~ModuleBase_PageBase();
29   /// Cast the page to regular QWidget
30   QWidget* pageWidget();
31   /// Adds the given ModuleBase_ModelWidget to the page
32   void addModelWidget(ModuleBase_ModelWidget* theWidget);
33   /// Adds the given ModuleBase_PageBase to the page
34   void addPageWidget(ModuleBase_PageBase* theWidget);
35   /// Adds the given widget to the page
36   void addWidget(QWidget* theWidget);
37   /// Removes all items from page's layout
38   void clearPage();
39   /// Passes focus from page to the first ModuleBase_ModelWidget contained on the page
40   bool takeFocus();
41   /// Returns list of ModuleBase_ModelWidgets contained on the page
42   QList<ModuleBase_ModelWidget*> modelWidgets();
43   /// Aligns top all widgets on page
44   void alignToTop();
45
46  protected:
47   /// Pure Virtual. Allows to derived class to lay out the widget properly;
48   virtual void placeModelWidget(ModuleBase_ModelWidget* theWidget) = 0;
49   /// Pure Virtual. Allows to derived class to lay out the page properly;
50   virtual void placePageWidget(ModuleBase_PageBase* theWidget);
51   /// Pure Virtual. Allows to derived class to lay out the page properly;
52   virtual void placeWidget(QWidget* theWidget) = 0;
53   /// Pure Virtual. Returns layout of the page.
54   virtual QLayout* pageLayout() = 0;
55   /// Pure Virtual. Allows to derived class to insert page stretch properly.
56   virtual void addPageStretch() = 0;
57
58  private:
59   QList<ModuleBase_ModelWidget*> myWidgetList; ///< list of widgets contained on the page
60
61 };
62
63 #endif /* MODULEBASE_PAGEBASE_H_ */