]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: scrolbar.h | |
e54c96f1 | 3 | // Purpose: interface of wxScrollBar |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxScrollBar | |
11 | @wxheader{scrolbar.h} | |
7c913512 | 12 | |
23324ae1 FM |
13 | A wxScrollBar is a control that represents a horizontal or |
14 | vertical scrollbar. It is distinct from the two scrollbars that some windows | |
15 | provide automatically, but the two types of scrollbar share the way | |
16 | events are received. | |
7c913512 | 17 | |
23324ae1 | 18 | @beginStyleTable |
8c6791e4 | 19 | @style{wxSB_HORIZONTAL} |
23324ae1 | 20 | Specifies a horizontal scrollbar. |
8c6791e4 | 21 | @style{wxSB_VERTICAL} |
23324ae1 FM |
22 | Specifies a vertical scrollbar. |
23 | @endStyleTable | |
7c913512 | 24 | |
23324ae1 FM |
25 | @library{wxcore} |
26 | @category{ctrl} | |
f09b5681 | 27 | <!-- @appearance{scrollbar.png} --> |
7c913512 | 28 | |
f09b5681 | 29 | @see @ref overview_scrolling, @ref overview_eventhandling, wxScrolled |
23324ae1 FM |
30 | */ |
31 | class wxScrollBar : public wxControl | |
32 | { | |
33 | public: | |
34 | //@{ | |
35 | /** | |
36 | Constructor, creating and showing a scrollbar. | |
3c4f71cc | 37 | |
7c913512 | 38 | @param parent |
4cc4bfaf | 39 | Parent window. Must be non-@NULL. |
7c913512 | 40 | @param id |
4cc4bfaf | 41 | Window identifier. The value wxID_ANY indicates a default value. |
7c913512 | 42 | @param pos |
4cc4bfaf FM |
43 | Window position. If wxDefaultPosition is specified then a default |
44 | position is chosen. | |
7c913512 | 45 | @param size |
4cc4bfaf FM |
46 | Window size. If wxDefaultSize is specified then a default size |
47 | is chosen. | |
7c913512 | 48 | @param style |
4cc4bfaf | 49 | Window style. See wxScrollBar. |
7c913512 | 50 | @param validator |
4cc4bfaf | 51 | Window validator. |
7c913512 | 52 | @param name |
4cc4bfaf | 53 | Window name. |
3c4f71cc | 54 | |
4cc4bfaf | 55 | @see Create(), wxValidator |
23324ae1 FM |
56 | */ |
57 | wxScrollBar(); | |
7c913512 FM |
58 | wxScrollBar(wxWindow* parent, wxWindowID id, |
59 | const wxPoint& pos = wxDefaultPosition, | |
60 | const wxSize& size = wxDefaultSize, | |
61 | long style = wxSB_HORIZONTAL, | |
62 | const wxValidator& validator = wxDefaultValidator, | |
63 | const wxString& name = "scrollBar"); | |
23324ae1 FM |
64 | //@} |
65 | ||
66 | /** | |
67 | Destructor, destroying the scrollbar. | |
68 | */ | |
69 | ~wxScrollBar(); | |
70 | ||
71 | /** | |
72 | Scrollbar creation function called by the scrollbar constructor. | |
73 | See wxScrollBar() for details. | |
74 | */ | |
75 | bool Create(wxWindow* parent, wxWindowID id, | |
76 | const wxPoint& pos = wxDefaultPosition, | |
77 | const wxSize& size = wxDefaultSize, | |
78 | long style = wxSB_HORIZONTAL, | |
79 | const wxValidator& validator = wxDefaultValidator, | |
80 | const wxString& name = "scrollBar"); | |
81 | ||
82 | /** | |
83 | Returns the page size of the scrollbar. This is the number of scroll units | |
84 | that will be scrolled when the user pages up or down. Often it is the | |
85 | same as the thumb size. | |
3c4f71cc | 86 | |
4cc4bfaf | 87 | @see SetScrollbar() |
23324ae1 | 88 | */ |
328f5751 | 89 | int GetPageSize() const; |
23324ae1 FM |
90 | |
91 | /** | |
92 | Returns the length of the scrollbar. | |
3c4f71cc | 93 | |
4cc4bfaf | 94 | @see SetScrollbar() |
23324ae1 | 95 | */ |
328f5751 | 96 | int GetRange() const; |
23324ae1 FM |
97 | |
98 | /** | |
99 | Returns the current position of the scrollbar thumb. | |
3c4f71cc | 100 | |
4cc4bfaf | 101 | @see SetThumbPosition() |
23324ae1 | 102 | */ |
328f5751 | 103 | int GetThumbPosition() const; |
23324ae1 FM |
104 | |
105 | /** | |
106 | Returns the thumb or 'view' size. | |
3c4f71cc | 107 | |
4cc4bfaf | 108 | @see SetScrollbar() |
23324ae1 | 109 | */ |
328f5751 | 110 | int GetThumbSize() const; |
23324ae1 FM |
111 | |
112 | /** | |
113 | Sets the scrollbar properties. | |
3c4f71cc | 114 | |
7c913512 | 115 | @param position |
4cc4bfaf | 116 | The position of the scrollbar in scroll units. |
7c913512 | 117 | @param thumbSize |
4cc4bfaf | 118 | The size of the thumb, or visible portion of the scrollbar, in scroll units. |
7c913512 | 119 | @param range |
4cc4bfaf | 120 | The maximum position of the scrollbar. |
7c913512 | 121 | @param pageSize |
4cc4bfaf FM |
122 | The size of the page size in scroll units. This is the number of units |
123 | the scrollbar will scroll when it is paged up or down. Often it is the same | |
124 | as | |
125 | the thumb size. | |
7c913512 | 126 | @param refresh |
4cc4bfaf | 127 | @true to redraw the scrollbar, @false otherwise. |
3c4f71cc | 128 | |
23324ae1 | 129 | @remarks Let's say you wish to display 50 lines of text, using the same |
4cc4bfaf FM |
130 | font. The window is sized so that you can only see 16 |
131 | lines at a time. | |
23324ae1 FM |
132 | */ |
133 | virtual void SetScrollbar(int position, int thumbSize, int range, | |
134 | int pageSize, | |
4cc4bfaf | 135 | bool refresh = true); |
23324ae1 FM |
136 | |
137 | /** | |
138 | Sets the position of the scrollbar. | |
3c4f71cc | 139 | |
7c913512 | 140 | @param viewStart |
4cc4bfaf | 141 | The position of the scrollbar thumb. |
3c4f71cc | 142 | |
4cc4bfaf | 143 | @see GetThumbPosition() |
23324ae1 FM |
144 | */ |
145 | void SetThumbPosition(int viewStart); | |
146 | }; | |
e54c96f1 | 147 |