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