wxWidgets: interface/wx/gdicmn.h File Reference

| Version: 3.1.7

Loading...
Searching...
No Matches
Classes | Macros | Enumerations | Functions | Variables
gdicmn.h File Reference

## Classes
class | wxRealPoint
| A wxRealPoint is a useful data structure for graphics operations. More...
class | wxRect
| Represents a rectangle with integer coordinates. More...
class | wxPoint
| A wxPoint is a useful data structure for graphics operations. More...
class | wxColourDatabase
| wxWidgets maintains a database of standard RGB colours for a predefined set of named colours. More...
class | wxSize
| A wxSize is a useful data structure for graphics operations. More...

## Macros
#define | wxBITMAP(bitmapName)
| This macro loads a bitmap from either application resources (on the platforms for which they exist, i.e. Windows) or from an XPM file.
#define | wxBITMAP_PNG(bitmapName)
| Creates a bitmap from either application resources or embedded image data in PNG format.
#define | wxBITMAP_PNG_FROM_DATA(bitmapName)
| Creates a bitmap from embedded image data in PNG format.
#define | wxICON(iconName)
| This macro loads an icon from either application resources (on the platforms for which they exist, i.e. Windows) or from an XPM file.

## Enumerations
enum | wxBitmapType { wxBITMAP_TYPE_INVALID , wxBITMAP_TYPE_BMP , wxBITMAP_TYPE_BMP_RESOURCE , wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE , wxBITMAP_TYPE_ICO , wxBITMAP_TYPE_ICO_RESOURCE , wxBITMAP_TYPE_CUR , wxBITMAP_TYPE_CUR_RESOURCE , wxBITMAP_TYPE_XBM , wxBITMAP_TYPE_XBM_DATA , wxBITMAP_TYPE_XPM , wxBITMAP_TYPE_XPM_DATA , wxBITMAP_TYPE_TIFF , wxBITMAP_TYPE_TIF = wxBITMAP_TYPE_TIFF , wxBITMAP_TYPE_TIFF_RESOURCE , wxBITMAP_TYPE_TIF_RESOURCE = wxBITMAP_TYPE_TIFF_RESOURCE , wxBITMAP_TYPE_GIF , wxBITMAP_TYPE_GIF_RESOURCE , wxBITMAP_TYPE_PNG , wxBITMAP_TYPE_PNG_RESOURCE , wxBITMAP_TYPE_JPEG , wxBITMAP_TYPE_JPEG_RESOURCE , wxBITMAP_TYPE_PNM , wxBITMAP_TYPE_PNM_RESOURCE , wxBITMAP_TYPE_PCX , wxBITMAP_TYPE_PCX_RESOURCE , wxBITMAP_TYPE_PICT , wxBITMAP_TYPE_PICT_RESOURCE , wxBITMAP_TYPE_ICON , wxBITMAP_TYPE_ICON_RESOURCE , wxBITMAP_TYPE_ANI , wxBITMAP_TYPE_IFF , wxBITMAP_TYPE_TGA , wxBITMAP_TYPE_MACCURSOR , wxBITMAP_TYPE_MACCURSOR_RESOURCE , wxBITMAP_TYPE_ANY = 50 }
| Bitmap type flags. More...
enum | wxPolygonFillMode { wxODDEVEN_RULE = 1 , wxWINDING_RULE }
| Polygon filling mode. More...
enum | wxStockCursor { wxCURSOR_NONE , wxCURSOR_ARROW , wxCURSOR_RIGHT_ARROW , wxCURSOR_BULLSEYE , wxCURSOR_CHAR , wxCURSOR_CROSS , wxCURSOR_HAND , wxCURSOR_IBEAM , wxCURSOR_LEFT_BUTTON , wxCURSOR_MAGNIFIER , wxCURSOR_MIDDLE_BUTTON , wxCURSOR_NO_ENTRY , wxCURSOR_PAINT_BRUSH , wxCURSOR_PENCIL , wxCURSOR_POINT_LEFT , wxCURSOR_POINT_RIGHT , wxCURSOR_QUESTION_ARROW , wxCURSOR_RIGHT_BUTTON , wxCURSOR_SIZENESW , wxCURSOR_SIZENS , wxCURSOR_SIZENWSE , wxCURSOR_SIZEWE , wxCURSOR_SIZING , wxCURSOR_SPRAYCAN , wxCURSOR_WAIT , wxCURSOR_WATCH , wxCURSOR_BLANK , wxCURSOR_DEFAULT , wxCURSOR_COPY_ARROW , wxCURSOR_CROSS_REVERSE , wxCURSOR_DOUBLE_ARROW , wxCURSOR_BASED_ARROW_UP , wxCURSOR_BASED_ARROW_DOWN , wxCURSOR_ARROWWAIT , wxCURSOR_MAX }
| Standard cursors. More...
enum | wxEllipsizeFlags { wxELLIPSIZE_FLAGS_NONE = 0 , wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS = 1 , wxELLIPSIZE_FLAGS_EXPAND_TABS = 2 , wxELLIPSIZE_FLAGS_DEFAULT }
| Flags used by wxControl::Ellipsize function. More...
enum | wxEllipsizeMode { wxELLIPSIZE_NONE , wxELLIPSIZE_START , wxELLIPSIZE_MIDDLE , wxELLIPSIZE_END }
| The different ellipsization modes supported by the wxControl::Ellipsize and wxRendererNative::DrawItemText() functions. More...

