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