# Graphics Device Interface (GDI)
[Functions and Macros by Category]

## Detailed Description

The following are functions and macros related to GDI (Graphics Device Interface) access.

Related Overviews: Device Contexts

Related class group: Graphics Device Interface (GDI)

## Defines

#define | wxDROP_ICON(name)
| This macro creates either a cursor (MSW) or an icon (elsewhere) with the given name (of type `const char*`).
#define | wxBITMAP(bitmapName)
| This macro loads a bitmap from either application resources (on the platforms for which they exist, i.e.
#define | wxICON(iconName)
| This macro loads an icon from either application resources (on the platforms for which they exist, i.e.

## 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 ()
wxSize | wxGetDisplayPPI ()
| Returns the display resolution in pixels per inch.
void | wxDisplaySize (int *width, int *height)
| Returns the display size in pixels.
wxSize | wxGetDisplaySize ()
void | wxDisplaySizeMM (int *width, int *height)
| Returns the display size in millimeters.
wxSize | wxGetDisplaySizeMM ()
bool | wxMakeMetafilePlaceable (const wxString &filename, int minX, int minY, int maxX, int maxY, float scale=1.0)
| Given a filename for an existing, valid metafile (as constructed using wxMetafileDC) makes it into a placeable metafile by prepending a header containing the given bounding box.

## Define Documentation

#define wxBITMAP | ( |  | bitmapName | ) |

This macro loads a bitmap from either application resources (on the platforms for which they exist, i.e.

Windows and OS2) 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>

#define wxDROP_ICON | ( |  | name | ) |

This macro creates either a cursor (MSW) or an icon (elsewhere) with the given name (of type `const char*`).

Under MSW, the cursor is loaded from the resource file and the icon is loaded from XPM file under other platforms.

This macro should be used with wxDropSource::wxDropSource().

Returns:
  wxCursor on MSW, otherwise returns a wxIcon

Include file:

    #include <wx/dnd.h>

#define wxICON | ( |  | iconName | ) |

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

Windows and OS2) 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>

## Function Documentation

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

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.

Include file:

    #include <wx/gdicmn.h>

bool wxColourDisplay | ( |  | ) |

Returns true if the display is colour, false otherwise.

Include file:

    #include <wx/gdicmn.h>

int wxDisplayDepth | ( |  | ) |

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

Include file:

    #include <wx/gdicmn.h>

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

Returns the display size in pixels.

For the version taking width and header arguments, either of them can be NULL if the caller is not interested in the returned value.

Include file:

    #include <wx/gdicmn.h>

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

Returns the display size in millimeters.

For the version taking width and header arguments, either of them can be NULL if the caller is not interested in the returned value.

See also:
  wxGetDisplayPPI()

Include file:

    #include <wx/gdicmn.h>

wxRect wxGetClientDisplayRect | ( |  | ) |

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.

Include file:

    #include <wx/gdicmn.h>

Since:
  2.9.0

wxSize wxGetDisplaySize | ( |  | ) |

wxSize wxGetDisplaySizeMM | ( |  | ) |

bool wxMakeMetafilePlaceable | ( | const wxString & | filename,
|  | int | minX,
|  | int | minY,
|  | int | maxX,
|  | int | maxY,
|  | float | scale = `1.0` |
| ) |  |  |

Given a filename for an existing, valid metafile (as constructed using wxMetafileDC) makes it into a placeable metafile by prepending a header containing the given bounding box.

The bounding box may be obtained from a device context after drawing into it, using the functions wxDC::MinX(), wxDC::MinY(), wxDC::MaxX() and wxDC::MaxY().

In addition to adding the placeable metafile header, this function adds the equivalent of the following code to the start of the metafile data:

        SetMapMode(dc, MM_ANISOTROPIC);
        SetWindowOrg(dc, minX, minY);
        SetWindowExt(dc, maxX - minX, maxY - minY);

This simulates the wxMM_TEXT mapping mode, which wxWidgets assumes.

Placeable metafiles may be imported by many Windows applications, and can be used in RTF (Rich Text Format) files.

scale allows the specification of scale for the metafile.

This function is only available under Windows.

Include file:

    #include <wx/metafile.h>

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>

|  | [ top ]