## Functions
bool | wxColourDisplay ()
| Returns true if the display is colour, false otherwise.
int | wxDisplayDepth ()
| Returns the depth of the display (a value of 1 denotes a monochrome display).
void | wxSetCursor (const wxCursor &cursor)
| Globally sets the cursor; only has an effect on Windows, Mac and GTK+.
void | wxClientDisplayRect (int *x, int *y, int *width, int *height)
| Returns the dimensions of the work area on the display.
wxRect | wxGetClientDisplayRect ()
| Returns the dimensions of the work area on the display.
wxSize | wxGetDisplayPPI ()
| Returns the display resolution in pixels per inch.
void | wxDisplaySize (int *width, int *height)
| Returns the display size in pixels.
wxSize | wxGetDisplaySize ()
| Returns the display size in pixels.
void | wxDisplaySizeMM (int *width, int *height)
| Returns the display size in millimeters.
wxSize | wxGetDisplaySizeMM ()
| Returns the display size in millimeters.

## Variables
const wxPoint | wxDefaultPosition
| Global instance of a wxPoint initialized with values (-1,-1).
wxColourDatabase * | wxTheColourDatabase
| Global instance of a wxColourDatabase.
const wxSize | wxDefaultSize
| Global instance of a wxSize object initialized to (-1,-1).

## Macro Definition Documentation

## ◆ wxBITMAP

#define wxBITMAP | ( |  | bitmapName | ) |

This macro loads a bitmap from either application resources (on the platforms for which they exist, i.e. Windows) or from an XPM file.

This can help to avoid using #ifdef when creating bitmaps.

See also
  Bitmaps and Icons, wxICON()

Include file:

    #include <wx/gdicmn.h>

## ◆ wxBITMAP_PNG

#define wxBITMAP_PNG | ( |  | bitmapName | ) |

Creates a bitmap from either application resources or embedded image data in PNG format.

This macro is similar to wxBITMAP() but works with bitmap data in PNG format and not BMP or XPM.

Under Windows the given bitmapName must be present in the application resource file with the type `RCDATA` and refer to a PNG image. I.e. you should have a definition similar to the following in your ``.rc file:

mybitmap RCDATA "mybitmap.png"

to be able to use `wxBITMAP_PNG(mybitmap)` in the code.

Under macOS the file with the specified name and "png" extension must be present in the "Resources" subdirectory of the application bundle.

Under the other platforms, this is equivalent to wxBITMAP_PNG_FROM_DATA() and so loads the image data from the array called `bitmapName_png` that must exist. Notice that it must be an array and not a pointer as the macro needs to be able to determine its size. Such an array can be produced by a number of conversion programs. A very simple one is included in wxWidgets distribution as `misc/scripts/png2c.py`.

Finally notice that you must register PNG image handler to be able to load bitmaps from PNG data. This can be done either by calling wxInitAllImageHandlers() which also registers all the other image formats or including the necessary header:

