This method was defined in wxBitmapBase which is not used by wxMSW (and wxOS2)
so it wasn't available there. Move the definition of the method inline and
reuse it for all ports, making it part of either wxBitmapBase or wxBitmap as
appropriate.
This is clearly ugly but we still have no good solution for deriving wxBitmap
from wxBitmapBase in wxMSW as it already inherits from MSW-specific wxGDIImage
there.
Also document that ConvertToDisabled() is only available when wxUSE_IMAGE==1.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66086
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#include "wx/string.h"
#include "wx/gdicmn.h" // for wxBitmapType
#include "wx/colour.h"
+#include "wx/image.h"
class WXDLLIMPEXP_FWD_CORE wxBitmap;
class WXDLLIMPEXP_FWD_CORE wxBitmapHandler;
class WXDLLIMPEXP_FWD_CORE wxIcon;
-class WXDLLIMPEXP_FWD_CORE wxImage;
class WXDLLIMPEXP_FWD_CORE wxMask;
class WXDLLIMPEXP_FWD_CORE wxPalette;
#if wxUSE_IMAGE
virtual wxImage ConvertToImage() const = 0;
+
+ // Convert to disabled (dimmed) bitmap.
+ wxBitmap ConvertToDisabled(unsigned char brightness = 255) const;
#endif // wxUSE_IMAGE
virtual wxMask *GetMask() const = 0;
virtual wxBitmap GetSubBitmap(const wxRect& rect) const = 0;
- // Convert to disabled (dimmed) bitmap.
- wxBitmap ConvertToDisabled(unsigned char brightness = 255) const;
-
virtual bool SaveFile(const wxString &name, wxBitmapType type,
const wxPalette *palette = NULL) const = 0;
virtual bool LoadFile(const wxString &name, wxBitmapType type) = 0;
#include "wx/os2/bitmap.h"
#endif
+#if wxUSE_IMAGE
+inline
+wxBitmap
+#if wxUSE_BITMAP_BASE
+wxBitmapBase::
+#else
+wxBitmap::
+#endif
+ConvertToDisabled(unsigned char brightness) const
+{
+ return ConvertToImage().ConvertToDisabled(brightness);
+}
+#endif // wxUSE_IMAGE
+
// we must include generic mask.h after wxBitmap definition
#if defined(__WXMGL__) || defined(__WXDFB__)
#define wxUSE_GENERIC_MASK 1
class WXDLLIMPEXP_FWD_CORE wxDIB;
#endif
class WXDLLIMPEXP_FWD_CORE wxIcon;
-class WXDLLIMPEXP_FWD_CORE wxImage;
class WXDLLIMPEXP_FWD_CORE wxMask;
class WXDLLIMPEXP_FWD_CORE wxPalette;
class WXDLLIMPEXP_FWD_CORE wxPixelDataBase;
#if wxUSE_IMAGE
wxImage ConvertToImage() const;
+ wxBitmap ConvertToDisabled(unsigned char brightness = 255) const;
#endif // wxUSE_IMAGE
// get the given part of bitmap
class WXDLLIMPEXP_FWD_CORE wxMask;
class WXDLLIMPEXP_FWD_CORE wxCursor;
class WXDLLIMPEXP_FWD_CORE wxControl;
-class WXDLLIMPEXP_FWD_CORE wxImage;
class WXDLLIMPEXP_FWD_CORE wxPixelDataBase;
// ----------------------------------------------------------------------------
virtual ~wxBitmap();
wxImage ConvertToImage() const;
+ wxBitmap ConvertToDisabled(unsigned char brightness = 255) const;
// get the given part of bitmap
wxBitmap GetSubBitmap(const wxRect& rRect) const;
#if wxUSE_IMAGE && wxUSE_WXDIB
wxImage ConvertToImage() const;
+ wxBitmap ConvertToDisabled(unsigned char brightness = 255) const;
#endif // wxUSE_IMAGE
// get the given part of bitmap
/**
Returns disabled (dimmed) version of the bitmap.
+
+ This method is not available when <code>wxUSE_IMAGE == 0</code>.
+
@since 2.9.0
*/
wxBitmap ConvertToDisabled(unsigned char brightness = 255) const;
void OnExit() { wxBitmap::CleanUpHandlers(); }
};
-wxBitmap wxBitmapBase::ConvertToDisabled(unsigned char brightness) const
-{
- wxBitmap bmp;
-#if wxUSE_IMAGE
- wxImage image = ConvertToImage();
- bmp = wxBitmap(image.ConvertToDisabled(brightness));
-#endif
- return bmp;
-}
-
IMPLEMENT_DYNAMIC_CLASS(wxBitmapBaseModule, wxModule)
#endif // wxUSE_BITMAP_BASE