#include <wx/dcclient.h>
A wxClientDC must be constructed if an application wishes to paint on the client area of a window from outside an EVT_PAINT() handler.
This should normally be constructed as a temporary stack object; don't store a wxClientDC object.
To draw on a window from within an EVT_PAINT() handler, construct a wxPaintDC object instead.
To draw on the whole window including decorations, construct a wxWindowDC object (Windows only).
A wxClientDC object is initialized to use the same font and colours as the window it is associated with.
Public Member Functions | |
wxClientDC (wxWindow *window) | |
Constructor. More... | |
Public Member Functions inherited from wxWindowDC | |
wxWindowDC (wxWindow *window) | |
Constructor. More... | |
Public Member Functions inherited from wxDC | |
void | CopyAttributes (const wxDC &dc) |
Copy attributes from another DC. More... | |
int | GetDepth () const |
Returns the depth (number of bits/pixel) of this DC. More... | |
wxPoint | GetDeviceOrigin () const |
Returns the current device origin. More... | |
wxRasterOperationMode | GetLogicalFunction () const |
Gets the current logical function. More... | |
wxMappingMode | GetMapMode () const |
Gets the current mapping mode for the device context. More... | |
bool | GetPixel (wxCoord x, wxCoord y, wxColour *colour) const |
Gets in colour the colour at the specified location. More... | |
wxSize | GetPPI () const |
Returns the resolution of the device in pixels per inch. More... | |
void | GetSize (wxCoord *width, wxCoord *height) const |
Gets the horizontal and vertical extent of this device context in device units. More... | |
wxSize | GetSize () const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | GetSizeMM (wxCoord *width, wxCoord *height) const |
Returns the horizontal and vertical resolution in millimetres. More... | |
wxSize | GetSizeMM () const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | GetUserScale (double *x, double *y) const |
Gets the current user scale factor. More... | |
bool | IsOk () const |
Returns true if the DC is ok to use. More... | |
void | SetAxisOrientation (bool xLeftRight, bool yBottomUp) |
Sets the x and y axis orientation (i.e. the direction from lowest to highest values on the axis). More... | |
void | SetDeviceOrigin (wxCoord x, wxCoord y) |
Sets the device origin (i.e. the origin in pixels after scaling has been applied). More... | |
void | SetLogicalFunction (wxRasterOperationMode function) |
Sets the current logical function for the device context. More... | |
void | SetMapMode (wxMappingMode mode) |
The mapping mode of the device context defines the unit of measurement used to convert logical units to device units. More... | |
void | SetPalette (const wxPalette &palette) |
If this is a window DC or memory DC, assigns the given palette to the window or bitmap associated with the DC. More... | |
void | SetUserScale (double xScale, double yScale) |
Sets the user scaling factor, useful for applications which require 'zooming'. More... | |
void * | GetHandle () const |
Returns a value that can be used as a handle to the native drawing context, if this wxDC has something that could be thought of in that way. More... | |
wxBitmap | GetAsBitmap (const wxRect *subrect=NULL) const |
If supported by the platform and the type of DC, fetch the contents of the DC, or a subset of it, as a bitmap. More... | |
void | SetLogicalScale (double x, double y) |
Set the scale to use for translating wxDC coordinates to the physical pixels. More... | |
void | GetLogicalScale (double *x, double *y) const |
Return the scale set by the last call to SetLogicalScale(). More... | |
void | SetLogicalOrigin (wxCoord x, wxCoord y) |
Change the offset used for translating wxDC coordinates. More... | |
wxCoord | DeviceToLogicalX (wxCoord x) const |
Convert device X coordinate to logical coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. More... | |
wxCoord | DeviceToLogicalXRel (wxCoord x) const |
Convert device X coordinate to relative logical coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. More... | |
wxCoord | DeviceToLogicalY (wxCoord y) const |
Converts device Y coordinate to logical coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. More... | |
wxCoord | DeviceToLogicalYRel (wxCoord y) const |
Convert device Y coordinate to relative logical coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. More... | |
wxCoord | LogicalToDeviceX (wxCoord x) const |
Converts logical X coordinate to device coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. More... | |
wxCoord | LogicalToDeviceXRel (wxCoord x) const |
Converts logical X coordinate to relative device coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. More... | |
wxCoord | LogicalToDeviceY (wxCoord y) const |
Converts logical Y coordinate to device coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. More... | |
wxCoord | LogicalToDeviceYRel (wxCoord y) const |
Converts logical Y coordinate to relative device coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. More... | |
void | Clear () |
Clears the device context using the current background brush. More... | |
void | DrawArc (wxCoord xStart, wxCoord yStart, wxCoord xEnd, wxCoord yEnd, wxCoord xc, wxCoord yc) |
Draws an arc from the given start to the given end point. More... | |
void | DrawArc (const wxPoint &ptStart, const wxPoint &ptEnd, const wxPoint ¢re) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawBitmap (const wxBitmap &bitmap, wxCoord x, wxCoord y, bool useMask=false) |
Draw a bitmap on the device context at the specified point. More... | |
void | DrawBitmap (const wxBitmap &bmp, const wxPoint &pt, bool useMask=false) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawCheckMark (wxCoord x, wxCoord y, wxCoord width, wxCoord height) |
Draws a check mark inside the given rectangle. More... | |
void | DrawCheckMark (const wxRect &rect) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawCircle (wxCoord x, wxCoord y, wxCoord radius) |
Draws a circle with the given centre and radius. More... | |
void | DrawCircle (const wxPoint &pt, wxCoord radius) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawEllipse (wxCoord x, wxCoord y, wxCoord width, wxCoord height) |
Draws an ellipse contained in the rectangle specified either with the given top left corner and the given size or directly. More... | |
void | DrawEllipse (const wxPoint &pt, const wxSize &size) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawEllipse (const wxRect &rect) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawEllipticArc (wxCoord x, wxCoord y, wxCoord width, wxCoord height, double start, double end) |
Draws an arc of an ellipse. More... | |
void | DrawEllipticArc (const wxPoint &pt, const wxSize &sz, double sa, double ea) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawIcon (const wxIcon &icon, wxCoord x, wxCoord y) |
Draw an icon on the display (does nothing if the device context is PostScript). More... | |
void | DrawIcon (const wxIcon &icon, const wxPoint &pt) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawLabel (const wxString &text, const wxBitmap &bitmap, const wxRect &rect, int alignment=wxALIGN_LEFT|wxALIGN_TOP, int indexAccel=-1, wxRect *rectBounding=NULL) |
Draw optional bitmap and the text into the given rectangle and aligns it as specified by alignment parameter; it also will emphasize the character with the given index if it is != -1 and return the bounding rectangle if required. More... | |
void | DrawLabel (const wxString &text, const wxRect &rect, int alignment=wxALIGN_LEFT|wxALIGN_TOP, int indexAccel=-1) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) |
Draws a line from the first point to the second. More... | |
void | DrawLine (const wxPoint &pt1, const wxPoint &pt2) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawLines (int n, const wxPoint points[], wxCoord xoffset=0, wxCoord yoffset=0) |
Draws lines using an array of points of size n adding the optional offset coordinate. More... | |
void | DrawLines (const wxPointList *points, wxCoord xoffset=0, wxCoord yoffset=0) |
This method uses a list of wxPoints, adding the optional offset coordinate. More... | |
void | DrawPoint (wxCoord x, wxCoord y) |
Draws a point using the color of the current pen. More... | |
void | DrawPoint (const wxPoint &pt) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawPolygon (int n, const wxPoint points[], wxCoord xoffset=0, wxCoord yoffset=0, wxPolygonFillMode fill_style=wxODDEVEN_RULE) |
Draws a filled polygon using an array of points of size n, adding the optional offset coordinate. More... | |
void | DrawPolygon (const wxPointList *points, wxCoord xoffset=0, wxCoord yoffset=0, wxPolygonFillMode fill_style=wxODDEVEN_RULE) |
This method draws a filled polygon using a list of wxPoints, adding the optional offset coordinate. More... | |
void | DrawPolyPolygon (int n, const int count[], const wxPoint points[], wxCoord xoffset=0, wxCoord yoffset=0, wxPolygonFillMode fill_style=wxODDEVEN_RULE) |
Draws two or more filled polygons using an array of points, adding the optional offset coordinates. More... | |
void | DrawRectangle (wxCoord x, wxCoord y, wxCoord width, wxCoord height) |
Draws a rectangle with the given top left corner, and with the given size. More... | |
void | DrawRectangle (const wxPoint &pt, const wxSize &sz) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawRectangle (const wxRect &rect) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawRotatedText (const wxString &text, wxCoord x, wxCoord y, double angle) |
Draws the text rotated by angle degrees (positive angles are counterclockwise; the full angle is 360 degrees). More... | |
void | DrawRotatedText (const wxString &text, const wxPoint &point, double angle) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawRoundedRectangle (wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius) |
Draws a rectangle with the given top left corner, and with the given size. More... | |
void | DrawRoundedRectangle (const wxPoint &pt, const wxSize &sz, double radius) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawRoundedRectangle (const wxRect &rect, double radius) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawSpline (int n, const wxPoint points[]) |
Draws a spline between all given points using the current pen. More... | |
void | DrawSpline (const wxPointList *points) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawSpline (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord x3, wxCoord y3) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DrawText (const wxString &text, wxCoord x, wxCoord y) |
Draws a text string at the specified point, using the current text font, and the current text foreground and background colours. More... | |
void | DrawText (const wxString &text, const wxPoint &pt) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | GradientFillConcentric (const wxRect &rect, const wxColour &initialColour, const wxColour &destColour) |
Fill the area specified by rect with a radial gradient, starting from initialColour at the centre of the circle and fading to destColour on the circle outside. More... | |
void | GradientFillConcentric (const wxRect &rect, const wxColour &initialColour, const wxColour &destColour, const wxPoint &circleCenter) |
Fill the area specified by rect with a radial gradient, starting from initialColour at the centre of the circle and fading to destColour on the circle outside. More... | |
void | GradientFillLinear (const wxRect &rect, const wxColour &initialColour, const wxColour &destColour, wxDirection nDirection=wxRIGHT) |
Fill the area specified by rect with a linear gradient, starting from initialColour and eventually fading to destColour. More... | |
bool | FloodFill (wxCoord x, wxCoord y, const wxColour &colour, wxFloodFillStyle style=wxFLOOD_SURFACE) |
Flood fills the device context starting from the given point, using the current brush colour, and using a style: More... | |
bool | FloodFill (const wxPoint &pt, const wxColour &col, wxFloodFillStyle style=wxFLOOD_SURFACE) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | CrossHair (wxCoord x, wxCoord y) |
Displays a cross hair using the current pen. More... | |
void | CrossHair (const wxPoint &pt) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | DestroyClippingRegion () |
Destroys the current clipping region so that none of the DC is clipped. More... | |
void | GetClippingBox (wxCoord *x, wxCoord *y, wxCoord *width, wxCoord *height) const |
Gets the rectangle surrounding the current clipping region. More... | |
void | SetClippingRegion (wxCoord x, wxCoord y, wxCoord width, wxCoord height) |
Sets the clipping region for this device context to the intersection of the given region described by the parameters of this method and the previously set clipping region. More... | |
void | SetClippingRegion (const wxPoint &pt, const wxSize &sz) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | SetClippingRegion (const wxRect &rect) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | SetDeviceClippingRegion (const wxRegion ®ion) |
Sets the clipping region for this device context. More... | |
wxCoord | GetCharHeight () const |
Gets the character height of the currently set font. More... | |
wxCoord | GetCharWidth () const |
Gets the average character width of the currently set font. More... | |
wxFontMetrics | GetFontMetrics () const |
Returns the various font characteristics. More... | |
void | GetMultiLineTextExtent (const wxString &string, wxCoord *w, wxCoord *h, wxCoord *heightLine=NULL, const wxFont *font=NULL) const |
Gets the dimensions of the string using the currently selected font. More... | |
wxSize | GetMultiLineTextExtent (const wxString &string) const |
Gets the dimensions of the string using the currently selected font. More... | |
bool | GetPartialTextExtents (const wxString &text, wxArrayInt &widths) const |
Fills the widths array with the widths from the beginning of text to the corresponding character of text. More... | |
void | GetTextExtent (const wxString &string, wxCoord *w, wxCoord *h, wxCoord *descent=NULL, wxCoord *externalLeading=NULL, const wxFont *font=NULL) const |
Gets the dimensions of the string using the currently selected font. More... | |
wxSize | GetTextExtent (const wxString &string) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
int | GetBackgroundMode () const |
Returns the current background mode: wxPENSTYLE_SOLID or wxPENSTYLE_TRANSPARENT . More... | |
const wxFont & | GetFont () const |
Gets the current font. More... | |
wxLayoutDirection | GetLayoutDirection () const |
Gets the current layout direction of the device context. More... | |
const wxColour & | GetTextBackground () const |
Gets the current text background colour. More... | |
const wxColour & | GetTextForeground () const |
Gets the current text foreground colour. More... | |
void | SetBackgroundMode (int mode) |
mode may be one of wxPENSTYLE_SOLID and wxPENSTYLE_TRANSPARENT . More... | |
void | SetFont (const wxFont &font) |
Sets the current font for the DC. More... | |
void | SetTextBackground (const wxColour &colour) |
Sets the current text background colour for the DC. More... | |
void | SetTextForeground (const wxColour &colour) |
Sets the current text foreground colour for the DC. More... | |
void | SetLayoutDirection (wxLayoutDirection dir) |
Sets the current layout direction for the device context. More... | |
void | CalcBoundingBox (wxCoord x, wxCoord y) |
Adds the specified point to the bounding box which can be retrieved with MinX(), MaxX() and MinY(), MaxY() functions. More... | |
wxCoord | MaxX () const |
Gets the maximum horizontal extent used in drawing commands so far. More... | |
wxCoord | MaxY () const |
Gets the maximum vertical extent used in drawing commands so far. More... | |
wxCoord | MinX () const |
Gets the minimum horizontal extent used in drawing commands so far. More... | |
wxCoord | MinY () const |
Gets the minimum vertical extent used in drawing commands so far. More... | |
void | ResetBoundingBox () |
Resets the bounding box: after a call to this function, the bounding box doesn't contain anything. More... | |
bool | StartDoc (const wxString &message) |
Starts a document (only relevant when outputting to a printer). More... | |
void | StartPage () |
Starts a document page (only relevant when outputting to a printer). More... | |
void | EndDoc () |
Ends a document (only relevant when outputting to a printer). More... | |
void | EndPage () |
Ends a document page (only relevant when outputting to a printer). More... | |
bool | Blit (wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, wxRasterOperationMode logicalFunc=wxCOPY, bool useMask=false, wxCoord xsrcMask=wxDefaultCoord, wxCoord ysrcMask=wxDefaultCoord) |
Copy from a source DC to this DC. More... | |
bool | StretchBlit (wxCoord xdest, wxCoord ydest, wxCoord dstWidth, wxCoord dstHeight, wxDC *source, wxCoord xsrc, wxCoord ysrc, wxCoord srcWidth, wxCoord srcHeight, wxRasterOperationMode logicalFunc=wxCOPY, bool useMask=false, wxCoord xsrcMask=wxDefaultCoord, wxCoord ysrcMask=wxDefaultCoord) |
Copy from a source DC to this DC possibly changing the scale. More... | |
const wxBrush & | GetBackground () const |
Gets the brush used for painting the background. More... | |
const wxBrush & | GetBrush () const |
Gets the current brush. More... | |
const wxPen & | GetPen () const |
Gets the current pen. More... | |
void | SetBackground (const wxBrush &brush) |
Sets the current background brush for the DC. More... | |
void | SetBrush (const wxBrush &brush) |
Sets the current brush for the DC. More... | |
void | SetPen (const wxPen &pen) |
Sets the current pen for the DC. More... | |
bool | CanUseTransformMatrix () const |
Check if the use of transformation matrix is supported by the current system. More... | |
bool | SetTransformMatrix (const wxAffineMatrix2D &matrix) |
Set the transformation matrix. More... | |
wxAffineMatrix2D | GetTransformMatrix () const |
Return the transformation matrix used by this device context. More... | |
void | ResetTransformMatrix () |
Revert the transformation matrix to identity matrix. More... | |
bool | CanDrawBitmap () const |
Does the DC support drawing bitmaps? More... | |
bool | CanGetTextExtent () const |
Does the DC support calculating the size required to draw text? More... | |
void | GetLogicalOrigin (wxCoord *x, wxCoord *y) const |
Return the coordinates of the logical point (0, 0). More... | |
wxPoint | GetLogicalOrigin () const |
Return the coordinates of the logical point (0, 0). More... | |
Public Member Functions inherited from wxObject | |
wxObject () | |
Default ctor; initializes to NULL the internal reference data. More... | |
wxObject (const wxObject &other) | |
Copy ctor. More... | |
virtual | ~wxObject () |
Destructor. More... | |
virtual wxClassInfo * | GetClassInfo () const |
This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). More... | |
wxObjectRefData * | GetRefData () const |
Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More... | |
bool | IsKindOf (const wxClassInfo *info) const |
Determines whether this class is a subclass of (or the same class as) the given class. More... | |
bool | IsSameAs (const wxObject &obj) const |
Returns true if this object has the same data pointer as obj. More... | |
void | Ref (const wxObject &clone) |
Makes this object refer to the data in clone. More... | |
void | SetRefData (wxObjectRefData *data) |
Sets the wxObject::m_refData pointer. More... | |
void | UnRef () |
Decrements the reference count in the associated data, and if it is zero, deletes the data. More... | |
void | UnShare () |
This is the same of AllocExclusive() but this method is public. More... | |
void | operator delete (void *buf) |
The delete operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined. More... | |
void * | operator new (size_t size, const wxString &filename=NULL, int lineNum=0) |
The new operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from wxObject | |
void | AllocExclusive () |
Ensure that this object's data is not shared with any other object. More... | |
virtual wxObjectRefData * | CreateRefData () const |
Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More... | |
virtual wxObjectRefData * | CloneRefData (const wxObjectRefData *data) const |
Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data. More... | |
Protected Attributes inherited from wxObject | |
wxObjectRefData * | m_refData |
Pointer to an object which is the object's reference-counted data. More... | |
wxClientDC::wxClientDC | ( | wxWindow * | window | ) |
Constructor.
Pass a pointer to the window on which you wish to paint.