#include <wx/imagpng.h>
imagpng.h

and calling

wxImage::AddHandler(new wxPNGHandler);
wxImage::AddHandler
static void AddHandler(wxImageHandler *handler)
Register an image handler.
wxPNGHandler
This is the image handler for the PNG format.
Definition imagpng.h:39

in your application startup code.

See also
  wxBITMAP_PNG_FROM_DATA()

Include file:

    #include <wx/gdicmn.h>

Since
  2.9.5

## ◆ wxBITMAP_PNG_FROM_DATA

#define wxBITMAP_PNG_FROM_DATA | ( |  | bitmapName | ) |

Creates a bitmap from embedded image data in PNG format.

This macro is a thin wrapper around wxBitmap::NewFromPNGData() and takes just the base name of the array containing the image data and computes its size internally. In other words, the array called `bitmapName_png` must exist. Notice that it must be an array and not a pointer as the macro needs to be able to determine its size. Such an array can be produced by a number of conversion programs. A very simple one is included in wxWidgets distribution as `misc/scripts/png2c.py`.

You can use wxBITMAP_PNG() to load the PNG bitmaps from resources on the platforms that support this and only fall back to loading them from data under the other ones (i.e. not Windows and not macOS).

Include file:

    #include <wx/gdicmn.h>

Since
  2.9.5

## ◆ wxICON

#define wxICON | ( |  | iconName | ) |

This macro loads an icon from either application resources (on the platforms for which they exist, i.e. Windows) or from an XPM file.

This can help to avoid using #ifdef when creating icons.

See also
  Bitmaps and Icons, wxBITMAP()

Include file:

    #include <wx/gdicmn.h>

## Enumeration Type Documentation

## ◆ wxBitmapType

enum wxBitmapType

Bitmap type flags.

See wxBitmap and wxImage classes.

Enumerator
wxBITMAP_TYPE_INVALID |
wxBITMAP_TYPE_BMP |
wxBITMAP_TYPE_BMP_RESOURCE |
wxBITMAP_TYPE_RESOURCE |
wxBITMAP_TYPE_ICO |
wxBITMAP_TYPE_ICO_RESOURCE |
wxBITMAP_TYPE_CUR |
wxBITMAP_TYPE_CUR_RESOURCE |
wxBITMAP_TYPE_XBM |
wxBITMAP_TYPE_XBM_DATA |
wxBITMAP_TYPE_XPM |
wxBITMAP_TYPE_XPM_DATA |
wxBITMAP_TYPE_TIFF |
wxBITMAP_TYPE_TIF |
wxBITMAP_TYPE_TIFF_RESOURCE |
wxBITMAP_TYPE_TIF_RESOURCE |
wxBITMAP_TYPE_GIF |
wxBITMAP_TYPE_GIF_RESOURCE |
wxBITMAP_TYPE_PNG |
wxBITMAP_TYPE_PNG_RESOURCE |
wxBITMAP_TYPE_JPEG |
wxBITMAP_TYPE_JPEG_RESOURCE |
wxBITMAP_TYPE_PNM |
wxBITMAP_TYPE_PNM_RESOURCE |
wxBITMAP_TYPE_PCX |
wxBITMAP_TYPE_PCX_RESOURCE |
wxBITMAP_TYPE_PICT |
wxBITMAP_TYPE_PICT_RESOURCE |
wxBITMAP_TYPE_ICON |
wxBITMAP_TYPE_ICON_RESOURCE |
wxBITMAP_TYPE_ANI |
wxBITMAP_TYPE_IFF |
wxBITMAP_TYPE_TGA |
wxBITMAP_TYPE_MACCURSOR |
wxBITMAP_TYPE_MACCURSOR_RESOURCE |
wxBITMAP_TYPE_ANY |

## ◆ wxEllipsizeFlags

enum wxEllipsizeFlags

Flags used by wxControl::Ellipsize function.

