make sure wxDefaultArtProvider is linked-in

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17682 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2002-11-03 17:19:10 +00:00
parent 5f79bebb29
commit d402f19c82
3 changed files with 24 additions and 17 deletions

View File

@@ -22,6 +22,7 @@
class WXDLLEXPORT wxArtProvidersList; class WXDLLEXPORT wxArtProvidersList;
class WXDLLEXPORT wxArtProviderCache; class WXDLLEXPORT wxArtProviderCache;
class wxArtProviderModule;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Types // Types
@@ -113,10 +114,13 @@ public:
const wxArtClient& client = wxART_OTHER, const wxArtClient& client = wxART_OTHER,
const wxSize& size = wxDefaultSize); const wxSize& size = wxDefaultSize);
protected:
friend class wxArtProviderModule;
// Initializes default provider
static void InitStdProvider();
// Destroy caches & all providers // Destroy caches & all providers
static void CleanUpProviders(); static void CleanUpProviders();
protected:
// Derived classes must override this method to create requested // Derived classes must override this method to create requested
// art resource. This method is called only once per instance's // art resource. This method is called only once per instance's
// lifetime for each requested wxArtID. // lifetime for each requested wxArtID.

View File

@@ -207,8 +207,15 @@ wxArtProviderCache *wxArtProvider::sm_cache = NULL;
class wxArtProviderModule: public wxModule class wxArtProviderModule: public wxModule
{ {
public: public:
bool OnInit() { return TRUE; } bool OnInit()
void OnExit() { wxArtProvider::CleanUpProviders(); } {
wxArtProvider::InitStdProvider();
return TRUE;
}
void OnExit()
{
wxArtProvider::CleanUpProviders();
}
DECLARE_DYNAMIC_CLASS(wxArtProviderModule) DECLARE_DYNAMIC_CLASS(wxArtProviderModule)
}; };

View File

@@ -27,7 +27,6 @@
#endif #endif
#include "wx/artprov.h" #include "wx/artprov.h"
#include "wx/module.h"
// For the purposes of forcing this module to link // For the purposes of forcing this module to link
char g_ArtProviderModule = 0; char g_ArtProviderModule = 0;
@@ -93,23 +92,20 @@ protected:
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxDefaultArtProviderModule // wxArtProvider::InitStdProvider
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
class wxDefaultArtProviderModule: public wxModule /*static*/ void wxArtProvider::InitStdProvider()
{ {
public: // NB: A few notes about this function:
bool OnInit() // (1) it is in artstd.cpp and not in artprov.cpp on purpose. I wanted
{ // to avoid declaring wxDefaultArtProvider in any public header as
// it is only an implementation detail
// (2) other default art providers (e.g. GTK one) should NOT be added
// here. Instead, add them in port-specific initialialization code
wxArtProvider::PushProvider(new wxDefaultArtProvider); wxArtProvider::PushProvider(new wxDefaultArtProvider);
return TRUE; }
}
void OnExit() {}
DECLARE_DYNAMIC_CLASS(wxDefaultArtProviderModule)
};
IMPLEMENT_DYNAMIC_CLASS(wxDefaultArtProviderModule, wxModule)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------