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