#include "wx/settings.h"
#include "wx/splitter.h"
-
#include "wx/dcmirror.h"
-
+#include "wx/module.h"
#include "wx/renderer.h"
// ----------------------------------------------------------------------------
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win);
+ // Cleanup by deleting standard renderer
+ static void Cleanup();
+
+ // Get the generic object
+ static wxRendererGeneric* DoGetGeneric();
protected:
// draw the rectange using the first pen for the left and top sides and
m_penDarkGrey,
m_penLightGrey,
m_penHighlight;
+
+ static wxRendererGeneric* sm_rendererGeneric;
};
// ============================================================================
// wxRendererGeneric implementation
// ============================================================================
+// Get the generic object
+wxRendererGeneric* wxRendererGeneric::DoGetGeneric()
+{
+ if (!sm_rendererGeneric)
+ sm_rendererGeneric = new wxRendererGeneric;
+ return sm_rendererGeneric;
+}
+
// ----------------------------------------------------------------------------
// wxRendererGeneric creation
// ----------------------------------------------------------------------------
/* static */
wxRendererNative& wxRendererNative::GetGeneric()
{
- static wxRendererGeneric s_rendererGeneric;
+ return * wxRendererGeneric::DoGetGeneric();
+}
- return s_rendererGeneric;
+void wxRendererGeneric::Cleanup()
+{
+ if (sm_rendererGeneric)
+ delete sm_rendererGeneric;
+
+ sm_rendererGeneric = NULL;
}
+wxRendererGeneric* wxRendererGeneric::sm_rendererGeneric = NULL;
+
wxRendererGeneric::wxRendererGeneric()
: m_penBlack(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW)),
m_penDarkGrey(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW)),
}
}
+// A module to allow cleanup of generic renderer.
+class wxGenericRendererModule: public wxModule
+{
+DECLARE_DYNAMIC_CLASS(wxGenericRendererModule)
+public:
+ wxGenericRendererModule() {}
+ bool OnInit() { return true; };
+ void OnExit() { wxRendererGeneric::Cleanup(); };
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxGenericRendererModule, wxModule)
+