added wxFontMapper::Get/Set

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14969 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2002-04-06 15:04:27 +00:00
parent 5a224901b8
commit 142b3bc26a
25 changed files with 104 additions and 63 deletions

View File

@@ -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
// ----------------------------------------------------------------------------