SGL
gscrollpane.h
1 /*
2  * File: gscrollpane.h
3  * -------------------
4  *
5  * @author Marty Stepp
6  * @version 2021/04/09
7  * - added sgl namespace
8  * @version 2018/09/08
9  * - added doc comments for new documentation generation
10  * @version 2018/09/01
11  * - initial version
12  */
13 
14 
15 #ifndef _gscrollpane_h
16 #define _gscrollpane_h
17 
18 #include <string>
19 #include <QScrollArea>
20 
21 #include "ginteractor.h"
22 
23 namespace sgl {
24 
25 class _Internal_QScrollArea;
26 
33 class GScrollPane : public GInteractor {
34 public:
44  };
45 
50  GScrollPane(GInteractor* interactor, QWidget* parent = nullptr);
51 
55  ~GScrollPane() override;
56 
61 
66 
70  virtual GInteractor* getInteractor() const;
71 
72  /* @inherit */
73  _Internal_QWidget* getInternalWidget() const override;
74 
75  /* @inherit */
76  string getType() const override;
77 
78  /* @inherit */
79  QWidget* getWidget() const override;
80 
85  virtual bool isInteractorStretch() const;
86 
90  virtual void setHorizontalScrollBarPolicy(ScrollBarPolicy policy);
91 
95  virtual void setScrollBarPolicy(ScrollBarPolicy policy);
96 
100  virtual void setVerticalScrollBarPolicy(ScrollBarPolicy policy);
101 
106  virtual void setInteractorStretch(bool stretch);
107 
108 private:
109  Q_DISABLE_COPY(GScrollPane)
110 
111  _Internal_QScrollArea* _iqscrollarea;
112  GInteractor* _interactor;
113  ScrollBarPolicy _horizontalScrollBarPolicy;
114  ScrollBarPolicy _verticalScrollBarPolicy;
115 
116  friend class _Internal_QScrollArea;
117 
118  static Qt::ScrollBarPolicy toQtScrollBarPolicy(ScrollBarPolicy policy);
119 };
120 
125 class _Internal_QScrollArea : public QScrollArea, public _Internal_QWidget {
126  Q_OBJECT
127 
128 public:
129  _Internal_QScrollArea(GScrollPane* gscrollpane, QWidget* parent = nullptr);
130  QSize sizeHint() const override;
131 
132 // private:
133  // GScrollPane* _gscrollpane;
134 };
135 
136 } // namespace sgl
137 
138 #endif // _gscrollpane_h
virtual void setHorizontalScrollBarPolicy(ScrollBarPolicy policy)
Sets whether the horizontal scroll bar will be shown.
Definition: gscrollpane.cpp:67
Definition: gscrollpane.h:41
Definition: gscrollpane.h:43
virtual void setScrollBarPolicy(ScrollBarPolicy policy)
Sets whether the horizontal and vertical scroll bars will be shown.
Definition: gscrollpane.cpp:81
virtual ScrollBarPolicy getVerticalScrollBarPolicy() const
Returns a constant indicating whether the vertical scroll bar will be shown.
Definition: gscrollpane.cpp:55
~GScrollPane() override
Frees memory allocated internally by the scroll pane.
Definition: gscrollpane.cpp:33
Definition: gscrollpane.h:42
Definition: console.h:45
virtual void setVerticalScrollBarPolicy(ScrollBarPolicy policy)
Sets whether the vertical scroll bar will be shown.
Definition: gscrollpane.cpp:86
This abstract class is the superclass for all graphical interactors.
Definition: ginteractor.h:52
ScrollBarPolicy
Constants to indicate whether scroll bars in each dimension should be always shown, never shown, or shown only if the inner interactor&#39;s size is large enough to require the scroll bar (default).
Definition: gscrollpane.h:40
virtual GInteractor * getInteractor() const
Returns the inner interactor being wrapped by this scroll pane.
Definition: gscrollpane.cpp:43
_Internal_QWidget* getInternalWidget() const override
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
Definition: gscrollpane.cpp:47
GScrollPane(GInteractor *interactor, QWidget* parent=nullptr)
Creates a new scroll pane to scroll the given interactor.
Definition: gscrollpane.cpp:19
virtual bool isInteractorStretch() const
Returns true if the inner interactor should stretch itself to its preferred size. ...
Definition: gscrollpane.cpp:63
string getType() const override
Returns a string representing the class name of this interactor, such as "GButton" or "GCheckBox"...
Definition: gscrollpane.cpp:51
QWidget* getWidget() const override
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
Definition: gscrollpane.cpp:59
A GScrollPane is a container that wraps another interactor with scroll bars.
Definition: gscrollpane.h:33
virtual void setInteractorStretch(bool stretch)
Sets whether the inner interactor should stretch itself to its preferred size.
Definition: gscrollpane.cpp:74
virtual ScrollBarPolicy getHorizontalScrollBarPolicy() const
Returns a constant indicating whether the horizontal scroll bar will be shown.
Definition: gscrollpane.cpp:39