SHAPER  9.12.0
ModuleBase_PagedContainer.h
1 // Copyright (C) 2014-2023 CEA, EDF
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_PAGEDCONTAINER_H_
21 #define MODULEBASE_PAGEDCONTAINER_H_
22 
23 #include <ModuleBase.h>
24 #include <ModuleBase_ModelWidget.h>
25 
27 
32 class MODULEBASE_EXPORT ModuleBase_PagedContainer : public ModuleBase_ModelWidget
33 {
34  Q_OBJECT
35  public:
39  ModuleBase_PagedContainer(QWidget* theParent, const Config_WidgetAPI* theData);
40  virtual ~ModuleBase_PagedContainer();
41 
47  virtual int addPage( ModuleBase_PageBase* theWidget,
48  const QString& theName,
49  const QString& theCaseId,
50  const QPixmap& theIcon,
51  const QString& theTooltip);
52 
54  virtual QList<QWidget*> getControls() const;
55 
57  virtual bool focusTo();
58 
60  virtual void setHighlighted(bool isHighlighted);
61 
63  virtual void enableFocusProcessing();
64 
66  virtual void onFeatureAccepted();
67 
68  protected:
70  virtual int currentPageIndex() const = 0;
71 
73  virtual void setCurrentPageIndex(int ) = 0;
74 
76  virtual void activateCustom();
77 
79  virtual bool storeValueCustom();
80 
82  virtual bool restoreValueCustom();
83 
84  // A flag which let to remeber last user choice and restore it on next launch
85  bool myRemeberChoice;
86 
87  protected slots:
89  void onPageChanged();
90 
91  private:
92  bool myIsFocusOnCurrentPage;
93  QStringList myCaseIds;
94  QList<ModuleBase_PageBase*> myPages;
95  std::string myDefValue;
96 };
97 
98 #endif /* MODULEBASE_PAGEDCONTAINER_H_ */
Provides low-level API for WidgetFactory for reading xml definitions of widgets.
Definition: Config_WidgetAPI.h:46
An abstract custom widget class.
Definition: ModuleBase_ModelWidget.h:60
virtual void setHighlighted(bool isHighlighted)
Switch On/Off highlighting of the widget.
Definition: ModuleBase_ModelWidget.cpp:234
virtual void activateCustom()
The method called when widget is activated.
Definition: ModuleBase_ModelWidget.h:410
virtual QList< QWidget * > getControls() const =0
Returns list of widget controls.
virtual bool storeValueCustom()=0
Saves the internal parameters to the given feature.
virtual bool restoreValueCustom()=0
Restore value from attribute data to the widget's control.
virtual void onFeatureAccepted()
It is called when user press Ok or OkPlus buttons in the parent property panel By default this slot d...
Definition: ModuleBase_ModelWidget.h:315
virtual void enableFocusProcessing()
Enables processing of focus event on all controls by the widget if this widget is not obligatory and ...
Definition: ModuleBase_ModelWidget.cpp:224
virtual bool focusTo()
Set focus to the first control of the current widget.
Definition: ModuleBase_ModelWidget.cpp:267
Definition: ModuleBase_PageBase.h:35
This is an abstract interface to be used for not model container widget such as switch or tool box.
Definition: ModuleBase_PagedContainer.h:33
virtual int currentPageIndex() const =0
Returns index of current page.
virtual void setCurrentPageIndex(int)=0
Set current page by index.