disallow creation of wxDC objects and made wxDC an ABC; use wxDCTemp instead of wxDC in wx code; fixed WinCE bug with deleting a DC which should be released in wxListBox::MSWOnMeasure()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36564 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-12-25 02:34:42 +00:00
parent f23d32554f
commit 7d09b97f53
7 changed files with 108 additions and 56 deletions

View File

@@ -776,16 +776,19 @@ bool wxListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item)
HDC hdc = CreateIC(wxT("DISPLAY"), NULL, NULL, 0);
#endif
wxDC dc;
dc.SetHDC((WXHDC)hdc);
dc.SetFont(GetFont());
{
wxDCTemp dc((WXHDC)hdc);
dc.SetFont(GetFont());
pStruct->itemHeight = dc.GetCharHeight() + 2*OWNER_DRAWN_LISTBOX_EXTRA_SPACE;
pStruct->itemWidth = dc.GetCharWidth();
dc.SetHDC(0);
pStruct->itemHeight = dc.GetCharHeight() + 2*OWNER_DRAWN_LISTBOX_EXTRA_SPACE;
pStruct->itemWidth = dc.GetCharWidth();
}
#ifdef __WXWINCE__
ReleaseDC(NULL, hdc);
#else
DeleteDC(hdc);
#endif
return true;
}