X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/25dd6997c5dfd92e8f8ea056253154b65d109c5a..e0c5c96f67eaf13ccbd378616bdf98c8dba01e78:/src/common/artprov.cpp diff --git a/src/common/artprov.cpp b/src/common/artprov.cpp index 8da185b4e8..a14428f89e 100644 --- a/src/common/artprov.cpp +++ b/src/common/artprov.cpp @@ -13,7 +13,7 @@ // headers // --------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "artprov.h" #endif @@ -32,7 +32,9 @@ #include "wx/artprov.h" #include "wx/hashmap.h" #include "wx/module.h" +#if wxUSE_IMAGE #include "wx/image.h" +#endif // For the purposes of forcing this module to link extern char g_ArtProviderModule; @@ -114,11 +116,11 @@ wxArtProviderCache *wxArtProvider::sm_cache = NULL; if ( !sm_providers ) { sm_providers = new wxArtProvidersList; - sm_providers->DeleteContents(TRUE); sm_cache = new wxArtProviderCache; } sm_providers->Insert(provider); + sm_cache->Clear(); } /*static*/ bool wxArtProvider::PopProvider() @@ -126,7 +128,8 @@ wxArtProviderCache *wxArtProvider::sm_cache = NULL; wxCHECK_MSG( sm_providers, FALSE, _T("no wxArtProvider exists") ); wxCHECK_MSG( sm_providers->GetCount() > 0, FALSE, _T("wxArtProviders stack is empty") ); - sm_providers->DeleteNode(sm_providers->GetFirst()); + delete sm_providers->GetFirst()->GetData(); + sm_providers->Erase(sm_providers->GetFirst()); sm_cache->Clear(); return TRUE; } @@ -137,6 +140,7 @@ wxArtProviderCache *wxArtProvider::sm_cache = NULL; if ( sm_providers->DeleteObject(provider) ) { + delete provider; sm_cache->Clear(); return TRUE; } @@ -146,6 +150,7 @@ wxArtProviderCache *wxArtProvider::sm_cache = NULL; /*static*/ void wxArtProvider::CleanUpProviders() { + WX_CLEAR_LIST(wxArtProvidersList, *sm_providers); wxDELETE(sm_providers); wxDELETE(sm_cache); } @@ -164,12 +169,13 @@ wxArtProviderCache *wxArtProvider::sm_cache = NULL; wxBitmap bmp; if ( !sm_cache->GetBitmap(hashId, &bmp) ) { - for (wxArtProvidersList::Node *node = sm_providers->GetFirst(); + for (wxArtProvidersList::compatibility_iterator node = sm_providers->GetFirst(); node; node = node->GetNext()) { bmp = node->GetData()->CreateBitmap(id, client, size); if ( bmp.Ok() ) { +#if wxUSE_IMAGE if ( size != wxDefaultSize && (bmp.GetWidth() != size.x || bmp.GetHeight() != size.y) ) { @@ -177,6 +183,7 @@ wxArtProviderCache *wxArtProvider::sm_cache = NULL; img.Rescale(size.x, size.y); bmp = wxBitmap(img); } +#endif break; } } @@ -206,8 +213,15 @@ wxArtProviderCache *wxArtProvider::sm_cache = NULL; class wxArtProviderModule: public wxModule { public: - bool OnInit() { return TRUE; } - void OnExit() { wxArtProvider::CleanUpProviders(); } + bool OnInit() + { + wxArtProvider::InitStdProvider(); + return TRUE; + } + void OnExit() + { + wxArtProvider::CleanUpProviders(); + } DECLARE_DYNAMIC_CLASS(wxArtProviderModule) };