Enumerator
wxELLIPSIZE_FLAGS_NONE | No special flags.
wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS | Take mnemonics into account when calculating the text width. With this flag when calculating the size of the passed string, mnemonics characters (see wxControl::SetLabel) will be automatically reduced to a single character. This leads to correct calculations only if the string passed to Ellipsize() will be used with wxControl::SetLabel. If you don't want ampersand to be interpreted as mnemonics (e.g. because you use wxControl::SetLabelText) then don't use this flag.
wxELLIPSIZE_FLAGS_EXPAND_TABS | Expand tabs in spaces when calculating the text width. This flag tells wxControl::Ellipsize() to calculate the width of tab characters `'\t'` as 6 spaces.
wxELLIPSIZE_FLAGS_DEFAULT | The default flags for wxControl::Ellipsize.

## ◆ wxEllipsizeMode

enum wxEllipsizeMode

The different ellipsization modes supported by the wxControl::Ellipsize and wxRendererNative::DrawItemText() functions.

Enumerator
wxELLIPSIZE_NONE | Don't ellipsize the text at all. Since 2.9.1
wxELLIPSIZE_START | Put the ellipsis at the start of the string, if the string needs ellipsization.
wxELLIPSIZE_MIDDLE | Put the ellipsis in the middle of the string, if the string needs ellipsization.
wxELLIPSIZE_END | Put the ellipsis at the end of the string, if the string needs ellipsization.

## ◆ wxPolygonFillMode

enum wxPolygonFillMode

Polygon filling mode.

See wxDC::DrawPolygon.

Enumerator
wxODDEVEN_RULE |
wxWINDING_RULE |

## ◆ wxStockCursor

enum wxStockCursor

Standard cursors.

