]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: gauge.h | |
e54c96f1 | 3 | // Purpose: interface of wxGauge |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
526954c5 | 6 | // Licence: wxWindows licence |
23324ae1 FM |
7 | ///////////////////////////////////////////////////////////////////////////// |
8 | ||
e9321277 RD |
9 | |
10 | // ---------------------------------------------------------------------------- | |
11 | // wxGauge style flags | |
12 | // ---------------------------------------------------------------------------- | |
13 | ||
14 | #define wxGA_HORIZONTAL wxHORIZONTAL | |
15 | #define wxGA_VERTICAL wxVERTICAL | |
16 | ||
17 | // Win32 only, is default (and only) on some other platforms | |
18 | #define wxGA_SMOOTH 0x0020 | |
19 | ||
23324ae1 FM |
20 | /** |
21 | @class wxGauge | |
7c913512 | 22 | |
3d2cf884 BP |
23 | A gauge is a horizontal or vertical bar which shows a quantity (often |
24 | time). | |
7c913512 | 25 | |
23324ae1 | 26 | wxGauge supports two working modes: determinate and indeterminate progress. |
7c913512 | 27 | |
3d2cf884 BP |
28 | The first is the usual working mode (see SetValue() and SetRange()) while |
29 | the second can be used when the program is doing some processing but you | |
30 | don't know how much progress is being done. In this case, you can | |
31 | periodically call the Pulse() function to make the progress bar switch to | |
32 | indeterminate mode (graphically it's usually a set of blocks which move or | |
33 | bounce in the bar control). | |
7c913512 | 34 | |
23324ae1 | 35 | wxGauge supports dynamic switch between these two work modes. |
7c913512 | 36 | |
23324ae1 | 37 | There are no user commands for the gauge. |
7c913512 | 38 | |
23324ae1 | 39 | @beginStyleTable |
8c6791e4 | 40 | @style{wxGA_HORIZONTAL} |
23324ae1 | 41 | Creates a horizontal gauge. |
8c6791e4 | 42 | @style{wxGA_VERTICAL} |
23324ae1 | 43 | Creates a vertical gauge. |
8c6791e4 | 44 | @style{wxGA_SMOOTH} |
23324ae1 FM |
45 | Creates smooth progress bar with one pixel wide update step (not |
46 | supported by all platforms). | |
47 | @endStyleTable | |
7c913512 | 48 | |
23324ae1 FM |
49 | @library{wxcore} |
50 | @category{ctrl} | |
7e59b885 | 51 | @appearance{gauge.png} |
7c913512 | 52 | |
e54c96f1 | 53 | @see wxSlider, wxScrollBar |
23324ae1 FM |
54 | */ |
55 | class wxGauge : public wxControl | |
56 | { | |
57 | public: | |
3d2cf884 BP |
58 | /** |
59 | Default constructor. | |
60 | */ | |
61 | wxGauge(); | |
94d17b78 | 62 | |
23324ae1 FM |
63 | /** |
64 | Constructor, creating and showing a gauge. | |
3c4f71cc | 65 | |
7c913512 | 66 | @param parent |
4cc4bfaf | 67 | Window parent. |
7c913512 | 68 | @param id |
4cc4bfaf | 69 | Window identifier. |
7c913512 | 70 | @param range |
94d17b78 FM |
71 | Integer range (maximum value) of the gauge. |
72 | See SetRange() for more details about the meaning of this value | |
73 | when using the gauge in indeterminate mode. | |
7c913512 | 74 | @param pos |
4cc4bfaf | 75 | Window position. |
7c913512 | 76 | @param size |
4cc4bfaf | 77 | Window size. |
7c913512 | 78 | @param style |
3d2cf884 | 79 | Gauge style. |
12fd0e1d VZ |
80 | @param validator |
81 | Window validator. | |
7c913512 | 82 | @param name |
4cc4bfaf | 83 | Window name. |
3c4f71cc | 84 | |
4cc4bfaf | 85 | @see Create() |
23324ae1 | 86 | */ |
7c913512 FM |
87 | wxGauge(wxWindow* parent, wxWindowID id, int range, |
88 | const wxPoint& pos = wxDefaultPosition, | |
89 | const wxSize& size = wxDefaultSize, | |
90 | long style = wxGA_HORIZONTAL, | |
91 | const wxValidator& validator = wxDefaultValidator, | |
a44f3b5a | 92 | const wxString& name = wxGaugeNameStr); |
23324ae1 FM |
93 | |
94 | /** | |
95 | Destructor, destroying the gauge. | |
96 | */ | |
adaaa686 | 97 | virtual ~wxGauge(); |
23324ae1 FM |
98 | |
99 | /** | |
3d2cf884 BP |
100 | Creates the gauge for two-step construction. See wxGauge() for further |
101 | details. | |
23324ae1 FM |
102 | */ |
103 | bool Create(wxWindow* parent, wxWindowID id, int range, | |
104 | const wxPoint& pos = wxDefaultPosition, | |
43c48e1e | 105 | const wxSize& size = wxDefaultSize, long style = wxGA_HORIZONTAL, |
23324ae1 | 106 | const wxValidator& validator = wxDefaultValidator, |
43c48e1e | 107 | const wxString& name = wxGaugeNameStr); |
23324ae1 FM |
108 | |
109 | /** | |
110 | Returns the width of the 3D bezel face. | |
3c4f71cc | 111 | |
23324ae1 | 112 | @remarks This method is not implemented (returns 0) for most platforms. |
3c4f71cc | 113 | |
4cc4bfaf | 114 | @see SetBezelFace() |
23324ae1 | 115 | */ |
328f5751 | 116 | int GetBezelFace() const; |
23324ae1 FM |
117 | |
118 | /** | |
119 | Returns the maximum position of the gauge. | |
3c4f71cc | 120 | |
4cc4bfaf | 121 | @see SetRange() |
23324ae1 | 122 | */ |
328f5751 | 123 | int GetRange() const; |
23324ae1 FM |
124 | |
125 | /** | |
126 | Returns the 3D shadow margin width. | |
3c4f71cc | 127 | |
23324ae1 | 128 | @remarks This method is not implemented (returns 0) for most platforms. |
3c4f71cc | 129 | |
4cc4bfaf | 130 | @see SetShadowWidth() |
23324ae1 | 131 | */ |
328f5751 | 132 | int GetShadowWidth() const; |
23324ae1 FM |
133 | |
134 | /** | |
135 | Returns the current position of the gauge. | |
3c4f71cc | 136 | |
4cc4bfaf | 137 | @see SetValue() |
23324ae1 | 138 | */ |
328f5751 | 139 | int GetValue() const; |
23324ae1 FM |
140 | |
141 | /** | |
7c913512 | 142 | Returns @true if the gauge is vertical (has @c wxGA_VERTICAL style) and |
23324ae1 FM |
143 | @false otherwise. |
144 | */ | |
328f5751 | 145 | bool IsVertical() const; |
23324ae1 FM |
146 | |
147 | /** | |
3d2cf884 BP |
148 | Switch the gauge to indeterminate mode (if required) and makes the |
149 | gauge move a bit to indicate the user that some progress has been made. | |
150 | ||
151 | @note After calling this function the value returned by GetValue() is | |
4c51a665 | 152 | undefined and thus you need to explicitly call SetValue() if you |
3d2cf884 | 153 | want to restore the determinate mode. |
23324ae1 | 154 | */ |
adaaa686 | 155 | virtual void Pulse(); |
23324ae1 FM |
156 | |
157 | /** | |
158 | Sets the 3D bezel face width. | |
3c4f71cc | 159 | |
23324ae1 | 160 | @remarks This method is not implemented (doesn't do anything) for most |
4cc4bfaf | 161 | platforms. |
3c4f71cc | 162 | |
4cc4bfaf | 163 | @see GetBezelFace() |
23324ae1 FM |
164 | */ |
165 | void SetBezelFace(int width); | |
166 | ||
167 | /** | |
3d2cf884 BP |
168 | Sets the range (maximum value) of the gauge. This function makes the |
169 | gauge switch to determinate mode, if it's not already. | |
3c4f71cc | 170 | |
94d17b78 FM |
171 | When the gauge is in indeterminate mode, under wxMSW the gauge |
172 | repeatedly goes from zero to @a range and back; under other ports | |
173 | when in indeterminate mode, the @a range setting is ignored. | |
174 | ||
4cc4bfaf | 175 | @see GetRange() |
23324ae1 FM |
176 | */ |
177 | void SetRange(int range); | |
178 | ||
179 | /** | |
180 | Sets the 3D shadow width. | |
3c4f71cc | 181 | |
23324ae1 | 182 | @remarks This method is not implemented (doesn't do anything) for most |
4cc4bfaf | 183 | platforms. |
23324ae1 FM |
184 | */ |
185 | void SetShadowWidth(int width); | |
186 | ||
187 | /** | |
3d2cf884 BP |
188 | Sets the position of the gauge. The @a pos must be between 0 and the |
189 | gauge range as returned by GetRange(), inclusive. | |
190 | ||
23324ae1 FM |
191 | This function makes the gauge switch to determinate mode, if it was in |
192 | indeterminate mode before. | |
3c4f71cc | 193 | |
7c913512 | 194 | @param pos |
4cc4bfaf | 195 | Position for the gauge level. |
3c4f71cc | 196 | |
4cc4bfaf | 197 | @see GetValue() |
23324ae1 FM |
198 | */ |
199 | void SetValue(int pos); | |
200 | }; | |
e54c96f1 | 201 |