From dd7d379ebc6d8f86faff623e0378c0f12bcc9601 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Thu, 31 Aug 2006 17:00:13 +0000 Subject: [PATCH] added wxArtProvider::InsertProvider to accompany PushProvider git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40941 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/artprov.tex | 18 +++++++++++++++++- include/wx/artprov.h | 12 ++++++++++-- src/common/artprov.cpp | 15 +++++++++++++-- 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/docs/latex/wx/artprov.tex b/docs/latex/wx/artprov.tex index 16a804837e..690fd24b39 100644 --- a/docs/latex/wx/artprov.tex +++ b/docs/latex/wx/artprov.tex @@ -183,6 +183,17 @@ Returns a suitable size hint for the given {\it wxArtClient}. If otherwise return the size from the topmost wxArtProvider. {\it wxDefaultSize} may be returned if the client doesn't have a specified size, like wxART\_OTHER for example. +\membersection{wxArtProvider::InsertProvider}\label{wxartproviderinsertprovider} + +\func{static void}{InsertProvider}{\param{wxArtProvider* }{provider}} + +Register new art provider and add it to the bottom of providers stack (i.e. +it will be queried as the last one). + +\wxheading{See also} + +\helpref{PushProvider}{wxartproviderpushprovider} + \membersection{wxArtProvider::PopProvider}\label{wxartproviderctor} \func{static bool}{PopProvider}{\void} @@ -193,7 +204,12 @@ Remove latest added provider and delete it. \func{static void}{PushProvider}{\param{wxArtProvider* }{provider}} -Register new art provider (add it to the top of providers stack). +Register new art provider and add it to the top of providers stack (i.e. it +will be queried as the first provider). + +\wxheading{See also} + +\helpref{InsertProvider}{wxartproviderinsertprovider} \membersection{wxArtProvider::RemoveProvider}\label{wxartproviderremoveprovider} diff --git a/include/wx/artprov.h b/include/wx/artprov.h index c2b9d98bdd..91e5a270bc 100644 --- a/include/wx/artprov.h +++ b/include/wx/artprov.h @@ -112,9 +112,14 @@ typedef wxString wxArtID; class WXDLLEXPORT wxArtProvider : public wxObject { public: - // Add new provider to the top of providers stack. + // Add new provider to the top of providers stack (i.e. the provider will + // be querier first of all). static void PushProvider(wxArtProvider *provider); + // Add new provider to the bottom of providers stack (i.e. the provider + // will be queried as the last one). + static void InsertProvider(wxArtProvider *provider); + // Remove latest added provider and delete it. static bool PopProvider(); @@ -152,7 +157,7 @@ protected: { return GetSizeHint(client, true); } - + // Derived classes must override this method to create requested // art resource. This method is called only once per instance's // lifetime for each requested wxArtID. @@ -160,6 +165,9 @@ protected: const wxArtClient& WXUNUSED(client), const wxSize& WXUNUSED(size)) = 0; +private: + static void InitProvidersList(); + private: // list of providers: static wxArtProvidersList *sm_providers; diff --git a/src/common/artprov.cpp b/src/common/artprov.cpp index 04873a0698..918dc3307a 100644 --- a/src/common/artprov.cpp +++ b/src/common/artprov.cpp @@ -99,7 +99,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxArtProvider, wxObject) wxArtProvidersList *wxArtProvider::sm_providers = NULL; wxArtProviderCache *wxArtProvider::sm_cache = NULL; -/*static*/ void wxArtProvider::PushProvider(wxArtProvider *provider) +/*static*/ void wxArtProvider::CommonAddingProvider() { if ( !sm_providers ) { @@ -107,10 +107,21 @@ wxArtProviderCache *wxArtProvider::sm_cache = NULL; sm_cache = new wxArtProviderCache; } - sm_providers->Insert(provider); sm_cache->Clear(); } +/*static*/ void wxArtProvider::PushProvider(wxArtProvider *provider) +{ + CommonAddingProvider(); + sm_providers->Insert(provider); +} + +/*static*/ void wxArtProvider::InsertProvider(wxArtProvider *provider) +{ + CommonAddingProvider(); + sm_providers->Append(provider); +} + /*static*/ bool wxArtProvider::PopProvider() { wxCHECK_MSG( sm_providers, false, _T("no wxArtProvider exists") ); -- 2.45.2