X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/65e508482777277c429b8c522e1ff8050ff5cdc7..9f4de6b2cf06f53a98b28f53640f3b9ec8cf4182:/src/common/fontmap.cpp diff --git a/src/common/fontmap.cpp b/src/common/fontmap.cpp index ab990ef8eb..c976d72af6 100644 --- a/src/common/fontmap.cpp +++ b/src/common/fontmap.cpp @@ -178,27 +178,6 @@ static const wxChar* gs_encodingNames[] = wxT( "utf-8" ), }; -// ---------------------------------------------------------------------------- -// global data -// ---------------------------------------------------------------------------- - -wxFontMapper * wxTheFontMapper = NULL; - -class wxFontMapperModule: public wxModule -{ -public: - wxFontMapperModule() : wxModule() { } - virtual bool OnInit() { wxTheFontMapper = new wxFontMapper; return TRUE; } - virtual void OnExit() - { - delete wxTheFontMapper; - wxTheFontMapper = NULL; - } - - DECLARE_DYNAMIC_CLASS(wxFontMapperModule) -}; - -IMPLEMENT_DYNAMIC_CLASS(wxFontMapperModule, wxModule) // ---------------------------------------------------------------------------- // private classes @@ -256,6 +235,34 @@ wxFontMapper::~wxFontMapper() #endif // wxUSE_CONFIG } +wxFontMapper *wxFontMapper::sm_instance = NULL; + +/*static*/ wxFontMapper *wxFontMapper::Get() +{ + if ( !sm_instance ) + sm_instance = new wxFontMapper; + return sm_instance; +} + +/*static*/ wxFontMapper *wxFontMapper::Set(wxFontMapper *mapper) +{ + wxFontMapper *old = sm_instance; + sm_instance = mapper; + return old; +} + +class wxFontMapperModule: public wxModule +{ +public: + wxFontMapperModule() : wxModule() {} + virtual bool OnInit() { return TRUE; } + virtual void OnExit() { delete wxFontMapper::Set(NULL); } + + DECLARE_DYNAMIC_CLASS(wxFontMapperModule) +}; + +IMPLEMENT_DYNAMIC_CLASS(wxFontMapperModule, wxModule) + // ---------------------------------------------------------------------------- // customisation // ----------------------------------------------------------------------------