From dc90e92110c5e844c821bf0ae970b594a8ead6a5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 8 May 2022 15:54:51 +0100 Subject: [PATCH] Add wxBitmapBundle::Clear() This is just a convenient helper for resetting the bundle contents which seems more readable than assigning an empty bundle to it. --- include/wx/bmpbndl.h | 3 +++ interface/wx/bmpbndl.h | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/wx/bmpbndl.h b/include/wx/bmpbndl.h index 312b978c5c..2f2f099680 100644 --- a/include/wx/bmpbndl.h +++ b/include/wx/bmpbndl.h @@ -108,6 +108,9 @@ public: // Check if bitmap bundle is non-empty. bool IsOk() const { return m_impl.get() != NULL; } + // Clear the bundle contents, IsOk() will return false after doing this. + void Clear() { m_impl.reset(NULL); } + // Get the size of the bitmap represented by this bundle when using the // default DPI, i.e. 100% scaling. Returns invalid size for empty bundle. wxSize GetDefaultSize() const; diff --git a/interface/wx/bmpbndl.h b/interface/wx/bmpbndl.h index e78c900f2e..901b56d20b 100644 --- a/interface/wx/bmpbndl.h +++ b/interface/wx/bmpbndl.h @@ -288,6 +288,18 @@ public: */ static wxBitmapBundle FromSVGResource(const wxString& name, const wxSize& sizeDef); + /** + Clear the existing bundle contents. + + After calling this function IsOk() returns @false. + + This is the same as assigning a default-constructed bitmap bundle to + this object but slightly more explicit. + + @since 3.1.7 + */ + void Clear(); + /** Check if bitmap bundle is non-empty.