X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/57c208c5759da71a637f0f0f5b7d3dc3eda09c02..8d99be5f5381dad56492da02c2df1c3ec0750926:/src/msw/bitmap.cpp?ds=sidebyside diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index 948d339184..e6194fcef9 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -61,8 +61,8 @@ wxBitmapRefData::~wxBitmapRefData(void) { if (m_selectedInto) { - char buf[200]; - sprintf(buf, "Bitmap was deleted without selecting out of wxMemoryDC %X.", (unsigned int) m_selectedInto); + wxChar buf[200]; + wxSprintf(buf, _T("Bitmap was deleted without selecting out of wxMemoryDC %X."), (unsigned int) m_selectedInto); wxFatalError(buf); } if (m_hBitmap) @@ -98,8 +98,8 @@ bool wxBitmap::FreeResource(bool WXUNUSED(force)) if (M_BITMAPDATA->m_selectedInto) { - char buf[200]; - sprintf(buf, "Bitmap %X was deleted without selecting out of wxMemoryDC %X.", (unsigned int) this, (unsigned int) M_BITMAPDATA->m_selectedInto); + wxChar buf[200]; + wxSprintf(buf, _T("Bitmap %X was deleted without selecting out of wxMemoryDC %X."), (unsigned int) this, (unsigned int) M_BITMAPDATA->m_selectedInto); wxFatalError(buf); } if (M_BITMAPDATA->m_hBitmap) @@ -142,7 +142,7 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits } // Create from XPM data -wxBitmap::wxBitmap(char **data, wxItem *WXUNUSED(anItem)) +wxBitmap::wxBitmap(char **data, wxControl *WXUNUSED(anItem)) { (void) Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); } @@ -208,7 +208,7 @@ bool wxBitmap::LoadFile(const wxString& filename, long type) wxBitmapHandler *handler = FindHandler(type); if ( handler == NULL ) { - wxLogWarning("no bitmap handler for type %d defined.", type); + wxLogWarning(_T("no bitmap handler for type %d defined."), type); return FALSE; } @@ -225,7 +225,7 @@ bool wxBitmap::Create(void *data, long type, int width, int height, int depth) wxBitmapHandler *handler = FindHandler(type); if ( handler == NULL ) { - wxLogWarning("no bitmap handler for type %d defined.", type); + wxLogWarning(_T("no bitmap handler for type %d defined."), type); return FALSE; } @@ -238,7 +238,7 @@ bool wxBitmap::SaveFile(const wxString& filename, int type, const wxPalette *pal wxBitmapHandler *handler = FindHandler(type); if ( handler == NULL ) { - wxLogWarning("no bitmap handler for type %d defined.", type); + wxLogWarning(_T("no bitmap handler for type %d defined."), type); return FALSE; } @@ -620,17 +620,22 @@ bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long M_BITMAPHANDLERDATA->m_hBitmap = (WXHBITMAP) ::LoadBitmap(wxGetInstance(), name); if (M_BITMAPHANDLERDATA->m_hBitmap) { - M_BITMAPHANDLERDATA->m_ok = TRUE; - BITMAP bm; - GetObject((HBITMAP) M_BITMAPHANDLERDATA->m_hBitmap, sizeof(BITMAP), (LPSTR) &bm); - M_BITMAPHANDLERDATA->m_width = bm.bmWidth; - M_BITMAPHANDLERDATA->m_height = bm.bmHeight; - M_BITMAPHANDLERDATA->m_depth = bm.bmBitsPixel; - return TRUE; + M_BITMAPHANDLERDATA->m_ok = TRUE; + BITMAP bm; + GetObject((HBITMAP) M_BITMAPHANDLERDATA->m_hBitmap, sizeof(BITMAP), (LPSTR) &bm); + M_BITMAPHANDLERDATA->m_width = bm.bmWidth; + M_BITMAPHANDLERDATA->m_height = bm.bmHeight; + M_BITMAPHANDLERDATA->m_depth = bm.bmBitsPixel; + + if ( bitmap->IsKindOf(CLASSINFO(wxIcon)) ) + { + } + + return TRUE; } // it's probably not found - wxLogError("Can't load bitmap '%s' from resources! Check .rc file.", name.c_str()); + wxLogError(_T("Can't load bitmap '%s' from resources! Check .rc file."), name.c_str()); return FALSE; } @@ -670,7 +675,10 @@ bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long WXU palette = NULL; } if (palette) - M_BITMAPHANDLERDATA->m_bitmapPalette = *palette; + { + M_BITMAPHANDLERDATA->m_bitmapPalette = *palette; + delete palette; + } return success; #else return FALSE;