]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: gdicmn.h | |
e54c96f1 | 3 | // Purpose: interface of wxRealPoint |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
698d17c3 FM |
9 | |
10 | /** | |
3d2cf884 | 11 | Bitmap type flags. See wxBitmap and wxImage classes. |
698d17c3 FM |
12 | */ |
13 | enum wxBitmapType | |
14 | { | |
15 | wxBITMAP_TYPE_INVALID, | |
16 | wxBITMAP_TYPE_BMP, | |
17 | wxBITMAP_TYPE_BMP_RESOURCE, | |
18 | wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE, | |
19 | wxBITMAP_TYPE_ICO, | |
20 | wxBITMAP_TYPE_ICO_RESOURCE, | |
21 | wxBITMAP_TYPE_CUR, | |
22 | wxBITMAP_TYPE_CUR_RESOURCE, | |
23 | wxBITMAP_TYPE_XBM, | |
24 | wxBITMAP_TYPE_XBM_DATA, | |
25 | wxBITMAP_TYPE_XPM, | |
26 | wxBITMAP_TYPE_XPM_DATA, | |
27 | wxBITMAP_TYPE_TIF, | |
28 | wxBITMAP_TYPE_TIF_RESOURCE, | |
29 | wxBITMAP_TYPE_GIF, | |
30 | wxBITMAP_TYPE_GIF_RESOURCE, | |
31 | wxBITMAP_TYPE_PNG, | |
32 | wxBITMAP_TYPE_PNG_RESOURCE, | |
33 | wxBITMAP_TYPE_JPEG, | |
34 | wxBITMAP_TYPE_JPEG_RESOURCE, | |
35 | wxBITMAP_TYPE_PNM, | |
36 | wxBITMAP_TYPE_PNM_RESOURCE, | |
37 | wxBITMAP_TYPE_PCX, | |
38 | wxBITMAP_TYPE_PCX_RESOURCE, | |
39 | wxBITMAP_TYPE_PICT, | |
40 | wxBITMAP_TYPE_PICT_RESOURCE, | |
41 | wxBITMAP_TYPE_ICON, | |
42 | wxBITMAP_TYPE_ICON_RESOURCE, | |
43 | wxBITMAP_TYPE_ANI, | |
44 | wxBITMAP_TYPE_IFF, | |
45 | wxBITMAP_TYPE_TGA, | |
46 | wxBITMAP_TYPE_MACCURSOR, | |
47 | wxBITMAP_TYPE_MACCURSOR_RESOURCE, | |
48 | wxBITMAP_TYPE_ANY = 50 | |
49 | }; | |
50 | ||
808f5a3a FM |
51 | /** |
52 | Polygon filling mode. See wxDC::DrawPolygon. | |
53 | */ | |
54 | enum wxPolygonFillMode | |
55 | { | |
56 | wxODDEVEN_RULE = 1, | |
57 | wxWINDING_RULE | |
58 | }; | |
59 | ||
698d17c3 | 60 | /** |
3d2cf884 | 61 | Standard cursors. See wxCursor. |
698d17c3 FM |
62 | */ |
63 | enum wxStockCursor | |
64 | { | |
65 | wxCURSOR_NONE, | |
3d2cf884 BP |
66 | wxCURSOR_ARROW, ///< A standard arrow cursor. |
67 | wxCURSOR_RIGHT_ARROW, ///< A standard arrow cursor pointing to the right. | |
68 | wxCURSOR_BULLSEYE, ///< Bullseye cursor. | |
69 | wxCURSOR_CHAR, ///< Rectangular character cursor. | |
70 | wxCURSOR_CROSS, ///< A cross cursor. | |
71 | wxCURSOR_HAND, ///< A hand cursor. | |
72 | wxCURSOR_IBEAM, ///< An I-beam cursor (vertical line). | |
73 | wxCURSOR_LEFT_BUTTON, ///< Represents a mouse with the left button depressed. | |
74 | wxCURSOR_MAGNIFIER, ///< A magnifier icon. | |
75 | wxCURSOR_MIDDLE_BUTTON, ///< Represents a mouse with the middle button depressed. | |
76 | wxCURSOR_NO_ENTRY, ///< A no-entry sign cursor. | |
77 | wxCURSOR_PAINT_BRUSH, ///< A paintbrush cursor. | |
78 | wxCURSOR_PENCIL, ///< A pencil cursor. | |
79 | wxCURSOR_POINT_LEFT, ///< A cursor that points left. | |
80 | wxCURSOR_POINT_RIGHT, ///< A cursor that points right. | |
81 | wxCURSOR_QUESTION_ARROW, ///< An arrow and question mark. | |
82 | wxCURSOR_RIGHT_BUTTON, ///< Represents a mouse with the right button depressed. | |
83 | wxCURSOR_SIZENESW, ///< A sizing cursor pointing NE-SW. | |
84 | wxCURSOR_SIZENS, ///< A sizing cursor pointing N-S. | |
85 | wxCURSOR_SIZENWSE, ///< A sizing cursor pointing NW-SE. | |
86 | wxCURSOR_SIZEWE, ///< A sizing cursor pointing W-E. | |
87 | wxCURSOR_SIZING, ///< A general sizing cursor. | |
88 | wxCURSOR_SPRAYCAN, ///< A spraycan cursor. | |
89 | wxCURSOR_WAIT, ///< A wait cursor. | |
90 | wxCURSOR_WATCH, ///< A watch cursor. | |
91 | wxCURSOR_BLANK, ///< Transparent cursor. | |
92 | wxCURSOR_DEFAULT, ///< Standard X11 cursor (only in wxGTK). | |
93 | wxCURSOR_COPY_ARROW , ///< MacOS Theme Plus arrow (only in wxMac). | |
94 | wxCURSOR_CROSS_REVERSE, ///< Only available on wxX11. | |
95 | wxCURSOR_DOUBLE_ARROW, ///< Only available on wxX11. | |
96 | wxCURSOR_BASED_ARROW_UP, ///< Only available on wxX11. | |
97 | wxCURSOR_BASED_ARROW_DOWN, ///< Only available on wxX11. | |
98 | wxCURSOR_ARROWWAIT, ///< A wait cursor with a standard arrow. | |
698d17c3 FM |
99 | wxCURSOR_MAX |
100 | }; | |
101 | ||
102 | ||
103 | ||
23324ae1 FM |
104 | /** |
105 | @class wxRealPoint | |
7c913512 | 106 | |
3d2cf884 | 107 | A wxRealPoint is a useful data structure for graphics operations. |
65874118 | 108 | |
3d2cf884 BP |
109 | It contains floating point @e x and @e y members. See wxPoint for an |
110 | integer version. | |
7c913512 | 111 | |
23324ae1 FM |
112 | @library{wxcore} |
113 | @category{data} | |
7c913512 | 114 | |
e54c96f1 | 115 | @see wxPoint |
23324ae1 | 116 | */ |
7c913512 | 117 | class wxRealPoint |
23324ae1 FM |
118 | { |
119 | public: | |
65874118 FM |
120 | wxRealPoint(); |
121 | ||
23324ae1 | 122 | /** |
65874118 | 123 | Initializes the point with the given coordinates. |
23324ae1 | 124 | */ |
7c913512 | 125 | wxRealPoint(double x, double y); |
65874118 FM |
126 | |
127 | /** | |
128 | X coordinate of this point. | |
129 | */ | |
130 | double x; | |
131 | ||
132 | /** | |
133 | Y coordinate of this point. | |
134 | */ | |
135 | double y; | |
23324ae1 FM |
136 | }; |
137 | ||
138 | ||
e54c96f1 | 139 | |
23324ae1 FM |
140 | /** |
141 | @class wxRect | |
7c913512 | 142 | |
23324ae1 | 143 | A class for manipulating rectangles. |
7c913512 | 144 | |
23324ae1 FM |
145 | @library{wxcore} |
146 | @category{data} | |
7c913512 | 147 | |
e54c96f1 | 148 | @see wxPoint, wxSize |
23324ae1 | 149 | */ |
7c913512 | 150 | class wxRect |
23324ae1 FM |
151 | { |
152 | public: | |
23324ae1 | 153 | /** |
3d2cf884 | 154 | Default constructor. |
23324ae1 FM |
155 | */ |
156 | wxRect(); | |
3d2cf884 BP |
157 | /** |
158 | Creates a wxRect object from @a x, @a y, @a width and @a height values. | |
159 | */ | |
7c913512 | 160 | wxRect(int x, int y, int width, int height); |
3d2cf884 BP |
161 | /** |
162 | Creates a wxRect object from top-left and bottom-right points. | |
163 | */ | |
7c913512 | 164 | wxRect(const wxPoint& topLeft, const wxPoint& bottomRight); |
3d2cf884 BP |
165 | /** |
166 | Creates a wxRect object from position and @a size values. | |
167 | */ | |
7c913512 | 168 | wxRect(const wxPoint& pos, const wxSize& size); |
3d2cf884 BP |
169 | /** |
170 | Creates a wxRect object from @a size values at the origin. | |
171 | */ | |
7c913512 | 172 | wxRect(const wxSize& size); |
23324ae1 FM |
173 | |
174 | //@{ | |
175 | /** | |
3d2cf884 BP |
176 | Returns the rectangle having the same size as this one but centered |
177 | relatively to the given rectangle @a r. By default, rectangle is | |
178 | centred in both directions but if @a dir includes only @c wxVERTICAL or | |
179 | only @c wxHORIZONTAL, then it is only centered in this direction while | |
23324ae1 FM |
180 | the other component of its position remains unchanged. |
181 | */ | |
328f5751 | 182 | wxRect CentreIn(const wxRect& r, int dir = wxBOTH) const; |
3d2cf884 | 183 | wxRect CenterIn(const wxRect& r, int dir = wxBOTH) const; |
23324ae1 FM |
184 | //@} |
185 | ||
23324ae1 | 186 | /** |
3d2cf884 BP |
187 | Returns @true if the given point is inside the rectangle (or on its |
188 | boundary) and @false otherwise. | |
23324ae1 | 189 | */ |
328f5751 | 190 | bool Contains(int x, int y) const; |
3d2cf884 BP |
191 | /** |
192 | Returns @true if the given point is inside the rectangle (or on its | |
193 | boundary) and @false otherwise. | |
194 | */ | |
195 | bool Contains(const wxPoint& pt) const; | |
196 | /** | |
197 | Returns @true if the given rectangle is completely inside this | |
198 | rectangle (or touches its boundary) and @false otherwise. | |
199 | */ | |
200 | bool Contains(const wxRect& rect) const; | |
23324ae1 FM |
201 | |
202 | //@{ | |
203 | /** | |
204 | Decrease the rectangle size. | |
8024723d | 205 | |
3d2cf884 BP |
206 | This method is the opposite from Inflate(): Deflate(a, b) is equivalent |
207 | to Inflate(-a, -b). Please refer to Inflate() for full description. | |
23324ae1 | 208 | */ |
3d2cf884 BP |
209 | void Deflate(wxCoord dx, wxCoord dy); |
210 | void Deflate(const wxSize& diff); | |
211 | void Deflate(wxCoord diff); | |
328f5751 | 212 | wxRect Deflate(wxCoord dx, wxCoord dy) const; |
23324ae1 FM |
213 | //@} |
214 | ||
215 | /** | |
216 | Gets the bottom point of the rectangle. | |
217 | */ | |
328f5751 | 218 | int GetBottom() const; |
23324ae1 FM |
219 | |
220 | /** | |
221 | Gets the position of the bottom left corner. | |
222 | */ | |
328f5751 | 223 | wxPoint GetBottomLeft() const; |
23324ae1 FM |
224 | |
225 | /** | |
226 | Gets the position of the bottom right corner. | |
227 | */ | |
328f5751 | 228 | wxPoint GetBottomRight() const; |
23324ae1 FM |
229 | |
230 | /** | |
231 | Gets the height member. | |
232 | */ | |
328f5751 | 233 | int GetHeight() const; |
23324ae1 FM |
234 | |
235 | /** | |
3d2cf884 | 236 | Gets the left point of the rectangle (the same as GetX()). |
23324ae1 | 237 | */ |
328f5751 | 238 | int GetLeft() const; |
23324ae1 FM |
239 | |
240 | /** | |
241 | Gets the position. | |
242 | */ | |
328f5751 | 243 | wxPoint GetPosition() const; |
23324ae1 FM |
244 | |
245 | /** | |
246 | Gets the right point of the rectangle. | |
247 | */ | |
328f5751 | 248 | int GetRight() const; |
23324ae1 FM |
249 | |
250 | /** | |
251 | Gets the size. | |
8024723d | 252 | |
4cc4bfaf | 253 | @see SetSize() |
23324ae1 | 254 | */ |
328f5751 | 255 | wxSize GetSize() const; |
23324ae1 FM |
256 | |
257 | /** | |
3d2cf884 | 258 | Gets the top point of the rectangle (the same as GetY()). |
23324ae1 | 259 | */ |
328f5751 | 260 | int GetTop() const; |
23324ae1 FM |
261 | |
262 | /** | |
7c913512 | 263 | Gets the position of the top left corner of the rectangle, same as |
23324ae1 FM |
264 | GetPosition(). |
265 | */ | |
328f5751 | 266 | wxPoint GetTopLeft() const; |
23324ae1 FM |
267 | |
268 | /** | |
269 | Gets the position of the top right corner. | |
270 | */ | |
328f5751 | 271 | wxPoint GetTopRight() const; |
23324ae1 FM |
272 | |
273 | /** | |
274 | Gets the width member. | |
275 | */ | |
328f5751 | 276 | int GetWidth() const; |
23324ae1 FM |
277 | |
278 | /** | |
279 | Gets the x member. | |
280 | */ | |
328f5751 | 281 | int GetX() const; |
23324ae1 FM |
282 | |
283 | /** | |
284 | Gets the y member. | |
285 | */ | |
328f5751 | 286 | int GetY() const; |
23324ae1 FM |
287 | |
288 | //@{ | |
289 | /** | |
290 | Increases the size of the rectangle. | |
3d2cf884 BP |
291 | |
292 | The left border is moved farther left and the right border is moved | |
293 | farther right by @a dx. The upper border is moved farther up and the | |
294 | bottom border is moved farther down by @a dy. (Note the the width and | |
295 | height of the rectangle thus change by 2*dx and 2*dy, respectively.) If | |
296 | one or both of @a dx and @a dy are negative, the opposite happens: the | |
297 | rectangle size decreases in the respective direction. | |
298 | ||
299 | Inflating and deflating behaves "naturally". Defined more precisely, | |
300 | that means: | |
301 | -# "Real" inflates (that is, @a dx and/or @a dy = 0) are not | |
302 | constrained. Thus inflating a rectangle can cause its upper left | |
303 | corner to move into the negative numbers. (2.5.4 and older forced | |
304 | the top left coordinate to not fall below (0, 0), which implied a | |
305 | forced move of the rectangle.) | |
306 | -# Deflates are clamped to not reduce the width or height of the | |
307 | rectangle below zero. In such cases, the top-left corner is | |
308 | nonetheless handled properly. For example, a rectangle at (10, 10) | |
309 | with size (20, 40) that is inflated by (-15, -15) will become | |
310 | located at (20, 25) at size (0, 10). Finally, observe that the width | |
311 | and height are treated independently. In the above example, the | |
312 | width is reduced by 20, whereas the height is reduced by the full 30 | |
313 | (rather than also stopping at 20, when the width reached zero). | |
8024723d | 314 | |
4cc4bfaf | 315 | @see Deflate() |
23324ae1 | 316 | */ |
3d2cf884 BP |
317 | void Inflate(wxCoord dx, wxCoord dy); |
318 | void Inflate(const wxSize& diff); | |
319 | void Inflate(wxCoord diff); | |
328f5751 | 320 | wxRect Inflate(wxCoord dx, wxCoord dy) const; |
23324ae1 FM |
321 | //@} |
322 | ||
23324ae1 | 323 | /** |
c909e907 | 324 | Modifies this rectangle to contain the overlapping portion of this rectangle |
3d2cf884 | 325 | and the one passed in as parameter. |
c909e907 FM |
326 | |
327 | @return This rectangle, modified. | |
23324ae1 | 328 | */ |
3d2cf884 | 329 | wxRect& Intersect(const wxRect& rect); |
c909e907 FM |
330 | |
331 | /** | |
332 | Returns the overlapping portion of this rectangle and the one passed in as | |
333 | parameter. | |
334 | */ | |
335 | wxRect Intersect(const wxRect& rect) const; | |
23324ae1 FM |
336 | |
337 | /** | |
338 | Returns @true if this rectangle has a non-empty intersection with the | |
4cc4bfaf | 339 | rectangle @a rect and @false otherwise. |
23324ae1 | 340 | */ |
328f5751 | 341 | bool Intersects(const wxRect& rect) const; |
23324ae1 FM |
342 | |
343 | /** | |
3d2cf884 BP |
344 | Returns @true if this rectangle has a width or height less than or |
345 | equal to 0 and @false otherwise. | |
23324ae1 | 346 | */ |
328f5751 | 347 | bool IsEmpty() const; |
23324ae1 FM |
348 | |
349 | //@{ | |
350 | /** | |
4cc4bfaf FM |
351 | Moves the rectangle by the specified offset. If @a dx is positive, the |
352 | rectangle is moved to the right, if @a dy is positive, it is moved to the | |
23324ae1 FM |
353 | bottom, otherwise it is moved to the left or top respectively. |
354 | */ | |
355 | void Offset(wxCoord dx, wxCoord dy); | |
7c913512 | 356 | void Offset(const wxPoint& pt); |
23324ae1 FM |
357 | //@} |
358 | ||
359 | /** | |
360 | Sets the height. | |
361 | */ | |
362 | void SetHeight(int height); | |
363 | ||
364 | /** | |
365 | Sets the size. | |
8024723d | 366 | |
4cc4bfaf | 367 | @see GetSize() |
23324ae1 FM |
368 | */ |
369 | void SetSize(const wxSize& s); | |
370 | ||
371 | /** | |
372 | Sets the width. | |
373 | */ | |
374 | void SetWidth(int width); | |
375 | ||
376 | /** | |
377 | Sets the x position. | |
378 | */ | |
4cc4bfaf | 379 | void SetX(int x); |
23324ae1 FM |
380 | |
381 | /** | |
382 | Sets the y position. | |
383 | */ | |
4cc4bfaf | 384 | void SetY(int y); |
23324ae1 FM |
385 | |
386 | //@{ | |
387 | /** | |
3d2cf884 BP |
388 | Modifies the rectangle to contain the bounding box of this rectangle |
389 | and the one passed in as parameter. | |
23324ae1 | 390 | */ |
3d2cf884 BP |
391 | wxRect Union(const wxRect& rect) const; |
392 | wxRect& Union(const wxRect& rect); | |
23324ae1 FM |
393 | //@} |
394 | ||
395 | /** | |
3d2cf884 | 396 | Inequality operator. |
23324ae1 | 397 | */ |
3d2cf884 | 398 | bool operator !=(const wxRect& r1, const wxRect& r2); |
23324ae1 | 399 | |
3d2cf884 BP |
400 | //@{ |
401 | /** | |
402 | Like Union(), but doesn't treat empty rectangles specially. | |
403 | */ | |
404 | wxRect operator +(const wxRect& r1, const wxRect& r2); | |
405 | wxRect& operator +=(const wxRect& r); | |
406 | //@} | |
23324ae1 FM |
407 | |
408 | //@{ | |
409 | /** | |
410 | Returns the intersection of two rectangles (which may be empty). | |
411 | */ | |
3d2cf884 BP |
412 | wxRect operator *(const wxRect& r1, const wxRect& r2); |
413 | wxRect& operator *=(const wxRect& r); | |
23324ae1 FM |
414 | //@} |
415 | ||
416 | /** | |
417 | Assignment operator. | |
418 | */ | |
5267aefd | 419 | wxRect& operator=(const wxRect& rect); |
23324ae1 FM |
420 | |
421 | /** | |
422 | Equality operator. | |
423 | */ | |
424 | bool operator ==(const wxRect& r1, const wxRect& r2); | |
425 | ||
426 | /** | |
3d2cf884 | 427 | Height member. |
23324ae1 | 428 | */ |
3d2cf884 | 429 | int height; |
23324ae1 | 430 | |
3d2cf884 BP |
431 | /** |
432 | Width member. | |
433 | */ | |
434 | int width; | |
23324ae1 FM |
435 | |
436 | /** | |
23324ae1 FM |
437 | x coordinate of the top-level corner of the rectangle. |
438 | */ | |
3d2cf884 | 439 | int x; |
23324ae1 FM |
440 | |
441 | /** | |
23324ae1 FM |
442 | y coordinate of the top-level corner of the rectangle. |
443 | */ | |
3d2cf884 | 444 | int y; |
23324ae1 FM |
445 | }; |
446 | ||
447 | ||
e54c96f1 | 448 | |
23324ae1 FM |
449 | /** |
450 | @class wxPoint | |
7c913512 | 451 | |
3d2cf884 | 452 | A wxPoint is a useful data structure for graphics operations. |
7c913512 | 453 | |
3d2cf884 BP |
454 | It contains integer @e x and @e y members. See wxRealPoint for a floating |
455 | point version. | |
7c913512 | 456 | |
23324ae1 FM |
457 | @library{wxcore} |
458 | @category{data} | |
7c913512 | 459 | |
65874118 FM |
460 | @stdobjects |
461 | ::wxDefaultPosition | |
462 | ||
e54c96f1 | 463 | @see wxRealPoint |
23324ae1 | 464 | */ |
7c913512 | 465 | class wxPoint |
23324ae1 FM |
466 | { |
467 | public: | |
468 | //@{ | |
469 | /** | |
3d2cf884 | 470 | Constructs a point. |
23324ae1 FM |
471 | */ |
472 | wxPoint(); | |
7c913512 | 473 | wxPoint(int x, int y); |
23324ae1 FM |
474 | //@} |
475 | ||
23324ae1 | 476 | /** |
3d2cf884 | 477 | Assignment operator. |
23324ae1 | 478 | */ |
5267aefd | 479 | wxPoint& operator=(const wxPoint& pt); |
3d2cf884 | 480 | |
7c913512 FM |
481 | bool operator ==(const wxPoint& p1, const wxPoint& p2); |
482 | bool operator !=(const wxPoint& p1, const wxPoint& p2); | |
3d2cf884 | 483 | |
7c913512 FM |
484 | wxPoint operator +(const wxPoint& p1, const wxPoint& p2); |
485 | wxPoint operator -(const wxPoint& p1, const wxPoint& p2); | |
3d2cf884 BP |
486 | |
487 | wxPoint& operator +=(const wxPoint& pt); | |
488 | wxPoint& operator -=(const wxPoint& pt); | |
489 | ||
7c913512 FM |
490 | wxPoint operator +(const wxPoint& pt, const wxSize& sz); |
491 | wxPoint operator -(const wxPoint& pt, const wxSize& sz); | |
492 | wxPoint operator +(const wxSize& sz, const wxPoint& pt); | |
493 | wxPoint operator -(const wxSize& sz, const wxPoint& pt); | |
3d2cf884 BP |
494 | |
495 | wxPoint& operator +=(const wxSize& sz); | |
496 | wxPoint& operator -=(const wxSize& sz); | |
23324ae1 FM |
497 | |
498 | /** | |
23324ae1 FM |
499 | x member. |
500 | */ | |
3d2cf884 | 501 | int x; |
23324ae1 FM |
502 | |
503 | /** | |
23324ae1 FM |
504 | y member. |
505 | */ | |
3d2cf884 | 506 | int y; |
23324ae1 FM |
507 | }; |
508 | ||
65874118 | 509 | /** |
3d2cf884 | 510 | Global istance of a wxPoint initialized with values (-1,-1). |
65874118 FM |
511 | */ |
512 | wxPoint wxDefaultPosition; | |
23324ae1 | 513 | |
e54c96f1 | 514 | |
23324ae1 FM |
515 | /** |
516 | @class wxColourDatabase | |
7c913512 | 517 | |
23324ae1 | 518 | wxWidgets maintains a database of standard RGB colours for a predefined |
3d2cf884 BP |
519 | set of named colours. The application may add to this set if desired by |
520 | using AddColour() and may use it to look up colours by names using Find() | |
521 | or find the names for the standard colour using FindName(). | |
522 | ||
523 | There is one predefined, global instance of this class called | |
524 | ::wxTheColourDatabase. | |
525 | ||
526 | The standard database contains at least the following colours: | |
527 | ||
528 | @beginTable | |
529 | <tr><td> | |
530 | AQUAMARINE | |
531 | @n BLACK | |
532 | @n BLUE | |
533 | @n BLUE VIOLET | |
534 | @n BROWN | |
535 | @n CADET BLUE | |
536 | @n CORAL | |
537 | @n CORNFLOWER BLUE | |
538 | @n CYAN | |
539 | @n DARK GREY | |
540 | @n DARK GREEN | |
541 | @n DARK OLIVE GREEN | |
542 | @n DARK ORCHID | |
543 | @n DARK SLATE BLUE | |
544 | @n DARK SLATE GREY | |
545 | @n DARK TURQUOISE | |
546 | @n DIM GREY | |
547 | </td><td> | |
548 | FIREBRICK | |
549 | @n FOREST GREEN | |
550 | @n GOLD | |
551 | @n GOLDENROD | |
552 | @n GREY | |
553 | @n GREEN | |
554 | @n GREEN YELLOW | |
555 | @n INDIAN RED | |
556 | @n KHAKI | |
557 | @n LIGHT BLUE | |
558 | @n LIGHT GREY | |
559 | @n LIGHT STEEL BLUE | |
560 | @n LIME GREEN | |
561 | @n MAGENTA | |
562 | @n MAROON | |
563 | @n MEDIUM AQUAMARINE | |
564 | @n MEDIUM BLUE | |
565 | </td><td> | |
566 | MEDIUM FOREST GREEN | |
567 | @n MEDIUM GOLDENROD | |
568 | @n MEDIUM ORCHID | |
569 | @n MEDIUM SEA GREEN | |
570 | @n MEDIUM SLATE BLUE | |
571 | @n MEDIUM SPRING GREEN | |
572 | @n MEDIUM TURQUOISE | |
573 | @n MEDIUM VIOLET RED | |
574 | @n MIDNIGHT BLUE | |
575 | @n NAVY | |
576 | @n ORANGE | |
577 | @n ORANGE RED | |
578 | @n ORCHID | |
579 | @n PALE GREEN | |
580 | @n PINK | |
581 | @n PLUM | |
582 | @n PURPLE | |
583 | </td><td> | |
584 | RED | |
585 | @n SALMON | |
586 | @n SEA GREEN | |
587 | @n SIENNA | |
588 | @n SKY BLUE | |
589 | @n SLATE BLUE | |
590 | @n SPRING GREEN | |
591 | @n STEEL BLUE | |
592 | @n TAN | |
593 | @n THISTLE | |
594 | @n TURQUOISE | |
595 | @n VIOLET | |
596 | @n VIOLET RED | |
597 | @n WHEAT | |
598 | @n WHITE | |
599 | @n YELLOW | |
600 | @n YELLOW GREEN | |
601 | </td></tr> | |
602 | @endTable | |
7c913512 | 603 | |
23324ae1 | 604 | @library{wxcore} |
3d2cf884 | 605 | @category{gdi} |
7c913512 | 606 | |
e54c96f1 | 607 | @see wxColour |
23324ae1 | 608 | */ |
7c913512 | 609 | class wxColourDatabase |
23324ae1 FM |
610 | { |
611 | public: | |
612 | /** | |
3d2cf884 BP |
613 | Constructs the colour database. It will be initialized at the first |
614 | use. | |
23324ae1 FM |
615 | */ |
616 | wxColourDatabase(); | |
617 | ||
23324ae1 | 618 | /** |
3d2cf884 BP |
619 | Adds a colour to the database. If a colour with the same name already |
620 | exists, it is replaced. | |
23324ae1 | 621 | */ |
3d2cf884 | 622 | void AddColour(const wxString& colourName, const wxColour& colour); |
23324ae1 FM |
623 | |
624 | /** | |
3d2cf884 BP |
625 | Finds a colour given the name. Returns an invalid colour object (that |
626 | is, wxColour::IsOk() will return @false) if the colour wasn't found in | |
627 | the database. | |
23324ae1 | 628 | */ |
adaaa686 | 629 | wxColour Find(const wxString& colourName) const; |
23324ae1 FM |
630 | |
631 | /** | |
3d2cf884 BP |
632 | Finds a colour name given the colour. Returns an empty string if the |
633 | colour is not found in the database. | |
23324ae1 | 634 | */ |
328f5751 | 635 | wxString FindName(const wxColour& colour) const; |
23324ae1 FM |
636 | }; |
637 | ||
638 | ||
23324ae1 FM |
639 | /** |
640 | @class wxSize | |
7c913512 | 641 | |
3d2cf884 BP |
642 | A wxSize is a useful data structure for graphics operations. It simply |
643 | contains integer @e width and @e height members. | |
7c913512 | 644 | |
3d2cf884 BP |
645 | wxSize is used throughout wxWidgets as well as wxPoint which, although |
646 | almost equivalent to wxSize, has a different meaning: wxPoint represents a | |
647 | position while wxSize represents the size. | |
7c913512 | 648 | |
3d2cf884 BP |
649 | @beginWxPythonOnly |
650 | wxPython defines aliases for the @e x and @e y members named @e width and | |
651 | @e height since it makes much more sense for sizes. | |
652 | @endWxPythonOnly | |
7c913512 | 653 | |
23324ae1 FM |
654 | @library{wxcore} |
655 | @category{data} | |
7c913512 | 656 | |
65874118 FM |
657 | @stdobjects |
658 | ::wxDefaultSize | |
659 | ||
e54c96f1 | 660 | @see wxPoint, wxRealPoint |
23324ae1 | 661 | */ |
7c913512 | 662 | class wxSize |
23324ae1 FM |
663 | { |
664 | public: | |
665 | //@{ | |
666 | /** | |
667 | Creates a size object. | |
668 | */ | |
669 | wxSize(); | |
7c913512 | 670 | wxSize(int width, int height); |
23324ae1 FM |
671 | //@} |
672 | ||
673 | //@{ | |
674 | /** | |
3d2cf884 | 675 | Decreases the size in both x and y directions. |
8024723d | 676 | |
4cc4bfaf | 677 | @see IncBy() |
23324ae1 FM |
678 | */ |
679 | void DecBy(const wxSize& size); | |
7c913512 FM |
680 | void DecBy(int dx, int dy); |
681 | void DecBy(int d); | |
23324ae1 FM |
682 | //@} |
683 | ||
684 | /** | |
3d2cf884 BP |
685 | Decrements this object so that both of its dimensions are not greater |
686 | than the corresponding dimensions of the @a size. | |
8024723d | 687 | |
4cc4bfaf | 688 | @see IncTo() |
23324ae1 FM |
689 | */ |
690 | void DecTo(const wxSize& size); | |
691 | ||
692 | /** | |
693 | Gets the height member. | |
694 | */ | |
328f5751 | 695 | int GetHeight() const; |
23324ae1 FM |
696 | |
697 | /** | |
698 | Gets the width member. | |
699 | */ | |
328f5751 | 700 | int GetWidth() const; |
23324ae1 FM |
701 | |
702 | //@{ | |
703 | /** | |
3d2cf884 | 704 | Increases the size in both x and y directions. |
8024723d | 705 | |
4cc4bfaf | 706 | @see DecBy() |
23324ae1 FM |
707 | */ |
708 | void IncBy(const wxSize& size); | |
7c913512 FM |
709 | void IncBy(int dx, int dy); |
710 | void IncBy(int d); | |
23324ae1 FM |
711 | //@} |
712 | ||
713 | /** | |
3d2cf884 BP |
714 | Increments this object so that both of its dimensions are not less than |
715 | the corresponding dimensions of the @a size. | |
8024723d | 716 | |
4cc4bfaf | 717 | @see DecTo() |
23324ae1 FM |
718 | */ |
719 | void IncTo(const wxSize& size); | |
720 | ||
721 | /** | |
3d2cf884 BP |
722 | Returns @true if neither of the size object components is equal to -1, |
723 | which is used as default for the size values in wxWidgets (hence the | |
724 | predefined ::wxDefaultSize has both of its components equal to -1). | |
725 | ||
726 | This method is typically used before calling SetDefaults(). | |
23324ae1 | 727 | */ |
328f5751 | 728 | bool IsFullySpecified() const; |
23324ae1 | 729 | |
23324ae1 | 730 | /** |
3d2cf884 BP |
731 | Scales the dimensions of this object by the given factors. If you want |
732 | to scale both dimensions by the same factor you can also use | |
733 | operator*=(). | |
23324ae1 | 734 | |
d29a9a8a | 735 | @return A reference to this object (so that you can concatenate other |
3d2cf884 | 736 | operations in the same line). |
23324ae1 | 737 | */ |
3d2cf884 | 738 | wxSize& Scale(float xscale, float yscale); |
23324ae1 FM |
739 | |
740 | /** | |
741 | Sets the width and height members. | |
742 | */ | |
4cc4bfaf | 743 | void Set(int width, int height); |
23324ae1 FM |
744 | |
745 | /** | |
3d2cf884 BP |
746 | Combine this size object with another one replacing the default (i.e. |
747 | equal to -1) components of this object with those of the other. It is | |
748 | typically used like this: | |
749 | ||
750 | @code | |
751 | if ( !size.IsFullySpecified() ) | |
752 | { | |
753 | size.SetDefaults(GetDefaultSize()); | |
754 | } | |
755 | @endcode | |
8024723d | 756 | |
4cc4bfaf | 757 | @see IsFullySpecified() |
23324ae1 FM |
758 | */ |
759 | void SetDefaults(const wxSize& sizeDefault); | |
760 | ||
761 | /** | |
762 | Sets the height. | |
763 | */ | |
764 | void SetHeight(int height); | |
765 | ||
766 | /** | |
767 | Sets the width. | |
768 | */ | |
769 | void SetWidth(int width); | |
3d2cf884 BP |
770 | |
771 | /** | |
772 | Assignment operator. | |
773 | */ | |
5267aefd | 774 | wxSize& operator=(const wxSize& sz); |
3d2cf884 BP |
775 | |
776 | bool operator ==(const wxSize& s1, const wxSize& s2); | |
777 | bool operator !=(const wxSize& s1, const wxSize& s2); | |
778 | ||
779 | wxSize operator +(const wxSize& s1, const wxSize& s2); | |
780 | wxSize operator -(const wxSize& s1, const wxSize& s2); | |
781 | wxSize& operator +=(const wxSize& sz); | |
782 | wxSize& operator -=(const wxSize& sz); | |
783 | ||
784 | wxSize operator /(const wxSize& sz, int factor); | |
785 | wxSize operator *(const wxSize& sz, int factor); | |
786 | wxSize operator *(int factor, const wxSize& sz); | |
787 | wxSize& operator /=(int factor); | |
788 | wxSize& operator *=(int factor); | |
23324ae1 FM |
789 | }; |
790 | ||
65874118 | 791 | /** |
3d2cf884 | 792 | Global instance of a wxSize object initialized to (-1,-1). |
65874118 FM |
793 | */ |
794 | wxSize wxDefaultSize; | |
23324ae1 | 795 | |
e54c96f1 | 796 | |
23324ae1 | 797 | |
e54c96f1 | 798 | |
23324ae1 FM |
799 | // ============================================================================ |
800 | // Global functions/macros | |
801 | // ============================================================================ | |
802 | ||
b21126db | 803 | /** @addtogroup group_funcmacro_gdi */ |
23324ae1 | 804 | //@{ |
c83e60aa | 805 | |
23324ae1 | 806 | /** |
a055a116 BP |
807 | This macro loads a bitmap from either application resources (on the |
808 | platforms for which they exist, i.e. Windows and OS2) or from an XPM file. | |
809 | This can help to avoid using @ifdef_ when creating bitmaps. | |
810 | ||
811 | @see @ref overview_bitmap, wxICON() | |
812 | ||
813 | @header{wx/gdicmn.h} | |
23324ae1 | 814 | */ |
a055a116 | 815 | #define wxBITMAP(bitmapName) |
23324ae1 | 816 | |
23324ae1 | 817 | /** |
a055a116 BP |
818 | This macro loads an icon from either application resources (on the |
819 | platforms for which they exist, i.e. Windows and OS2) or from an XPM file. | |
820 | This can help to avoid using @ifdef_ when creating icons. | |
821 | ||
822 | @see @ref overview_bitmap, wxBITMAP() | |
823 | ||
824 | @header{wx/gdicmn.h} | |
23324ae1 | 825 | */ |
808f5a3a | 826 | #define wxICON(iconName) |
23324ae1 | 827 | |
23324ae1 | 828 | /** |
a055a116 BP |
829 | Returns @true if the display is colour, @false otherwise. |
830 | ||
831 | @header{wx/gdicmn.h} | |
23324ae1 | 832 | */ |
a055a116 | 833 | bool wxColourDisplay(); |
23324ae1 FM |
834 | |
835 | /** | |
a055a116 BP |
836 | Returns the depth of the display (a value of 1 denotes a monochrome |
837 | display). | |
7c913512 | 838 | |
a055a116 | 839 | @header{wx/gdicmn.h} |
23324ae1 | 840 | */ |
a055a116 | 841 | int wxDisplayDepth(); |
23324ae1 FM |
842 | |
843 | /** | |
a055a116 BP |
844 | Globally sets the cursor; only has an effect on Windows, Mac and GTK+. You |
845 | should call this function with wxNullCursor to restore the system cursor. | |
846 | ||
847 | @see wxCursor, wxWindow::SetCursor() | |
848 | ||
849 | @header{wx/gdicmn.h} | |
23324ae1 | 850 | */ |
a055a116 | 851 | void wxSetCursor(const wxCursor& cursor); |
23324ae1 | 852 | |
a055a116 BP |
853 | //@} |
854 | ||
b21126db | 855 | /** @addtogroup group_funcmacro_gdi */ |
a055a116 | 856 | //@{ |
23324ae1 | 857 | /** |
a055a116 BP |
858 | Returns the dimensions of the work area on the display. On Windows this |
859 | means the area not covered by the taskbar, etc. Other platforms are | |
860 | currently defaulting to the whole display until a way is found to provide | |
861 | this info for all window managers, etc. | |
7c913512 | 862 | |
a055a116 | 863 | @header{wx/gdicmn.h} |
23324ae1 | 864 | */ |
a055a116 BP |
865 | void wxClientDisplayRect(int* x, int* y, int* width, int* height); |
866 | wxRect wxGetClientDisplayRect(); | |
867 | //@} | |
23324ae1 | 868 | |
b21126db | 869 | /** @addtogroup group_funcmacro_gdi */ |
40fcf546 VS |
870 | //@{ |
871 | /** | |
872 | Returns the display resolution in pixels per inch. | |
873 | ||
ed9dd914 VZ |
874 | The @c x component of the returned wxSize object contains the horizontal |
875 | resolution and the @c y one -- the vertical resolution. | |
876 | ||
40fcf546 VS |
877 | @header{wx/gdicmn.h} |
878 | ||
879 | @since 2.9.0 | |
880 | */ | |
881 | wxSize wxGetDisplayPPI(); | |
882 | //@} | |
883 | ||
b21126db | 884 | /** @addtogroup group_funcmacro_gdi */ |
a055a116 | 885 | //@{ |
23324ae1 | 886 | /** |
a055a116 BP |
887 | Returns the display size in pixels. |
888 | ||
ed9dd914 VZ |
889 | For the version taking @a width and @a header arguments, either of them |
890 | can be @NULL if the caller is not interested in the returned value. | |
891 | ||
a055a116 | 892 | @header{wx/gdicmn.h} |
23324ae1 | 893 | */ |
a055a116 BP |
894 | void wxDisplaySize(int* width, int* height); |
895 | wxSize wxGetDisplaySize(); | |
896 | //@} | |
897 | ||
b21126db | 898 | /** @addtogroup group_funcmacro_gdi */ |
a055a116 BP |
899 | //@{ |
900 | /** | |
901 | Returns the display size in millimeters. | |
23324ae1 | 902 | |
ed9dd914 VZ |
903 | For the version taking @a width and @a header arguments, either of them |
904 | can be @NULL if the caller is not interested in the returned value. | |
905 | ||
906 | @see wxGetDisplayPPI() | |
907 | ||
a055a116 BP |
908 | @header{wx/gdicmn.h} |
909 | */ | |
910 | void wxDisplaySizeMM(int* width, int* height); | |
911 | wxSize wxGetDisplaySizeMM(); | |
c83e60aa BP |
912 | //@} |
913 |