SGL
gscrollpane.h
1 /*
2  * File: gscrollpane.h
3  * -------------------
4  *
5  * @author Marty Stepp
6  * @version 2018/09/08
7  * - added doc comments for new documentation generation
8  * @version 2018/09/01
9  * - initial version
10  */
11 
12 
13 #ifndef _gscrollpane_h
14 #define _gscrollpane_h
15 
16 #include <string>
17 #include <QScrollArea>
18 
19 #include "ginteractor.h"
20 
21 class _Internal_QScrollArea;
22 
29 class GScrollPane : public GInteractor {
30 public:
40  };
41 
46  GScrollPane(GInteractor* interactor, QWidget* parent = nullptr);
47 
51  ~GScrollPane() override;
52 
57 
62 
66  virtual GInteractor* getInteractor() const;
67 
68  /* @inherit */
69  _Internal_QWidget* getInternalWidget() const override;
70 
71  /* @inherit */
72  string getType() const override;
73 
74  /* @inherit */
75  QWidget* getWidget() const override;
76 
81  virtual bool isInteractorStretch() const;
82 
86  virtual void setHorizontalScrollBarPolicy(ScrollBarPolicy policy);
87 
91  virtual void setScrollBarPolicy(ScrollBarPolicy policy);
92 
96  virtual void setVerticalScrollBarPolicy(ScrollBarPolicy policy);
97 
102  virtual void setInteractorStretch(bool stretch);
103 
104 private:
105  Q_DISABLE_COPY(GScrollPane)
106 
107  _Internal_QScrollArea* _iqscrollarea;
108  GInteractor* _interactor;
109  ScrollBarPolicy _horizontalScrollBarPolicy;
110  ScrollBarPolicy _verticalScrollBarPolicy;
111 
112  friend class _Internal_QScrollArea;
113 
114  static Qt::ScrollBarPolicy toQtScrollBarPolicy(ScrollBarPolicy policy);
115 };
116 
121 class _Internal_QScrollArea : public QScrollArea, public _Internal_QWidget {
122  Q_OBJECT
123 
124 public:
125  _Internal_QScrollArea(GScrollPane* gscrollpane, QWidget* parent = nullptr);
126  QSize sizeHint() const override;
127 
128 // private:
129  // GScrollPane* _gscrollpane;
130 };
131 
132 #endif // _gscrollpane_h
_Internal_QWidget* getInternalWidget() const override
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
Definition: gscrollpane.cpp:43
virtual GInteractor * getInteractor() const
Returns the inner interactor being wrapped by this scroll pane.
Definition: gscrollpane.cpp:39
virtual bool isInteractorStretch() const
Returns true if the inner interactor should stretch itself to its preferred size. ...
Definition: gscrollpane.cpp:59
GScrollPane(GInteractor *interactor, QWidget* parent=nullptr)
Creates a new scroll pane to scroll the given interactor.
Definition: gscrollpane.cpp:15
virtual ScrollBarPolicy getVerticalScrollBarPolicy() const
Returns a constant indicating whether the vertical scroll bar will be shown.
Definition: gscrollpane.cpp:51
Definition: gscrollpane.h:38
virtual ScrollBarPolicy getHorizontalScrollBarPolicy() const
Returns a constant indicating whether the horizontal scroll bar will be shown.
Definition: gscrollpane.cpp:35
string getType() const override
Returns a string representing the class name of this interactor, such as "GButton" or "GCheckBox"...
Definition: gscrollpane.cpp:47
virtual void setInteractorStretch(bool stretch)
Sets whether the inner interactor should stretch itself to its preferred size.
Definition: gscrollpane.cpp:70
QWidget* getWidget() const override
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
Definition: gscrollpane.cpp:55
This abstract class is the superclass for all graphical interactors.
Definition: ginteractor.h:48
A GScrollPane is a container that wraps another interactor with scroll bars.
Definition: gscrollpane.h:29
~GScrollPane() override
Frees memory allocated internally by the scroll pane.
Definition: gscrollpane.cpp:29
Definition: gscrollpane.h:37
virtual void setVerticalScrollBarPolicy(ScrollBarPolicy policy)
Sets whether the vertical scroll bar will be shown.
Definition: gscrollpane.cpp:82
virtual void setScrollBarPolicy(ScrollBarPolicy policy)
Sets whether the horizontal and vertical scroll bars will be shown.
Definition: gscrollpane.cpp:77
virtual void setHorizontalScrollBarPolicy(ScrollBarPolicy policy)
Sets whether the horizontal scroll bar will be shown.
Definition: gscrollpane.cpp:63
Definition: gscrollpane.h:39
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:36