1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxRealPoint
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
10 Bitmap type flags. See wxBitmap and wxImage classes.
14 wxBITMAP_TYPE_INVALID
,
16 wxBITMAP_TYPE_BMP_RESOURCE
,
17 wxBITMAP_TYPE_RESOURCE
= wxBITMAP_TYPE_BMP_RESOURCE
,
19 wxBITMAP_TYPE_ICO_RESOURCE
,
21 wxBITMAP_TYPE_CUR_RESOURCE
,
23 wxBITMAP_TYPE_XBM_DATA
,
25 wxBITMAP_TYPE_XPM_DATA
,
27 wxBITMAP_TYPE_TIF
= wxBITMAP_TYPE_TIFF
,
28 wxBITMAP_TYPE_TIFF_RESOURCE
,
29 wxBITMAP_TYPE_TIF_RESOURCE
= wxBITMAP_TYPE_TIFF_RESOURCE
,
31 wxBITMAP_TYPE_GIF_RESOURCE
,
33 wxBITMAP_TYPE_PNG_RESOURCE
,
35 wxBITMAP_TYPE_JPEG_RESOURCE
,
37 wxBITMAP_TYPE_PNM_RESOURCE
,
39 wxBITMAP_TYPE_PCX_RESOURCE
,
41 wxBITMAP_TYPE_PICT_RESOURCE
,
43 wxBITMAP_TYPE_ICON_RESOURCE
,
47 wxBITMAP_TYPE_MACCURSOR
,
48 wxBITMAP_TYPE_MACCURSOR_RESOURCE
,
49 wxBITMAP_TYPE_ANY
= 50
53 Polygon filling mode. See wxDC::DrawPolygon.
55 enum wxPolygonFillMode
64 Notice that under wxMSW some of these cursors are defined in @c wx.rc file
65 and not by the system itself so you should include this file from your own
66 resource file (possibly creating a trivial resource file just containing a
67 single include line if you don't need it otherwise) to be able to use them.
74 wxCURSOR_ARROW
, ///< A standard arrow cursor.
75 wxCURSOR_RIGHT_ARROW
, ///< A standard arrow cursor pointing to the right.
76 wxCURSOR_BULLSEYE
, ///< Bullseye cursor.
77 wxCURSOR_CHAR
, ///< Rectangular character cursor.
78 wxCURSOR_CROSS
, ///< A cross cursor.
79 wxCURSOR_HAND
, ///< A hand cursor.
80 wxCURSOR_IBEAM
, ///< An I-beam cursor (vertical line).
81 wxCURSOR_LEFT_BUTTON
, ///< Represents a mouse with the left button depressed.
82 wxCURSOR_MAGNIFIER
, ///< A magnifier icon.
83 wxCURSOR_MIDDLE_BUTTON
, ///< Represents a mouse with the middle button depressed.
84 wxCURSOR_NO_ENTRY
, ///< A no-entry sign cursor.
85 wxCURSOR_PAINT_BRUSH
, ///< A paintbrush cursor.
86 wxCURSOR_PENCIL
, ///< A pencil cursor.
87 wxCURSOR_POINT_LEFT
, ///< A cursor that points left.
88 wxCURSOR_POINT_RIGHT
, ///< A cursor that points right.
89 wxCURSOR_QUESTION_ARROW
, ///< An arrow and question mark.
90 wxCURSOR_RIGHT_BUTTON
, ///< Represents a mouse with the right button depressed.
91 wxCURSOR_SIZENESW
, ///< A sizing cursor pointing NE-SW.
92 wxCURSOR_SIZENS
, ///< A sizing cursor pointing N-S.
93 wxCURSOR_SIZENWSE
, ///< A sizing cursor pointing NW-SE.
94 wxCURSOR_SIZEWE
, ///< A sizing cursor pointing W-E.
95 wxCURSOR_SIZING
, ///< A general sizing cursor.
96 wxCURSOR_SPRAYCAN
, ///< A spraycan cursor.
97 wxCURSOR_WAIT
, ///< A wait cursor.
98 wxCURSOR_WATCH
, ///< A watch cursor.
99 wxCURSOR_BLANK
, ///< Transparent cursor.
100 wxCURSOR_DEFAULT
, ///< Standard X11 cursor (only in wxGTK).
101 wxCURSOR_COPY_ARROW
, ///< MacOS Theme Plus arrow (only in wxMac).
102 wxCURSOR_CROSS_REVERSE
, ///< Only available on wxX11.
103 wxCURSOR_DOUBLE_ARROW
, ///< Only available on wxX11.
104 wxCURSOR_BASED_ARROW_UP
, ///< Only available on wxX11.
105 wxCURSOR_BASED_ARROW_DOWN
, ///< Only available on wxX11.
106 wxCURSOR_ARROWWAIT
, ///< A wait cursor with a standard arrow.
115 A wxRealPoint is a useful data structure for graphics operations.
117 It contains floating point @e x and @e y members.
118 See wxPoint for an integer version.
120 Note that the coordinates stored inside a wxRealPoint object may be negative
121 and that wxRealPoint functions do not perform any check against negative values.
132 Initializes to zero the x and y members.
137 Initializes the point with the given coordinates.
139 wxRealPoint(double x
, double y
);
142 Converts the given wxPoint (with integer coordinates) to a wxRealPoint.
144 wxRealPoint(const wxPoint
& pt
);
147 @name Miscellaneous operators
149 Note that these operators are documented as class members
150 (to make them easier to find) but, as their prototype shows,
151 they are implemented as global operators; note that this is
152 transparent to the user but it helps to understand why the
153 following functions are documented to take the wxPoint they
154 operate on as an explicit argument.
157 wxRealPoint
& operator=(const wxRealPoint
& pt
);
159 bool operator ==(const wxRealPoint
& p1
, const wxRealPoint
& p2
);
160 bool operator !=(const wxRealPoint
& p1
, const wxRealPoint
& p2
);
162 wxRealPoint
operator +(const wxRealPoint
& p1
, const wxRealPoint
& p2
);
163 wxRealPoint
operator -(const wxRealPoint
& p1
, const wxRealPoint
& p2
);
165 wxRealPoint
& operator +=(const wxRealPoint
& pt
);
166 wxRealPoint
& operator -=(const wxRealPoint
& pt
);
168 wxRealPoint
operator +(const wxRealPoint
& pt
, const wxSize
& sz
);
169 wxRealPoint
operator -(const wxRealPoint
& pt
, const wxSize
& sz
);
170 wxRealPoint
operator +(const wxSize
& sz
, const wxRealPoint
& pt
);
171 wxRealPoint
operator -(const wxSize
& sz
, const wxRealPoint
& pt
);
173 wxRealPoint
& operator +=(const wxSize
& sz
);
174 wxRealPoint
& operator -=(const wxSize
& sz
);
176 wxSize
operator /(const wxRealPoint
& sz
, int factor
);
177 wxSize
operator *(const wxRealPoint
& sz
, int factor
);
178 wxSize
operator *(int factor
, const wxSize
& sz
);
179 wxSize
& operator /=(int factor
);
180 wxSize
& operator *=(int factor
);
184 X coordinate of this point.
189 Y coordinate of this point.
199 A class for manipulating rectangles.
201 Note that the x, y coordinates and the width and height stored inside a wxRect
202 object may be negative and that wxRect functions do not perform any check against
215 Initializes to zero the internal @a x, @a y, @a width and @a height members.
219 Creates a wxRect object from @a x, @a y, @a width and @a height values.
221 wxRect(int x
, int y
, int width
, int height
);
223 Creates a wxRect object from top-left and bottom-right points.
225 wxRect(const wxPoint
& topLeft
, const wxPoint
& bottomRight
);
227 Creates a wxRect object from position @a pos and @a size values.
229 wxRect(const wxPoint
& pos
, const wxSize
& size
);
231 Creates a wxRect object from @a size values at the origin.
233 wxRect(const wxSize
& size
);
237 Returns the rectangle having the same size as this one but centered
238 relatively to the given rectangle @a r. By default, rectangle is
239 centred in both directions but if @a dir includes only @c wxVERTICAL or
240 only @c wxHORIZONTAL, then it is only centered in this direction while
241 the other component of its position remains unchanged.
243 wxRect
CentreIn(const wxRect
& r
, int dir
= wxBOTH
) const;
244 wxRect
CenterIn(const wxRect
& r
, int dir
= wxBOTH
) const;
248 Returns @true if the given point is inside the rectangle (or on its
249 boundary) and @false otherwise.
251 bool Contains(int x
, int y
) const;
253 Returns @true if the given point is inside the rectangle (or on its
254 boundary) and @false otherwise.
256 bool Contains(const wxPoint
& pt
) const;
258 Returns @true if the given rectangle is completely inside this
259 rectangle (or touches its boundary) and @false otherwise.
261 bool Contains(const wxRect
& rect
) const;
265 Decrease the rectangle size.
267 This method is the opposite from Inflate(): Deflate(a, b) is equivalent
268 to Inflate(-a, -b). Please refer to Inflate() for full description.
270 wxRect
& Deflate(wxCoord dx
, wxCoord dy
);
271 wxRect
& Deflate(const wxSize
& diff
);
272 wxRect
& Deflate(wxCoord diff
);
273 wxRect
Deflate(wxCoord dx
, wxCoord dy
) const;
277 Gets the bottom point of the rectangle.
279 int GetBottom() const;
282 Gets the position of the bottom left corner.
284 wxPoint
GetBottomLeft() const;
287 Gets the position of the bottom right corner.
289 wxPoint
GetBottomRight() const;
292 Gets the height member.
294 int GetHeight() const;
297 Gets the left point of the rectangle (the same as GetX()).
304 wxPoint
GetPosition() const;
307 Gets the right point of the rectangle.
309 int GetRight() const;
316 wxSize
GetSize() const;
319 Gets the top point of the rectangle (the same as GetY()).
324 Gets the position of the top left corner of the rectangle, same as
327 wxPoint
GetTopLeft() const;
330 Gets the position of the top right corner.
332 wxPoint
GetTopRight() const;
335 Gets the width member.
337 int GetWidth() const;
351 Increases the size of the rectangle.
353 The left border is moved farther left and the right border is moved
354 farther right by @a dx. The upper border is moved farther up and the
355 bottom border is moved farther down by @a dy. (Note that the width and
356 height of the rectangle thus change by 2*dx and 2*dy, respectively.) If
357 one or both of @a dx and @a dy are negative, the opposite happens: the
358 rectangle size decreases in the respective direction.
360 Inflating and deflating behaves "naturally". Defined more precisely,
362 -# "Real" inflates (that is, @a dx and/or @a dy = 0) are not
363 constrained. Thus inflating a rectangle can cause its upper left
364 corner to move into the negative numbers. (2.5.4 and older forced
365 the top left coordinate to not fall below (0, 0), which implied a
366 forced move of the rectangle.)
367 -# Deflates are clamped to not reduce the width or height of the
368 rectangle below zero. In such cases, the top-left corner is
369 nonetheless handled properly. For example, a rectangle at (10, 10)
370 with size (20, 40) that is inflated by (-15, -15) will become
371 located at (20, 25) at size (0, 10). Finally, observe that the width
372 and height are treated independently. In the above example, the
373 width is reduced by 20, whereas the height is reduced by the full 30
374 (rather than also stopping at 20, when the width reached zero).
378 wxRect
& Inflate(wxCoord dx
, wxCoord dy
);
379 wxRect
& Inflate(const wxSize
& diff
);
380 wxRect
& Inflate(wxCoord diff
);
381 wxRect
Inflate(wxCoord dx
, wxCoord dy
) const;
385 Modifies this rectangle to contain the overlapping portion of this rectangle
386 and the one passed in as parameter.
388 @return This rectangle, modified.
390 wxRect
& Intersect(const wxRect
& rect
);
393 Returns the overlapping portion of this rectangle and the one passed in as
396 wxRect
Intersect(const wxRect
& rect
) const;
399 Returns @true if this rectangle has a non-empty intersection with the
400 rectangle @a rect and @false otherwise.
402 bool Intersects(const wxRect
& rect
) const;
405 Returns @true if this rectangle has a width or height less than or
406 equal to 0 and @false otherwise.
408 bool IsEmpty() const;
412 Moves the rectangle by the specified offset. If @a dx is positive, the
413 rectangle is moved to the right, if @a dy is positive, it is moved to the
414 bottom, otherwise it is moved to the left or top respectively.
416 void Offset(wxCoord dx
, wxCoord dy
);
417 void Offset(const wxPoint
& pt
);
423 void SetHeight(int height
);
428 void SetPosition(const wxPoint
& pos
);
435 void SetSize(const wxSize
& s
);
440 void SetWidth(int width
);
453 Set the left side of the rectangle.
455 Notice that because the rectangle stores its left side and width,
456 calling SetLeft() changes the right side position too -- but does
459 void SetLeft(int left
);
462 Set the right side of the rectangle.
464 Notice that this doesn't affect GetLeft() return value but changes the
465 rectangle width to set its right side to the given position.
467 void SetRight(int right
);
470 Set the top edge of the rectangle.
472 Notice that because the rectangle stores its top side and height,
473 calling SetTop() changes the bottom side position too -- but does
476 void SetTop(int top
);
479 Set the bottom edge of the rectangle.
481 Notice that this doesn't affect GetTop() return value but changes the
482 rectangle height to set its bottom side to the given position.
484 void SetBottom(int bottom
);
487 Set the top-left point of the rectangle.
489 void SetTopLeft(const wxPoint
&p
);
492 Set the bottom-right point of the rectangle.
494 void SetBottomRight(const wxPoint
&p
);
497 Set the top-right point of the rectangle.
499 void SetTopRight(const wxPoint
&p
);
502 Set the bottom-left point of the rectangle.
504 void SetBottomLeft(const wxPoint
&p
);
509 Modifies the rectangle to contain the bounding box of this rectangle
510 and the one passed in as parameter.
512 wxRect
Union(const wxRect
& rect
) const;
513 wxRect
& Union(const wxRect
& rect
);
519 bool operator !=(const wxRect
& r1
, const wxRect
& r2
);
523 Like Union(), but doesn't treat empty rectangles specially.
525 wxRect
operator +(const wxRect
& r1
, const wxRect
& r2
);
526 wxRect
& operator +=(const wxRect
& r
);
531 Returns the intersection of two rectangles (which may be empty).
533 wxRect
operator *(const wxRect
& r1
, const wxRect
& r2
);
534 wxRect
& operator *=(const wxRect
& r
);
540 wxRect
& operator=(const wxRect
& rect
);
545 bool operator ==(const wxRect
& r1
, const wxRect
& r2
);
558 x coordinate of the top-level corner of the rectangle.
563 y coordinate of the top-level corner of the rectangle.
573 A wxPoint is a useful data structure for graphics operations.
575 It contains integer @e x and @e y members.
576 See wxRealPoint for a floating point version.
578 Note that the width and height stored inside a wxPoint object may be negative
579 and that wxPoint functions do not perform any check against negative values
580 (this is used to e.g. store the special -1 value in ::wxDefaultPosition instance).
595 Initializes the internal x and y coordinates to zero.
600 Initializes the point object with the given @a x and @a y coordinates.
602 wxPoint(int x
, int y
);
605 Converts the given wxRealPoint (with floating point coordinates) to a
608 Notice that this truncates the floating point values of @a pt
609 components, if you want to round them instead you need to do it
612 #include <wx/math.h> // for wxRound()
614 wxRealPoint rp = ...;
615 wxPoint p(wxRound(rp.x), wxRound(rp.y));
618 wxPoint(const wxRealPoint
& pt
);
621 @name Miscellaneous operators
623 Note that these operators are documented as class members
624 (to make them easier to find) but, as their prototype shows,
625 they are implemented as global operators; note that this is
626 transparent to the user but it helps to understand why the
627 following functions are documented to take the wxPoint they
628 operate on as an explicit argument.
631 wxPoint
& operator=(const wxPoint
& pt
);
633 bool operator ==(const wxPoint
& p1
, const wxPoint
& p2
);
634 bool operator !=(const wxPoint
& p1
, const wxPoint
& p2
);
636 wxPoint
operator +(const wxPoint
& p1
, const wxPoint
& p2
);
637 wxPoint
operator -(const wxPoint
& p1
, const wxPoint
& p2
);
639 wxPoint
& operator +=(const wxPoint
& pt
);
640 wxPoint
& operator -=(const wxPoint
& pt
);
642 wxPoint
operator +(const wxPoint
& pt
, const wxSize
& sz
);
643 wxPoint
operator -(const wxPoint
& pt
, const wxSize
& sz
);
644 wxPoint
operator +(const wxSize
& sz
, const wxPoint
& pt
);
645 wxPoint
operator -(const wxSize
& sz
, const wxPoint
& pt
);
647 wxPoint
& operator +=(const wxSize
& sz
);
648 wxPoint
& operator -=(const wxSize
& sz
);
650 wxSize
operator /(const wxPoint
& sz
, int factor
);
651 wxSize
operator *(const wxPoint
& sz
, int factor
);
652 wxSize
operator *(int factor
, const wxSize
& sz
);
653 wxSize
& operator /=(int factor
);
654 wxSize
& operator *=(int factor
);
659 @name Defaults handling.
661 Test for and set non-specified wxPoint components.
663 Although a wxPoint is always initialized to (0, 0), wxWidgets commonly
664 uses wxDefaultCoord (defined as @c -1) to indicate that a point hasn't
665 been initialized or specified. In particular, ::wxDefaultPosition is
666 used in many places with this meaning.
671 Returns @true if neither of the point components is equal to
674 This method is typically used before calling SetDefaults().
678 bool IsFullySpecified() const;
681 Combine this object with another one replacing the uninitialized
684 It is typically used like this:
687 if ( !pos.IsFullySpecified() )
689 pos.SetDefaults(GetDefaultPosition());
693 @see IsFullySpecified()
697 void SetDefaults(const wxPoint
& pt
);
712 Global instance of a wxPoint initialized with values (-1,-1).
714 const wxPoint wxDefaultPosition
;
718 @class wxColourDatabase
720 wxWidgets maintains a database of standard RGB colours for a predefined
721 set of named colours. The application may add to this set if desired by
722 using AddColour() and may use it to look up colours by names using Find()
723 or find the names for the standard colour using FindName().
725 There is one predefined, global instance of this class called
726 ::wxTheColourDatabase.
728 The standard database contains at least the following colours:
773 @n MEDIUM SPRING GREEN
811 class wxColourDatabase
815 Constructs the colour database. It will be initialized at the first
821 Adds a colour to the database. If a colour with the same name already
822 exists, it is replaced.
824 void AddColour(const wxString
& colourName
, const wxColour
& colour
);
827 Finds a colour given the name. Returns an invalid colour object (that
828 is, wxColour::IsOk() will return @false) if the colour wasn't found in
831 wxColour
Find(const wxString
& colourName
) const;
834 Finds a colour name given the colour. Returns an empty string if the
835 colour is not found in the database.
837 wxString
FindName(const wxColour
& colour
) const;
842 Global instance of a wxColourDatabase.
844 wxColourDatabase
* wxTheColourDatabase
;
850 A wxSize is a useful data structure for graphics operations.
851 It simply contains integer @e width and @e height members.
853 Note that the width and height stored inside a wxSize object may be negative
854 and that wxSize functions do not perform any check against negative values
855 (this is used to e.g. store the special -1 value in ::wxDefaultSize instance).
856 See also IsFullySpecified() and SetDefaults() for utility functions regarding
857 the special -1 value.
859 wxSize is used throughout wxWidgets as well as wxPoint which, although
860 almost equivalent to wxSize, has a different meaning: wxPoint represents a
861 position while wxSize represents the size.
869 @see wxPoint, wxRealPoint
875 Initializes this size object with zero width and height.
880 Initializes this size object with the given @a width and @a height.
882 wxSize(int width
, int height
);
886 Decreases the size in both x and y directions.
890 void DecBy(const wxPoint
& pt
);
891 void DecBy(const wxSize
& size
);
892 void DecBy(int dx
, int dy
);
897 Decrements this object so that both of its dimensions are not greater
898 than the corresponding dimensions of the @a size.
902 void DecTo(const wxSize
& size
);
905 Decrements this object to be not bigger than the given size ignoring
906 non-specified components.
908 This is similar to DecTo() but doesn't do anything for x or y
909 component if the same component of @a size is not specified, i.e. set
914 void DecToIfSpecified(const wxSize
& size
);
917 Gets the height member.
919 int GetHeight() const;
922 Gets the width member.
924 int GetWidth() const;
928 Increases the size in both x and y directions.
932 void IncBy(const wxPoint
& pt
);
933 void IncBy(const wxSize
& size
);
934 void IncBy(int dx
, int dy
);
939 Increments this object so that both of its dimensions are not less than
940 the corresponding dimensions of the @a size.
944 void IncTo(const wxSize
& size
);
947 Returns @true if neither of the size object components is equal to -1,
948 which is used as default for the size values in wxWidgets (hence the
949 predefined ::wxDefaultSize has both of its components equal to -1).
951 This method is typically used before calling SetDefaults().
953 bool IsFullySpecified() const;
956 Scales the dimensions of this object by the given factors. If you want
957 to scale both dimensions by the same factor you can also use
960 @return A reference to this object (so that you can concatenate other
961 operations in the same line).
963 wxSize
& Scale(float xscale
, float yscale
);
966 Sets the width and height members.
968 void Set(int width
, int height
);
971 Combine this size object with another one replacing the default (i.e.\ equal to -1)
972 components of this object with those of the other. It is typically used like this:
975 if ( !size.IsFullySpecified() )
977 size.SetDefaults(GetDefaultSize());
981 @see IsFullySpecified()
983 void SetDefaults(const wxSize
& sizeDefault
);
988 void SetHeight(int height
);
993 void SetWidth(int width
);
997 @name Miscellaneous operators
999 Note that these operators are documented as class members
1000 (to make them easier to find) but, as their prototype shows,
1001 they are implemented as global operators; note that this is
1002 transparent to the user but it helps to understand why the
1003 following functions are documented to take the wxSize they
1004 operate on as an explicit argument.
1007 wxSize
& operator=(const wxSize
& sz
);
1009 bool operator ==(const wxSize
& s1
, const wxSize
& s2
);
1010 bool operator !=(const wxSize
& s1
, const wxSize
& s2
);
1012 wxSize
operator +(const wxSize
& s1
, const wxSize
& s2
);
1013 wxSize
operator -(const wxSize
& s1
, const wxSize
& s2
);
1014 wxSize
& operator +=(const wxSize
& sz
);
1015 wxSize
& operator -=(const wxSize
& sz
);
1017 wxSize
operator /(const wxSize
& sz
, int factor
);
1018 wxSize
operator *(const wxSize
& sz
, int factor
);
1019 wxSize
operator *(int factor
, const wxSize
& sz
);
1020 wxSize
& operator /=(int factor
);
1021 wxSize
& operator *=(int factor
);
1026 Global instance of a wxSize object initialized to (-1,-1).
1028 const wxSize wxDefaultSize
;
1033 // ============================================================================
1034 // Global functions/macros
1035 // ============================================================================
1037 /** @addtogroup group_funcmacro_gdi */
1041 This macro loads a bitmap from either application resources (on the
1042 platforms for which they exist, i.e. Windows and OS2) or from an XPM file.
1043 This can help to avoid using @ifdef_ when creating bitmaps.
1045 @see @ref overview_bitmap, wxICON()
1047 @header{wx/gdicmn.h}
1049 #define wxBITMAP(bitmapName)
1052 Creates a bitmap from either application resources or embedded image data
1055 This macro is similar to wxBITMAP() but works with bitmap data in PNG
1056 format and not BMP or XPM.
1058 Under Windows the given @a bitmapName must be present in the application
1059 resource file with the type @c RCDATA and refer to a PNG image. I.e. you
1060 should have a definition similar to the following in your @c .rc file:
1062 mybitmap RCDATA "mybitmap.png"
1064 to be able to use @c wxBITMAP_PNG(mybitmap) in the code.
1066 Under OS X the file with the specified name and "png" extension must be
1067 present in the "Resources" subdirectory of the application bundle.
1069 Under the other platforms, this is equivalent to wxBITMAP_PNG_FROM_DATA()
1070 and so loads the image data from the array called @c bitmapName_png that
1071 must exist. Notice that it @e must be an array and not a pointer as the
1072 macro needs to be able to determine its size. Such an array can be produced
1073 by a number of conversion programs. A very simple one is included in
1074 wxWidgets distribution as @c misc/scripts/png2c.py.
1076 Finally notice that you must register PNG image handler to be able to
1077 load bitmaps from PNG data. This can be done either by calling
1078 wxInitAllImageHandlers() which also registers all the other image formats
1079 or including the necessary header:
1081 #include <wx/imagpng.h>
1085 wxImage::AddHandler(new wxPNGHandler);
1087 in your application startup code.
1089 @see wxBITMAP_PNG_FROM_DATA()
1091 @header{wx/gdicmn.h}
1095 #define wxBITMAP_PNG(bitmapName)
1098 Creates a bitmap from embedded image data in PNG format.
1100 This macro is a thin wrapper around wxBitmap::NewFromPNGData() and takes
1101 just the base name of the array containing the image data and computes its
1102 size internally. In other words, the array called @c bitmapName_png must
1103 exist. Notice that it @e must be an array and not a pointer as the macro
1104 needs to be able to determine its size. Such an array can be produced by a
1105 number of conversion programs. A very simple one is included in wxWidgets
1106 distribution as @c misc/scripts/png2c.py.
1108 You can use wxBITMAP_PNG() to load the PNG bitmaps from resources on the
1109 platforms that support this and only fall back to loading them from data
1110 under the other ones (i.e. not Windows and not OS X).
1112 @header{wx/gdicmn.h}
1116 #define wxBITMAP_PNG_FROM_DATA(bitmapName)
1119 This macro loads an icon from either application resources (on the
1120 platforms for which they exist, i.e. Windows and OS2) or from an XPM file.
1121 This can help to avoid using @ifdef_ when creating icons.
1123 @see @ref overview_bitmap, wxBITMAP()
1125 @header{wx/gdicmn.h}
1127 #define wxICON(iconName)
1130 Returns @true if the display is colour, @false otherwise.
1132 @header{wx/gdicmn.h}
1134 bool wxColourDisplay();
1137 Returns the depth of the display (a value of 1 denotes a monochrome
1140 @header{wx/gdicmn.h}
1142 int wxDisplayDepth();
1145 Globally sets the cursor; only has an effect on Windows, Mac and GTK+. You
1146 should call this function with wxNullCursor to restore the system cursor.
1148 @see wxCursor, wxWindow::SetCursor()
1150 @header{wx/gdicmn.h}
1152 void wxSetCursor(const wxCursor
& cursor
);
1156 /** @addtogroup group_funcmacro_gdi */
1159 Returns the dimensions of the work area on the display.
1161 This is the same as wxGetClientDisplayRect() but allows to retrieve the
1162 individual components instead of the entire rectangle.
1164 Any of the output pointers can be @NULL if the corresponding value is not
1165 needed by the caller.
1169 @header{wx/gdicmn.h}
1171 void wxClientDisplayRect(int* x
, int* y
, int* width
, int* height
);
1174 /** @addtogroup group_funcmacro_gdi */
1177 Returns the dimensions of the work area on the display. On Windows this
1178 means the area not covered by the taskbar, etc. Other platforms are
1179 currently defaulting to the whole display until a way is found to provide
1180 this info for all window managers, etc.
1184 @header{wx/gdicmn.h}
1186 wxRect
wxGetClientDisplayRect();
1189 /** @addtogroup group_funcmacro_gdi */
1192 Returns the display resolution in pixels per inch.
1194 The @c x component of the returned wxSize object contains the horizontal
1195 resolution and the @c y one -- the vertical resolution.
1197 @header{wx/gdicmn.h}
1203 wxSize
wxGetDisplayPPI();
1206 /** @addtogroup group_funcmacro_gdi */
1209 Returns the display size in pixels.
1211 Either of output pointers can be @NULL if the caller is not interested in
1212 the corresponding value.
1214 @see wxGetDisplaySize(), wxDisplay
1216 @header{wx/gdicmn.h}
1218 void wxDisplaySize(int* width
, int* height
);
1221 /** @addtogroup group_funcmacro_gdi */
1224 Returns the display size in pixels.
1228 @header{wx/gdicmn.h}
1230 wxSize
wxGetDisplaySize();
1233 /** @addtogroup group_funcmacro_gdi */
1236 Returns the display size in millimeters.
1238 Either of output pointers can be @NULL if the caller is not interested in
1239 the corresponding value.
1241 @see wxGetDisplaySizeMM(), wxDisplay
1243 @header{wx/gdicmn.h}
1245 void wxDisplaySizeMM(int* width
, int* height
);
1248 /** @addtogroup group_funcmacro_gdi */
1251 Returns the display size in millimeters.
1255 @header{wx/gdicmn.h}
1257 wxSize
wxGetDisplaySizeMM();