1. undid my wrong fix to wxWindowBase::Centre
2. corrected fatal bug in wxCheckLstBox (double deletion of items) 3. wxTextCtrl::SetValue() only does it if the new text is different from the old one 4. wxBitmap(const wxIcon&) ctor added 5. compilation fixes for VC++ and generic Win32 implementation of wxGetCurrentTime() in timercmn.cpp git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4534 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -99,26 +99,44 @@ wxBitmap::wxBitmap()
|
||||
wxTheBitmapList->AddBitmap(this);
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(const wxIcon& icon)
|
||||
{
|
||||
if ( wxTheBitmapList )
|
||||
wxTheBitmapList->AddBitmap(this);
|
||||
|
||||
if ( !icon.Ok() )
|
||||
return;
|
||||
|
||||
int width = icon.GetWidth(),
|
||||
height = icon.GetHeight();
|
||||
|
||||
HDC hdc = ::CreateCompatibleDC(NULL); // screen DC
|
||||
HBITMAP hbitmap = ::CreateCompatibleBitmap(hdc, width, height);
|
||||
HBITMAP hbmpOld = (HBITMAP)::SelectObject(hdc, hbitmap);
|
||||
|
||||
HICON hicon = (HICON) icon.GetHICON();
|
||||
#if defined(__WIN32__) && !defined(__SC__) && !defined(__TWIN32__)
|
||||
::DrawIconEx(hdc, 0, 0, hicon, width, height, 0, 0, DI_NORMAL);
|
||||
#else
|
||||
::DrawIcon(hdc, 0, 0, hicon);
|
||||
#endif
|
||||
|
||||
::SelectObject(hdc, hbmpOld);
|
||||
::DeleteDC(hdc);
|
||||
|
||||
m_refData = new wxBitmapRefData;
|
||||
M_BITMAPDATA->m_width = width;
|
||||
M_BITMAPDATA->m_height = height;
|
||||
M_BITMAPDATA->m_depth = wxDisplayDepth();
|
||||
M_BITMAPDATA->m_numColors = 0;
|
||||
|
||||
M_BITMAPDATA->m_hBitmap = (WXHBITMAP)hbitmap;
|
||||
M_BITMAPDATA->m_ok = TRUE;
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(const wxBitmap& bitmap)
|
||||
{
|
||||
wxIcon *icon = wxDynamicCast(&bitmap, wxIcon);
|
||||
if ( icon )
|
||||
{
|
||||
HDC hdc = ::CreateCompatibleDC(NULL); // screen DC
|
||||
HBITMAP hbitmap = ::CreateCompatibleBitmap(hdc,
|
||||
icon->GetWidth(),
|
||||
icon->GetHeight());
|
||||
::SelectObject(hdc, hbitmap);
|
||||
::DrawIcon(hdc, 0, 0, (HICON)icon->GetHICON());
|
||||
|
||||
::DeleteDC(hdc);
|
||||
|
||||
SetHBITMAP((WXHBITMAP)hbitmap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Ref(bitmap);
|
||||
}
|
||||
Ref(bitmap);
|
||||
|
||||
if ( wxTheBitmapList )
|
||||
wxTheBitmapList->AddBitmap(this);
|
||||
|
Reference in New Issue
Block a user