X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b91c4601f2cc8fab375dc49a0a1222d58065cfdb..ddd0db9619bb3b8d7dc5e67f2a0b99052fb565d5:/interface/wx/dc.h?ds=inline diff --git a/interface/wx/dc.h b/interface/wx/dc.h index f7b170c64c..0fa93ce917 100644 --- a/interface/wx/dc.h +++ b/interface/wx/dc.h @@ -121,7 +121,7 @@ public: bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC* source, wxCoord xsrc, wxCoord ysrc, int logicalFunc = wxCOPY, bool useMask = false, - wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); + wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); /** Adds the specified point to the bounding box which can be retrieved @@ -136,13 +136,6 @@ public: */ void Clear(); - /** - Performs all necessary computations for given platform and context type - after each change of scale and origin parameters. Usually called - automatically internally after such changes. - */ - virtual void ComputeScaleAndOrigin(); - /** Displays a cross hair using the current pen. This is a vertical and horizontal line the height and width of the window, centred on the @@ -207,7 +200,7 @@ public: @see SetTextForeground(), SetTextBackground(), wxMemoryDC */ void DrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, - bool transparent); + bool useMask = false); //@{ /** @@ -445,7 +438,7 @@ public: the string. See GetTextExtent() for how to get the dimensions of a text string, which can be used to position the text more precisely. - @note The current @ref GetLogicalFunction() "logical function" is + @note The current @ref GetLogicalFunction() "logical function" is ignored by this function. */ void DrawText(const wxString& text, wxCoord x, wxCoord y); @@ -517,7 +510,7 @@ public: are returned as a tuple. @endWxPythonOnly */ - void GetClippingBox(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + void GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *width, wxCoord *height) const; /** Returns the depth (number of bits/pixel) of this DC. @@ -576,7 +569,7 @@ public: void GetMultiLineTextExtent(const wxString& string, wxCoord* w, wxCoord* h, wxCoord* heightLine = NULL, - wxFont* font = NULL) const; + const wxFont* font = NULL) const; /** Gets the dimensions of the string using the currently selected font. @a string is the text string to measure, @e heightLine, if non @NULL, @@ -588,7 +581,7 @@ public: @see wxFont, SetFont(), GetPartialTextExtents(), GetTextExtent() */ - const wxSize GetMultiLineTextExtent(const wxString& string) const; + wxSize GetMultiLineTextExtent(const wxString& string) const; /** Fills the @a widths array with the widths from the beginning of @a text @@ -759,7 +752,7 @@ public: /** Returns @true if the DC is ok to use. */ - bool Ok(); + bool IsOk() const; /** Converts logical X coordinate to device coordinate, using the current @@ -1068,12 +1061,12 @@ public: setting the @c no-maskblt option to 1. @param xsrcMask Source x position on the mask. If both xsrcMask and ysrcMask are - -1, xsrc and ysrc will be assumed for the mask source position. - Currently only implemented on Windows. + wxDefaultCoord, @a xsrc and @a ysrc will be assumed for the mask + source position. Currently only implemented on Windows. @param ysrcMask Source y position on the mask. If both xsrcMask and ysrcMask are - -1, xsrc and ysrc will be assumed for the mask source position. - Currently only implemented on Windows. + wxDefaultCoord, @a xsrc and @a ysrc will be assumed for the mask + source position. Currently only implemented on Windows. There is partial support for Blit() in wxPostScriptDC, under X. @@ -1091,7 +1084,8 @@ public: wxCoord srcWidth, wxCoord srcHeight, int logicalFunc = wxCOPY, bool useMask = false, - wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); + wxCoord xsrcMask = wxDefaultCoord, + wxCoord ysrcMask = wxDefaultCoord); }; @@ -1137,5 +1131,139 @@ public: wxDCClipper(wxDC& dc, const wxRect& rect); wxDCClipper(wxDC& dc, int x, int y, int w, int h); //@} + + /** + Destroys the clipping region associated with the DC passed to the ctor. + */ + ~wxDCClipper(); +}; + + +/** + @class wxDCBrushChanger + + wxDCBrushChanger is a small helper class for setting a brush on a wxDC + and unsetting it automatically in the destructor, restoring the previous one. + + @library{wxcore} + @category{gdi} + + @see wxDC::SetBrush() +*/ +class wxDCBrushChanger +{ +public: + /** + Sets @a brush on the given @a dc, storing the old one. + + @param dc + The DC where the brush must be temporary set. + @param brush + The brush to set. + */ + wxDCBrushChanger(wxDC& dc, const wxBrush& brush); + + /** + Restores the brush originally selected in the DC passed to the ctor. + */ + ~wxDCBrushChanger(); +}; + + +/** + @class wxDCPenChanger + + wxDCPenChanger is a small helper class for setting a pen on a wxDC + and unsetting it automatically in the destructor, restoring the previous one. + + @library{wxcore} + @category{gdi} + + @see wxDC::SetPen() +*/ +class wxDCPenChanger +{ +public: + /** + Sets @a pen on the given @a dc, storing the old one. + + @param dc + The DC where the pen must be temporary set. + @param pen + The pen to set. + */ + wxDCPenChanger(wxDC& dc, const wxPen& pen); + + /** + Restores the pen originally selected in the DC passed to the ctor. + */ + ~wxDCPenChanger(); +}; + + + +/** + @class wxDCTextColourChanger + + wxDCTextColourChanger is a small helper class for setting a foreground + text colour on a wxDC and unsetting it automatically in the destructor, + restoring the previous one. + + @library{wxcore} + @category{gdi} + + @see wxDC::SetTextForeground() +*/ +class wxDCTextColourChanger +{ +public: + /** + Sets @a col on the given @a dc, storing the old one. + + @param dc + The DC where the colour must be temporary set. + @param col + The colour to set. + */ + wxDCTextColourChanger(wxDC& dc, const wxColour& col); + + /** + Restores the colour originally selected in the DC passed to the ctor. + */ + ~wxDCTextColourChanger(); +}; + + + +/** + @class wxDCFontChanger + + wxDCFontChanger is a small helper class for setting a font on a wxDC and + unsetting it automatically in the destructor, restoring the previous one. + + @since 2.9.0 + + @library{wxcore} + @category{gdi} + + @see wxDC::SetFont() +*/ +class wxDCFontChanger +{ +public: + /** + Sets @a font on the given @a dc, storing the old one. + + @param dc + The DC where the font must be temporary set. + @param font + The font to set. + */ + wxDCFontChanger(wxDC& dc, const wxFont& font); + + /** + Restores the colour originally selected in the DC passed to the ctor. + */ + ~wxDCFontChanger(); };