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