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