]>
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: | |
671600d8 RR |
34 | /** |
35 | Default constructor | |
36 | */ | |
37 | wxScrollBar(); | |
38 | ||
23324ae1 FM |
39 | /** |
40 | Constructor, creating and showing a scrollbar. | |
3c4f71cc | 41 | |
7c913512 | 42 | @param parent |
4cc4bfaf | 43 | Parent window. Must be non-@NULL. |
7c913512 | 44 | @param id |
4cc4bfaf | 45 | Window identifier. The value wxID_ANY indicates a default value. |
7c913512 | 46 | @param pos |
4cc4bfaf FM |
47 | Window position. If wxDefaultPosition is specified then a default |
48 | position is chosen. | |
7c913512 | 49 | @param size |
4cc4bfaf FM |
50 | Window size. If wxDefaultSize is specified then a default size |
51 | is chosen. | |
7c913512 | 52 | @param style |
4cc4bfaf | 53 | Window style. See wxScrollBar. |
7c913512 | 54 | @param validator |
4cc4bfaf | 55 | Window validator. |
7c913512 | 56 | @param name |
4cc4bfaf | 57 | Window name. |
3c4f71cc | 58 | |
4cc4bfaf | 59 | @see Create(), wxValidator |
23324ae1 | 60 | */ |
7c913512 FM |
61 | wxScrollBar(wxWindow* parent, wxWindowID id, |
62 | const wxPoint& pos = wxDefaultPosition, | |
63 | const wxSize& size = wxDefaultSize, | |
64 | long style = wxSB_HORIZONTAL, | |
65 | const wxValidator& validator = wxDefaultValidator, | |
66 | const wxString& name = "scrollBar"); | |
23324ae1 FM |
67 | |
68 | /** | |
69 | Destructor, destroying the scrollbar. | |
70 | */ | |
71 | ~wxScrollBar(); | |
72 | ||
73 | /** | |
74 | Scrollbar creation function called by the scrollbar constructor. | |
75 | See wxScrollBar() for details. | |
76 | */ | |
77 | bool Create(wxWindow* parent, wxWindowID id, | |
78 | const wxPoint& pos = wxDefaultPosition, | |
79 | const wxSize& size = wxDefaultSize, | |
80 | long style = wxSB_HORIZONTAL, | |
81 | const wxValidator& validator = wxDefaultValidator, | |
82 | const wxString& name = "scrollBar"); | |
83 | ||
84 | /** | |
85 | Returns the page size of the scrollbar. This is the number of scroll units | |
86 | that will be scrolled when the user pages up or down. Often it is the | |
87 | same as the thumb size. | |
3c4f71cc | 88 | |
4cc4bfaf | 89 | @see SetScrollbar() |
23324ae1 | 90 | */ |
328f5751 | 91 | int GetPageSize() const; |
23324ae1 FM |
92 | |
93 | /** | |
94 | Returns the length of the scrollbar. | |
3c4f71cc | 95 | |
4cc4bfaf | 96 | @see SetScrollbar() |
23324ae1 | 97 | */ |
328f5751 | 98 | int GetRange() const; |
23324ae1 FM |
99 | |
100 | /** | |
101 | Returns the current position of the scrollbar thumb. | |
3c4f71cc | 102 | |
4cc4bfaf | 103 | @see SetThumbPosition() |
23324ae1 | 104 | */ |
328f5751 | 105 | int GetThumbPosition() const; |
23324ae1 FM |
106 | |
107 | /** | |
108 | Returns the thumb or 'view' size. | |
3c4f71cc | 109 | |
4cc4bfaf | 110 | @see SetScrollbar() |
23324ae1 | 111 | */ |
328f5751 | 112 | int GetThumbSize() const; |
23324ae1 FM |
113 | |
114 | /** | |
115 | Sets the scrollbar properties. | |
3c4f71cc | 116 | |
7c913512 | 117 | @param position |
4cc4bfaf | 118 | The position of the scrollbar in scroll units. |
7c913512 | 119 | @param thumbSize |
4cc4bfaf | 120 | The size of the thumb, or visible portion of the scrollbar, in scroll units. |
7c913512 | 121 | @param range |
4cc4bfaf | 122 | The maximum position of the scrollbar. |
7c913512 | 123 | @param pageSize |
4cc4bfaf FM |
124 | The size of the page size in scroll units. This is the number of units |
125 | the scrollbar will scroll when it is paged up or down. Often it is the same | |
126 | as | |
127 | the thumb size. | |
7c913512 | 128 | @param refresh |
4cc4bfaf | 129 | @true to redraw the scrollbar, @false otherwise. |
3c4f71cc | 130 | |
23324ae1 | 131 | @remarks Let's say you wish to display 50 lines of text, using the same |
4cc4bfaf FM |
132 | font. The window is sized so that you can only see 16 |
133 | lines at a time. | |
23324ae1 FM |
134 | */ |
135 | virtual void SetScrollbar(int position, int thumbSize, int range, | |
136 | int pageSize, | |
4cc4bfaf | 137 | bool refresh = true); |
23324ae1 FM |
138 | |
139 | /** | |
140 | Sets the position of the scrollbar. | |
3c4f71cc | 141 | |
7c913512 | 142 | @param viewStart |
4cc4bfaf | 143 | The position of the scrollbar thumb. |
3c4f71cc | 144 | |
4cc4bfaf | 145 | @see GetThumbPosition() |
23324ae1 FM |
146 | */ |
147 | void SetThumbPosition(int viewStart); | |
148 | }; | |
e54c96f1 | 149 |