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