Notice that under wxMSW some of these cursors are defined in `wx.rc` file and not by the system itself so you should include this file from your own resource file (possibly creating a trivial resource file just containing a single include line if you don't need it otherwise) to be able to use them.

See wxCursor.

Enumerator
wxCURSOR_NONE |
wxCURSOR_ARROW | A standard arrow cursor.
wxCURSOR_RIGHT_ARROW | A standard arrow cursor pointing to the right.
wxCURSOR_BULLSEYE | Bullseye cursor.
wxCURSOR_CHAR | Rectangular character cursor.
wxCURSOR_CROSS | A cross cursor.
wxCURSOR_HAND | A hand cursor.
wxCURSOR_IBEAM | An I-beam cursor (vertical line).
wxCURSOR_LEFT_BUTTON | Represents a mouse with the left button depressed.
wxCURSOR_MAGNIFIER | A magnifier icon.
wxCURSOR_MIDDLE_BUTTON | Represents a mouse with the middle button depressed.
wxCURSOR_NO_ENTRY | A no-entry sign cursor.
wxCURSOR_PAINT_BRUSH | A paintbrush cursor.
wxCURSOR_PENCIL | A pencil cursor.
wxCURSOR_POINT_LEFT | A cursor that points left.
wxCURSOR_POINT_RIGHT | A cursor that points right.
wxCURSOR_QUESTION_ARROW | An arrow and question mark.
wxCURSOR_RIGHT_BUTTON | Represents a mouse with the right button depressed.
wxCURSOR_SIZENESW | A sizing cursor pointing NE-SW.
wxCURSOR_SIZENS | A sizing cursor pointing N-S.
wxCURSOR_SIZENWSE | A sizing cursor pointing NW-SE.
wxCURSOR_SIZEWE | A sizing cursor pointing W-E.
wxCURSOR_SIZING | A general sizing cursor.
wxCURSOR_SPRAYCAN | A spraycan cursor.
wxCURSOR_WAIT | A wait cursor.
wxCURSOR_WATCH | A watch cursor.
wxCURSOR_BLANK | Transparent cursor.
wxCURSOR_DEFAULT | Standard X11 cursor (only in wxGTK).
wxCURSOR_COPY_ARROW | MacOS Theme Plus arrow (only in wxMac).
wxCURSOR_CROSS_REVERSE | Only available on wxX11.
wxCURSOR_DOUBLE_ARROW | Only available on wxX11.
wxCURSOR_BASED_ARROW_UP | Only available on wxX11.
wxCURSOR_BASED_ARROW_DOWN | Only available on wxX11.
wxCURSOR_ARROWWAIT | A wait cursor with a standard arrow.
wxCURSOR_MAX |

## Function Documentation

## ◆ wxClientDisplayRect()

void wxClientDisplayRect | ( | int * | x,
|  | int * | y,
|  | int * | width,
|  | int * | height )

Returns the dimensions of the work area on the display.

This is the same as wxGetClientDisplayRect() but allows retrieving the individual components instead of the entire rectangle.

Any of the output pointers can be NULL if the corresponding value is not needed by the caller.

See also
  wxDisplay

Include file:

    #include <wx/gdicmn.h>

## ◆ wxColourDisplay()

bool wxColourDisplay | ( |  | ) |

Returns true if the display is colour, false otherwise.

Note
  Use of this function is not recommended in the new code as it only works for the primary display. Use wxDisplay::GetDepth() to retrieve the depth of the appropriate display and compare it with 1 instead.

Include file:

    #include <wx/gdicmn.h>

## ◆ wxDisplayDepth()

int wxDisplayDepth | ( |  | ) |

Returns the depth of the display (a value of 1 denotes a monochrome display).

Note
  Use of this function is not recommended in the new code as it only works for the primary display. Use wxDisplay::GetDepth() to retrieve the depth of the appropriate display instead.

Include file:

    #include <wx/gdicmn.h>

## ◆ wxDisplaySize()

void wxDisplaySize | ( | int * | width,
|  | int * | height )

Returns the display size in pixels.

Note
  Use of this function is not recommended in the new code as it only works for the primary display. Use wxDisplay::GetGeometry() to retrieve the size of the appropriate display instead.

Either of output pointers can be NULL if the caller is not interested in the corresponding value.

See also
  wxGetDisplaySize(), wxDisplay

Include file:

    #include <wx/gdicmn.h>

## ◆ wxDisplaySizeMM()

void wxDisplaySizeMM | ( | int * | width,
|  | int * | height )

Returns the display size in millimeters.

Either of output pointers can be NULL if the caller is not interested in the corresponding value.

See also
  wxGetDisplaySizeMM(), wxDisplay

Include file:

    #include <wx/gdicmn.h>

## ◆ wxGetClientDisplayRect()

wxRect wxGetClientDisplayRect | ( |  | ) |

Returns the dimensions of the work area on the display.

On Windows this means the area not covered by the taskbar, etc. Other platforms are currently defaulting to the whole display until a way is found to provide this info for all window managers, etc.

See also
  wxDisplay

Include file:

    #include <wx/gdicmn.h>

## ◆ wxGetDisplayPPI()

wxSize wxGetDisplayPPI | ( |  | ) |

Returns the display resolution in pixels per inch.

The `x` component of the returned wxSize object contains the horizontal resolution and the `y` one – the vertical resolution.

Note
  Use of this function is not recommended in the new code as it only works for the primary display. Use wxDisplay::GetPPI() to retrieve the resolution of the appropriate display instead.

Include file:

    #include <wx/gdicmn.h>

See also
  wxDisplay

Since
  2.9.0

## ◆ wxGetDisplaySize()

wxSize wxGetDisplaySize | ( |  | ) |

Returns the display size in pixels.

Note
  Use of this function is not recommended in the new code as it only works for the primary display. Use wxDisplay::GetGeometry() to retrieve the size of the appropriate display instead.

See also
  wxDisplay

Include file:

    #include <wx/gdicmn.h>

## ◆ wxGetDisplaySizeMM()

wxSize wxGetDisplaySizeMM | ( |  | ) |

Returns the display size in millimeters.

See also
  wxDisplay

Include file:

    #include <wx/gdicmn.h>

## ◆ wxSetCursor()

void wxSetCursor | ( | const wxCursor & | cursor | ) |

Globally sets the cursor; only has an effect on Windows, Mac and GTK+.

You should call this function with wxNullCursor to restore the system cursor.

See also
  wxCursor, wxWindow::SetCursor()

Include file:

    #include <wx/gdicmn.h>

## Variable Documentation

## ◆ wxDefaultPosition

const wxPoint wxDefaultPosition

Global instance of a wxPoint initialized with values (-1,-1).

## ◆ wxDefaultSize

const wxSize wxDefaultSize

Global instance of a wxSize object initialized to (-1,-1).

## ◆ wxTheColourDatabase

wxColourDatabase* wxTheColourDatabase

Global instance of a wxColourDatabase.