+ wxRendererPtr& renderer = wxRendererPtr::Get();
+
+ return renderer.IsOk() ? *renderer.get() : GetDefault();
+}
+
+/* static */
+wxRendererNative *wxRendererNative::Set(wxRendererNative *rendererNew)
+{
+ wxRendererPtr& renderer = wxRendererPtr::Get();
+
+ wxRendererNative *rendererOld = renderer.release();
+
+ renderer.reset(rendererNew);
+
+ return rendererOld;
+}
+
+
+// ----------------------------------------------------------------------------
+// Dynamic renderers loading
+// ----------------------------------------------------------------------------
+
+#if wxUSE_DYNLIB_CLASS
+
+/* static */
+wxRendererNative *wxRendererNative::Load(const wxString& name)
+{
+ wxString fullname = wxDynamicLibrary::CanonicalizePluginName(name);
+
+ wxDynamicLibrary dll(fullname);
+ if ( !dll.IsLoaded() )
+ return NULL;
+
+ // each theme DLL must export a wxCreateRenderer() function with this
+ // signature
+ typedef wxRendererNative *(*wxCreateRenderer_t)();
+
+ wxDYNLIB_FUNCTION(wxCreateRenderer_t, wxCreateRenderer, dll);
+ if ( !pfnwxCreateRenderer )
+ return NULL;
+
+ // create a renderer object
+ wxRendererNative *renderer = (*pfnwxCreateRenderer)();
+ if ( !renderer )
+ return NULL;
+
+ // check that its version is compatible with ours
+ wxRendererVersion ver = renderer->GetVersion();
+ if ( !wxRendererVersion::IsCompatible(ver) )
+ {
+ wxLogError(_("Renderer \"%s\" has incompatible version %d.%d and couldn't be loaded."),
+ name.c_str(), ver.version, ver.age);
+ delete renderer;
+
+ return NULL;
+ }