]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/gdicmn.h
Convert wxFSW_EVENT_{WARNING,ERROR} to string correctly.
[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 447
aee775a3
RD
448 /**
449 Set the left side of the rectangle.
de03c7fe
VZ
450
451 Notice that because the rectangle stores its left side and width,
452 calling SetLeft() changes the right side position too -- but does
453 preserve the width.
aee775a3
RD
454 */
455 void SetLeft(int left);
456
457 /**
458 Set the right side of the rectangle.
de03c7fe
VZ
459
460 Notice that this doesn't affect GetLeft() return value but changes the
461 rectangle width to set its right side to the given position.
aee775a3
RD
462 */
463 void SetRight(int right);
464
465 /**
466 Set the top edge of the rectangle.
de03c7fe
VZ
467
468 Notice that because the rectangle stores its top side and height,
469 calling SetTop() changes the bottom side position too -- but does
470 preserve the height.
aee775a3
RD
471 */
472 void SetTop(int top);
473
474 /**
de03c7fe
VZ
475 Set the bottom edge of the rectangle.
476
477 Notice that this doesn't affect GetTop() return value but changes the
478 rectangle height to set its bottom side to the given position.
aee775a3
RD
479 */
480 void SetBottom(int bottom);
481
482 /**
483 Set the top-left point of the rectangle.
484 */
485 void SetTopLeft(const wxPoint &p);
486
487 /**
488 Set the bottom-right point of the rectangle.
489 */
490 void SetBottomRight(const wxPoint &p);
491
492 /**
493 Set the top-right point of the rectangle.
494 */
495 void SetTopRight(const wxPoint &p);
496
497 /**
498 Set the bottom-left point of the rectangle.
499 */
500 void SetBottomLeft(const wxPoint &p);
501
502
23324ae1
FM
503 //@{
504 /**
3d2cf884
BP
505 Modifies the rectangle to contain the bounding box of this rectangle
506 and the one passed in as parameter.
23324ae1 507 */
3d2cf884
BP
508 wxRect Union(const wxRect& rect) const;
509 wxRect& Union(const wxRect& rect);
23324ae1
FM
510 //@}
511
512 /**
3d2cf884 513 Inequality operator.
23324ae1 514 */
3d2cf884 515 bool operator !=(const wxRect& r1, const wxRect& r2);
23324ae1 516
3d2cf884
BP
517 //@{
518 /**
519 Like Union(), but doesn't treat empty rectangles specially.
520 */
521 wxRect operator +(const wxRect& r1, const wxRect& r2);
522 wxRect& operator +=(const wxRect& r);
523 //@}
23324ae1
FM
524
525 //@{
526 /**
527 Returns the intersection of two rectangles (which may be empty).
528 */
3d2cf884
BP
529 wxRect operator *(const wxRect& r1, const wxRect& r2);
530 wxRect& operator *=(const wxRect& r);
23324ae1
FM
531 //@}
532
533 /**
534 Assignment operator.
535 */
5267aefd 536 wxRect& operator=(const wxRect& rect);
23324ae1
FM
537
538 /**
539 Equality operator.
540 */
541 bool operator ==(const wxRect& r1, const wxRect& r2);
542
543 /**
3d2cf884 544 Height member.
23324ae1 545 */
3d2cf884 546 int height;
23324ae1 547
3d2cf884
BP
548 /**
549 Width member.
550 */
551 int width;
23324ae1
FM
552
553 /**
23324ae1
FM
554 x coordinate of the top-level corner of the rectangle.
555 */
3d2cf884 556 int x;
23324ae1
FM
557
558 /**
23324ae1
FM
559 y coordinate of the top-level corner of the rectangle.
560 */
3d2cf884 561 int y;
23324ae1
FM
562};
563
564
e54c96f1 565
23324ae1
FM
566/**
567 @class wxPoint
7c913512 568
3d2cf884 569 A wxPoint is a useful data structure for graphics operations.
7c913512 570
89b799cc 571 It contains integer @e x and @e y members.
f834ee48
FM
572 See wxRealPoint for a floating point version.
573
574 Note that the width and height stored inside a wxPoint object may be negative
575 and that wxPoint functions do not perform any check against negative values
576 (this is used to e.g. store the special -1 value in ::wxDefaultPosition instance).
7c913512 577
23324ae1
FM
578 @library{wxcore}
579 @category{data}
7c913512 580
65874118
FM
581 @stdobjects
582 ::wxDefaultPosition
583
e54c96f1 584 @see wxRealPoint
23324ae1 585*/
7c913512 586class wxPoint
23324ae1
FM
587{
588public:
23324ae1 589 /**
3d2cf884 590 Constructs a point.
f834ee48 591 Initializes the internal x and y coordinates to zero.
23324ae1
FM
592 */
593 wxPoint();
89b799cc 594
f834ee48
FM
595 /**
596 Initializes the point object with the given @a x and @a y coordinates.
597 */
7c913512 598 wxPoint(int x, int y);
89b799cc 599
a5664fd6
FM
600 /**
601 Converts the given wxRealPoint (with floating point coordinates) to a
602 wxPoint instance.
603 */
604 wxPoint(const wxRealPoint& pt);
23324ae1 605
23324ae1 606 /**
f834ee48 607 @name Miscellaneous operators
89b799cc 608
ed0dd9c1
FM
609 Note that these operators are documented as class members
610 (to make them easier to find) but, as their prototype shows,
611 they are implemented as global operators; note that this is
612 transparent to the user but it helps to understand why the
613 following functions are documented to take the wxPoint they
614 operate on as an explicit argument.
23324ae1 615 */
f834ee48 616 //@{
5267aefd 617 wxPoint& operator=(const wxPoint& pt);
3d2cf884 618
7c913512
FM
619 bool operator ==(const wxPoint& p1, const wxPoint& p2);
620 bool operator !=(const wxPoint& p1, const wxPoint& p2);
3d2cf884 621
7c913512
FM
622 wxPoint operator +(const wxPoint& p1, const wxPoint& p2);
623 wxPoint operator -(const wxPoint& p1, const wxPoint& p2);
3d2cf884
BP
624
625 wxPoint& operator +=(const wxPoint& pt);
626 wxPoint& operator -=(const wxPoint& pt);
627
7c913512
FM
628 wxPoint operator +(const wxPoint& pt, const wxSize& sz);
629 wxPoint operator -(const wxPoint& pt, const wxSize& sz);
630 wxPoint operator +(const wxSize& sz, const wxPoint& pt);
631 wxPoint operator -(const wxSize& sz, const wxPoint& pt);
3d2cf884
BP
632
633 wxPoint& operator +=(const wxSize& sz);
634 wxPoint& operator -=(const wxSize& sz);
89b799cc 635
ed0dd9c1
FM
636 wxSize operator /(const wxPoint& sz, int factor);
637 wxSize operator *(const wxPoint& sz, int factor);
638 wxSize operator *(int factor, const wxSize& sz);
639 wxSize& operator /=(int factor);
640 wxSize& operator *=(int factor);
f834ee48 641 //@}
89b799cc 642
06cfc052
VZ
643
644 /**
645 @name Defaults handling.
646
647 Test for and set non-specified wxPoint components.
648
649 Although a wxPoint is always initialized to (0, 0), wxWidgets commonly
650 uses wxDefaultCoord (defined as @c -1) to indicate that a point hasn't
651 been initialized or specified. In particular, ::wxDefaultPosition is
652 used in many places with this meaning.
653 */
654 //@{
655
656 /**
657 Returns @true if neither of the point components is equal to
658 wxDefaultCoord.
659
660 This method is typically used before calling SetDefaults().
661
662 @since 2.9.2
663 */
664 bool IsFullySpecified() const;
665
666 /**
667 Combine this object with another one replacing the uninitialized
668 values.
669
670 It is typically used like this:
671
672 @code
673 if ( !pos.IsFullySpecified() )
674 {
675 pos.SetDefaults(GetDefaultPosition());
676 }
677 @endcode
678
679 @see IsFullySpecified()
680
681 @since 2.9.2
682 */
033b1b94 683 void SetDefaults(const wxPoint& pt);
06cfc052
VZ
684 //@}
685
23324ae1 686 /**
23324ae1
FM
687 x member.
688 */
3d2cf884 689 int x;
23324ae1
FM
690
691 /**
23324ae1
FM
692 y member.
693 */
3d2cf884 694 int y;
23324ae1
FM
695};
696
65874118 697/**
06cfc052 698 Global instance of a wxPoint initialized with values (-1,-1).
65874118 699*/
033b1b94 700const wxPoint wxDefaultPosition;
23324ae1 701
e54c96f1 702
23324ae1
FM
703/**
704 @class wxColourDatabase
7c913512 705
23324ae1 706 wxWidgets maintains a database of standard RGB colours for a predefined
3d2cf884
BP
707 set of named colours. The application may add to this set if desired by
708 using AddColour() and may use it to look up colours by names using Find()
709 or find the names for the standard colour using FindName().
710
711 There is one predefined, global instance of this class called
712 ::wxTheColourDatabase.
713
714 The standard database contains at least the following colours:
715
716 @beginTable
717 <tr><td>
718 AQUAMARINE
719 @n BLACK
720 @n BLUE
721 @n BLUE VIOLET
722 @n BROWN
723 @n CADET BLUE
724 @n CORAL
725 @n CORNFLOWER BLUE
726 @n CYAN
727 @n DARK GREY
728 @n DARK GREEN
729 @n DARK OLIVE GREEN
730 @n DARK ORCHID
731 @n DARK SLATE BLUE
732 @n DARK SLATE GREY
733 @n DARK TURQUOISE
734 @n DIM GREY
735 </td><td>
736 FIREBRICK
737 @n FOREST GREEN
738 @n GOLD
739 @n GOLDENROD
740 @n GREY
741 @n GREEN
742 @n GREEN YELLOW
743 @n INDIAN RED
744 @n KHAKI
745 @n LIGHT BLUE
746 @n LIGHT GREY
747 @n LIGHT STEEL BLUE
748 @n LIME GREEN
749 @n MAGENTA
750 @n MAROON
751 @n MEDIUM AQUAMARINE
752 @n MEDIUM BLUE
753 </td><td>
754 MEDIUM FOREST GREEN
755 @n MEDIUM GOLDENROD
756 @n MEDIUM ORCHID
757 @n MEDIUM SEA GREEN
758 @n MEDIUM SLATE BLUE
759 @n MEDIUM SPRING GREEN
760 @n MEDIUM TURQUOISE
761 @n MEDIUM VIOLET RED
762 @n MIDNIGHT BLUE
763 @n NAVY
764 @n ORANGE
765 @n ORANGE RED
766 @n ORCHID
767 @n PALE GREEN
768 @n PINK
769 @n PLUM
770 @n PURPLE
771 </td><td>
772 RED
773 @n SALMON
774 @n SEA GREEN
775 @n SIENNA
776 @n SKY BLUE
777 @n SLATE BLUE
778 @n SPRING GREEN
779 @n STEEL BLUE
780 @n TAN
781 @n THISTLE
782 @n TURQUOISE
783 @n VIOLET
784 @n VIOLET RED
785 @n WHEAT
786 @n WHITE
787 @n YELLOW
788 @n YELLOW GREEN
789 </td></tr>
790 @endTable
7c913512 791
23324ae1 792 @library{wxcore}
3d2cf884 793 @category{gdi}
7c913512 794
e54c96f1 795 @see wxColour
23324ae1 796*/
7c913512 797class wxColourDatabase
23324ae1
FM
798{
799public:
800 /**
3d2cf884
BP
801 Constructs the colour database. It will be initialized at the first
802 use.
23324ae1
FM
803 */
804 wxColourDatabase();
805
23324ae1 806 /**
3d2cf884
BP
807 Adds a colour to the database. If a colour with the same name already
808 exists, it is replaced.
23324ae1 809 */
3d2cf884 810 void AddColour(const wxString& colourName, const wxColour& colour);
23324ae1
FM
811
812 /**
3d2cf884
BP
813 Finds a colour given the name. Returns an invalid colour object (that
814 is, wxColour::IsOk() will return @false) if the colour wasn't found in
815 the database.
23324ae1 816 */
adaaa686 817 wxColour Find(const wxString& colourName) const;
23324ae1
FM
818
819 /**
3d2cf884
BP
820 Finds a colour name given the colour. Returns an empty string if the
821 colour is not found in the database.
23324ae1 822 */
328f5751 823 wxString FindName(const wxColour& colour) const;
23324ae1
FM
824};
825
826
b2025b31 827/**
57ab6f23 828 Global instance of a wxColourDatabase.
b2025b31
FM
829*/
830wxColourDatabase* wxTheColourDatabase;
831
832
23324ae1
FM
833/**
834 @class wxSize
7c913512 835
89b799cc 836 A wxSize is a useful data structure for graphics operations.
f834ee48 837 It simply contains integer @e width and @e height members.
89b799cc 838
f834ee48
FM
839 Note that the width and height stored inside a wxSize object may be negative
840 and that wxSize functions do not perform any check against negative values
841 (this is used to e.g. store the special -1 value in ::wxDefaultSize instance).
842 See also IsFullySpecified() and SetDefaults() for utility functions regarding
843 the special -1 value.
7c913512 844
3d2cf884
BP
845 wxSize is used throughout wxWidgets as well as wxPoint which, although
846 almost equivalent to wxSize, has a different meaning: wxPoint represents a
847 position while wxSize represents the size.
7c913512 848
23324ae1
FM
849 @library{wxcore}
850 @category{data}
7c913512 851
65874118
FM
852 @stdobjects
853 ::wxDefaultSize
854
e54c96f1 855 @see wxPoint, wxRealPoint
23324ae1 856*/
7c913512 857class wxSize
23324ae1
FM
858{
859public:
23324ae1 860 /**
f834ee48 861 Initializes this size object with zero width and height.
23324ae1
FM
862 */
863 wxSize();
89b799cc 864
f834ee48
FM
865 /**
866 Initializes this size object with the given @a width and @a height.
867 */
7c913512 868 wxSize(int width, int height);
23324ae1
FM
869
870 //@{
871 /**
3d2cf884 872 Decreases the size in both x and y directions.
8024723d 873
4cc4bfaf 874 @see IncBy()
23324ae1 875 */
89b799cc 876 void DecBy(const wxPoint& pt);
23324ae1 877 void DecBy(const wxSize& size);
7c913512
FM
878 void DecBy(int dx, int dy);
879 void DecBy(int d);
23324ae1
FM
880 //@}
881
882 /**
3d2cf884
BP
883 Decrements this object so that both of its dimensions are not greater
884 than the corresponding dimensions of the @a size.
8024723d 885
4cc4bfaf 886 @see IncTo()
23324ae1
FM
887 */
888 void DecTo(const wxSize& size);
889
7d174999
VZ
890 /**
891 Decrements this object to be not bigger than the given size ignoring
892 non-specified components.
893
894 This is similar to DecTo() but doesn't do anything for x or y
895 component if the same component of @a size is not specified, i.e. set
896 to ::wxDefaultCoord.
897
898 @since 2.9.5
899 */
900 void DecToIfSpecified(const wxSize& size);
901
23324ae1
FM
902 /**
903 Gets the height member.
904 */
328f5751 905 int GetHeight() const;
23324ae1
FM
906
907 /**
908 Gets the width member.
909 */
328f5751 910 int GetWidth() const;
23324ae1
FM
911
912 //@{
913 /**
3d2cf884 914 Increases the size in both x and y directions.
8024723d 915
4cc4bfaf 916 @see DecBy()
23324ae1 917 */
89b799cc 918 void IncBy(const wxPoint& pt);
23324ae1 919 void IncBy(const wxSize& size);
7c913512
FM
920 void IncBy(int dx, int dy);
921 void IncBy(int d);
23324ae1
FM
922 //@}
923
924 /**
3d2cf884
BP
925 Increments this object so that both of its dimensions are not less than
926 the corresponding dimensions of the @a size.
8024723d 927
4cc4bfaf 928 @see DecTo()
23324ae1
FM
929 */
930 void IncTo(const wxSize& size);
931
932 /**
3d2cf884
BP
933 Returns @true if neither of the size object components is equal to -1,
934 which is used as default for the size values in wxWidgets (hence the
935 predefined ::wxDefaultSize has both of its components equal to -1).
936
937 This method is typically used before calling SetDefaults().
23324ae1 938 */
328f5751 939 bool IsFullySpecified() const;
23324ae1 940
23324ae1 941 /**
3d2cf884
BP
942 Scales the dimensions of this object by the given factors. If you want
943 to scale both dimensions by the same factor you can also use
944 operator*=().
23324ae1 945
d29a9a8a 946 @return A reference to this object (so that you can concatenate other
3d2cf884 947 operations in the same line).
23324ae1 948 */
3d2cf884 949 wxSize& Scale(float xscale, float yscale);
23324ae1
FM
950
951 /**
952 Sets the width and height members.
953 */
4cc4bfaf 954 void Set(int width, int height);
23324ae1
FM
955
956 /**
3d2cf884
BP
957 Combine this size object with another one replacing the default (i.e.
958 equal to -1) components of this object with those of the other. It is
959 typically used like this:
960
961 @code
962 if ( !size.IsFullySpecified() )
963 {
964 size.SetDefaults(GetDefaultSize());
965 }
966 @endcode
8024723d 967
4cc4bfaf 968 @see IsFullySpecified()
23324ae1
FM
969 */
970 void SetDefaults(const wxSize& sizeDefault);
971
972 /**
973 Sets the height.
974 */
975 void SetHeight(int height);
976
977 /**
978 Sets the width.
979 */
980 void SetWidth(int width);
3d2cf884 981
89b799cc 982
3d2cf884 983 /**
f834ee48 984 @name Miscellaneous operators
89b799cc 985
ed0dd9c1
FM
986 Note that these operators are documented as class members
987 (to make them easier to find) but, as their prototype shows,
988 they are implemented as global operators; note that this is
989 transparent to the user but it helps to understand why the
990 following functions are documented to take the wxSize they
991 operate on as an explicit argument.
3d2cf884 992 */
f834ee48 993 //@{
5267aefd 994 wxSize& operator=(const wxSize& sz);
3d2cf884
BP
995
996 bool operator ==(const wxSize& s1, const wxSize& s2);
997 bool operator !=(const wxSize& s1, const wxSize& s2);
998
999 wxSize operator +(const wxSize& s1, const wxSize& s2);
1000 wxSize operator -(const wxSize& s1, const wxSize& s2);
1001 wxSize& operator +=(const wxSize& sz);
1002 wxSize& operator -=(const wxSize& sz);
1003
1004 wxSize operator /(const wxSize& sz, int factor);
1005 wxSize operator *(const wxSize& sz, int factor);
1006 wxSize operator *(int factor, const wxSize& sz);
1007 wxSize& operator /=(int factor);
1008 wxSize& operator *=(int factor);
f834ee48 1009 //@}
23324ae1
FM
1010};
1011
65874118 1012/**
3d2cf884 1013 Global instance of a wxSize object initialized to (-1,-1).
65874118 1014*/
033b1b94 1015const wxSize wxDefaultSize;
23324ae1 1016
e54c96f1 1017
23324ae1 1018
e54c96f1 1019
23324ae1
FM
1020// ============================================================================
1021// Global functions/macros
1022// ============================================================================
1023
b21126db 1024/** @addtogroup group_funcmacro_gdi */
23324ae1 1025//@{
c83e60aa 1026
23324ae1 1027/**
a055a116
BP
1028 This macro loads a bitmap from either application resources (on the
1029 platforms for which they exist, i.e. Windows and OS2) or from an XPM file.
1030 This can help to avoid using @ifdef_ when creating bitmaps.
1031
1032 @see @ref overview_bitmap, wxICON()
1033
1034 @header{wx/gdicmn.h}
23324ae1 1035*/
a055a116 1036#define wxBITMAP(bitmapName)
23324ae1 1037
c3f641cb
VZ
1038/**
1039 Creates a bitmap from either application resources or embedded image data
1040 in PNG format.
1041
1042 This macro is similar to wxBITMAP() but works with bitmap data in PNG
1043 format and not BMP or XPM.
1044
1045 Under Windows the given @a bitmapName must be present in the application
1046 resource file with the type @c RCDATA and refer to a PNG image. I.e. you
1047 should have a definition similar to the following in your @c .rc file:
1048 @code
1049 mybitmap RCDATA "mybitmap.png"
1050 @endcode
1051 to be able to use @c wxBITMAP_PNG(mybitmap) in the code.
1052
1053 Under OS X the file with the specified name and "png" extension must be
1054 present in the "Resources" subdirectory of the application bundle.
1055
1056 Under the other platforms, this is equivalent to wxBITMAP_PNG_FROM_DATA()
1057 and so loads the image data from the array called @c bitmapName_png that
1058 must exist. Notice that it @e must be an array and not a pointer as the
1059 macro needs to be able to determine its size. Such an array can be produced
1060 by a number of conversion programs. A very simple one is included in
1061 wxWidgets distribution as @c misc/scripts/png2c.py.
1062
1063 Finally notice that you must register PNG image handler to be able to
1064 load bitmaps from PNG data. This can be done either by calling
1065 wxInitAllImageHandlers() which also registers all the other image formats
1066 or including the necessary header:
1067 @code
1068 #include <wx/imagpng.h>
1069 @endcode
1070 and calling
1071 @code
1072 wxImage::AddHandler(new wxPNGHandler);
1073 @endcode
1074 in your application startup code.
1075
1076 @see wxBITMAP_PNG_FROM_DATA()
1077
1078 @header{wx/gdicmn.h}
1079
1080 @since 2.9.5
1081 */
1082#define wxBITMAP_PNG(bitmapName)
1083
1084/**
1085 Creates a bitmap from embedded image data in PNG format.
1086
1087 This macro is a thin wrapper around wxBitmap::NewFromPNGData() and takes
1088 just the base name of the array containing the image data and computes its
1089 size internally. In other words, the array called @c bitmapName_png must
1090 exist. Notice that it @e must be an array and not a pointer as the macro
1091 needs to be able to determine its size. Such an array can be produced by a
1092 number of conversion programs. A very simple one is included in wxWidgets
1093 distribution as @c misc/scripts/png2c.py.
1094
1095 You can use wxBITMAP_PNG() to load the PNG bitmaps from resources on the
1096 platforms that support this and only fall back to loading them from data
1097 under the other ones (i.e. not Windows and not OS X).
1098
1099 @header{wx/gdicmn.h}
1100
1101 @since 2.9.5
1102 */
1103#define wxBITMAP_PNG_FROM_DATA(bitmapName)
1104
23324ae1 1105/**
a055a116
BP
1106 This macro loads an icon from either application resources (on the
1107 platforms for which they exist, i.e. Windows and OS2) or from an XPM file.
1108 This can help to avoid using @ifdef_ when creating icons.
1109
1110 @see @ref overview_bitmap, wxBITMAP()
1111
1112 @header{wx/gdicmn.h}
23324ae1 1113*/
808f5a3a 1114#define wxICON(iconName)
23324ae1 1115
23324ae1 1116/**
a055a116
BP
1117 Returns @true if the display is colour, @false otherwise.
1118
1119 @header{wx/gdicmn.h}
23324ae1 1120*/
a055a116 1121bool wxColourDisplay();
23324ae1
FM
1122
1123/**
a055a116
BP
1124 Returns the depth of the display (a value of 1 denotes a monochrome
1125 display).
7c913512 1126
a055a116 1127 @header{wx/gdicmn.h}
23324ae1 1128*/
a055a116 1129int wxDisplayDepth();
23324ae1
FM
1130
1131/**
a055a116
BP
1132 Globally sets the cursor; only has an effect on Windows, Mac and GTK+. You
1133 should call this function with wxNullCursor to restore the system cursor.
1134
1135 @see wxCursor, wxWindow::SetCursor()
1136
1137 @header{wx/gdicmn.h}
23324ae1 1138*/
a055a116 1139void wxSetCursor(const wxCursor& cursor);
23324ae1 1140
a055a116
BP
1141//@}
1142
b21126db 1143/** @addtogroup group_funcmacro_gdi */
a055a116 1144//@{
23324ae1 1145/**
a055a116
BP
1146 Returns the dimensions of the work area on the display. On Windows this
1147 means the area not covered by the taskbar, etc. Other platforms are
1148 currently defaulting to the whole display until a way is found to provide
1149 this info for all window managers, etc.
7c913512 1150
a055a116 1151 @header{wx/gdicmn.h}
23324ae1 1152*/
a055a116
BP
1153void wxClientDisplayRect(int* x, int* y, int* width, int* height);
1154wxRect wxGetClientDisplayRect();
1155//@}
23324ae1 1156
b21126db 1157/** @addtogroup group_funcmacro_gdi */
40fcf546
VS
1158//@{
1159/**
1160 Returns the display resolution in pixels per inch.
1161
ed9dd914
VZ
1162 The @c x component of the returned wxSize object contains the horizontal
1163 resolution and the @c y one -- the vertical resolution.
1164
40fcf546
VS
1165 @header{wx/gdicmn.h}
1166
1167 @since 2.9.0
1168*/
1169wxSize wxGetDisplayPPI();
1170//@}
1171
b21126db 1172/** @addtogroup group_funcmacro_gdi */
a055a116 1173//@{
23324ae1 1174/**
a055a116
BP
1175 Returns the display size in pixels.
1176
ed9dd914
VZ
1177 For the version taking @a width and @a header arguments, either of them
1178 can be @NULL if the caller is not interested in the returned value.
1179
a055a116 1180 @header{wx/gdicmn.h}
23324ae1 1181*/
a055a116
BP
1182void wxDisplaySize(int* width, int* height);
1183wxSize wxGetDisplaySize();
1184//@}
1185
b21126db 1186/** @addtogroup group_funcmacro_gdi */
a055a116
BP
1187//@{
1188/**
1189 Returns the display size in millimeters.
23324ae1 1190
ed9dd914
VZ
1191 For the version taking @a width and @a header arguments, either of them
1192 can be @NULL if the caller is not interested in the returned value.
1193
1194 @see wxGetDisplayPPI()
1195
a055a116
BP
1196 @header{wx/gdicmn.h}
1197*/
1198void wxDisplaySizeMM(int* width, int* height);
1199wxSize wxGetDisplaySizeMM();
c83e60aa
BP
1200//@}
1201