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