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