From 26ee45e4a55270c79cbe0b691288d8d235626aca Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Tue, 11 Sep 2018 21:52:11 +0200 Subject: [PATCH] Deprecate wxBitmap::SetWidth/Height/Size/Depth, wxIcon::SetSize functions wxBitmap and wxIcon dimensions and colour depth are determined during creation so using all these functions could lead to inconsistencies. --- include/wx/msw/bitmap.h | 4 +++- include/wx/msw/gdiimage.h | 16 +++++++--------- include/wx/msw/icon.h | 5 ++++- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/include/wx/msw/bitmap.h b/include/wx/msw/bitmap.h index 555d7f801c..b4ebc8b5c3 100644 --- a/include/wx/msw/bitmap.h +++ b/include/wx/msw/bitmap.h @@ -199,7 +199,9 @@ public: void MSWUpdateAlpha(); public: - void SetHBITMAP(WXHBITMAP bmp) { SetHandle((WXHANDLE)bmp); } +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_INLINE(void SetHBITMAP(WXHBITMAP bmp), SetHandle((WXHANDLE)bmp); ) +#endif // WXWIN_COMPATIBILITY_3_0 WXHBITMAP GetHBITMAP() const { return (WXHBITMAP)GetHandle(); } bool InitFromHBITMAP(WXHBITMAP bmp, int width, int height, int depth); void ResetHBITMAP() { InitFromHBITMAP(NULL, 0, 0, 0); } diff --git a/include/wx/msw/gdiimage.h b/include/wx/msw/gdiimage.h index ce6d6f25ed..9f39219c67 100644 --- a/include/wx/msw/gdiimage.h +++ b/include/wx/msw/gdiimage.h @@ -118,16 +118,14 @@ public: wxSize(GetGDIImageData()->m_width, GetGDIImageData()->m_height); } - void SetWidth(int w) { AllocExclusive(); GetGDIImageData()->m_width = w; } - void SetHeight(int h) { AllocExclusive(); GetGDIImageData()->m_height = h; } - void SetDepth(int d) { AllocExclusive(); GetGDIImageData()->m_depth = d; } +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_INLINE(void SetWidth(int w), AllocExclusive(); GetGDIImageData()->m_width = w; ) + wxDEPRECATED_INLINE(void SetHeight(int h), AllocExclusive(); GetGDIImageData()->m_height = h; ) + wxDEPRECATED_INLINE(void SetDepth(int d), AllocExclusive(); GetGDIImageData()->m_depth = d; ) - void SetSize(int w, int h) - { - AllocExclusive(); - GetGDIImageData()->SetSize(w, h); - } - void SetSize(const wxSize& size) { SetSize(size.x, size.y); } + wxDEPRECATED_INLINE(void SetSize(int w, int h), AllocExclusive(); GetGDIImageData()->SetSize(w, h); ) + wxDEPRECATED_INLINE(void SetSize(const wxSize& size), AllocExclusive(); GetGDIImageData()->SetSize(size.x, size.y); ) +#endif // WXWIN_COMPATIBILITY_3_0 // forward some of base class virtuals to wxGDIImageRefData bool FreeResource(bool force = false) wxOVERRIDE; diff --git a/include/wx/msw/icon.h b/include/wx/msw/icon.h index 4a8ed4702a..60c698ed36 100644 --- a/include/wx/msw/icon.h +++ b/include/wx/msw/icon.h @@ -69,7 +69,10 @@ public: // implementation only from now on wxIconRefData *GetIconData() const { return (wxIconRefData *)m_refData; } - void SetHICON(WXHICON icon) { SetHandle((WXHANDLE)icon); } +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_INLINE(void SetHICON(WXHICON icon), SetHandle((WXHANDLE)icon); ) +#endif // WXWIN_COMPATIBILITY_3_0 + WXHICON GetHICON() const { return (WXHICON)GetHandle(); } bool InitFromHICON(WXHICON icon, int width, int height);