documented the wxDCBrushChanger, wxDCPenChanger, wxDCTextColourChanger; introduced a wxDCFontChanger
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56980 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
369042f03c
commit
c48d6cdf1f
@ -1252,4 +1252,32 @@ private:
|
||||
DECLARE_NO_COPY_CLASS(wxDCClipper)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// helper class: you can use it to temporarily change the DC font and
|
||||
// restore it automatically when the object goes out of scope
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxDCFontChanger
|
||||
{
|
||||
public:
|
||||
wxDCFontChanger(wxDC& dc, const wxFont& font) : m_dc(dc), m_fontOld(dc.GetFont())
|
||||
{
|
||||
m_dc.SetFont(font);
|
||||
}
|
||||
|
||||
~wxDCFontChanger()
|
||||
{
|
||||
if ( m_fontOld.Ok() )
|
||||
m_dc.SetFont(m_fontOld);
|
||||
}
|
||||
|
||||
private:
|
||||
wxDC& m_dc;
|
||||
|
||||
wxFont m_fontOld;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxDCFontChanger)
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_DC_H_BASE_
|
||||
|
@ -1131,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();
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user