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