git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41475
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
class WXDLLEXPORT wxDCTemp : public wxDC
{
public:
class WXDLLEXPORT wxDCTemp : public wxDC
{
public:
- wxDCTemp(WXHDC hdc) : wxDC(hdc)
+ // construct a temporary DC with the specified HDC and size (it should be
+ // specified whenever we know it for this HDC)
+ wxDCTemp(WXHDC hdc, const wxSize& size = wxDefaultSize)
+ : wxDC(hdc),
+ m_size(size)
protected:
virtual void DoGetSize(int *w, int *h) const
{
protected:
virtual void DoGetSize(int *w, int *h) const
{
- wxFAIL_MSG( _T("no way to retrieve the size of generic DC") );
+ wxASSERT_MSG( m_size.IsFullySpecified(),
+ _T("size of this DC hadn't been set and is unknown") );
+ // size of this DC must be explicitly set by SetSize() as we have no way to
+ // find it ourselves
+ const wxSize m_size;
+
DECLARE_NO_COPY_CLASS(wxDCTemp)
};
DECLARE_NO_COPY_CLASS(wxDCTemp)
};
bool wxWindowMSW::HandleEraseBkgnd(WXHDC hdc)
{
bool wxWindowMSW::HandleEraseBkgnd(WXHDC hdc)
{
+ wxDCTemp dc(hdc, GetClientSize());
dc.SetHDC(hdc);
dc.SetWindow((wxWindow *)this);
dc.SetHDC(hdc);
dc.SetWindow((wxWindow *)this);