X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f0875501313903140a41dca0ba6ee2d85ed0536c..0d29a4828eb4404ac69f29c7d82e2ea3292c6501:/src/common/dcbase.cpp diff --git a/src/common/dcbase.cpp b/src/common/dcbase.cpp index 5e11a81ee5..09b466d07a 100644 --- a/src/common/dcbase.cpp +++ b/src/common/dcbase.cpp @@ -33,30 +33,65 @@ #ifndef WX_PRECOMP #include "wx/math.h" + #include "wx/module.h" #endif #ifdef __WXMSW__ -#include "wx/msw/dcclient.h" -#include "wx/msw/dcmemory.h" -#include "wx/msw/dcscreen.h" + #include "wx/msw/dcclient.h" + #include "wx/msw/dcmemory.h" + #include "wx/msw/dcscreen.h" #endif -#ifdef __WXGTK__ -#include "wx/gtk/dcclient.h" -#include "wx/gtk/dcmemory.h" -#include "wx/gtk/dcscreen.h" +#ifdef __WXGTK20__ + #include "wx/gtk/dcclient.h" + #include "wx/gtk/dcmemory.h" + #include "wx/gtk/dcscreen.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/dcclient.h" + #include "wx/gtk1/dcmemory.h" + #include "wx/gtk1/dcscreen.h" #endif #ifdef __WXMAC__ -#include "wx/mac/dcclient.h" -#include "wx/mac/dcmemory.h" -#include "wx/mac/dcscreen.h" + #include "wx/mac/dcclient.h" + #include "wx/mac/dcmemory.h" + #include "wx/mac/dcscreen.h" +#endif + +#ifdef __WXPM__ + #include "wx/os2/dcclient.h" + #include "wx/os2/dcmemory.h" + #include "wx/os2/dcscreen.h" +#endif + +#ifdef __WXCOCOA__ + #include "wx/cocoa/dcclient.h" + #include "wx/cocoa/dcmemory.h" + #include "wx/cocoa/dcscreen.h" +#endif + +#ifdef __WXMOTIF__ + #include "wx/motif/dcclient.h" + #include "wx/motif/dcmemory.h" + #include "wx/motif/dcscreen.h" #endif #ifdef __WXX11__ -#include "wx/x11/dcclient.h" -#include "wx/x11/dcmemory.h" -#include "wx/x11/dcscreen.h" + #include "wx/x11/dcclient.h" + #include "wx/x11/dcmemory.h" + #include "wx/x11/dcscreen.h" +#endif + +#ifdef __WXDFB__ + #include "wx/dfb/dcclient.h" + #include "wx/dfb/dcmemory.h" + #include "wx/dfb/dcscreen.h" +#endif + +#ifdef __WXPALMOS__ + #include "wx/palmos/dcclient.h" + #include "wx/palmos/dcmemory.h" + #include "wx/palmos/dcscreen.h" #endif //---------------------------------------------------------------------------- @@ -65,22 +100,33 @@ wxDCFactory *wxDCFactory::m_factory = NULL; -void wxDCFactory::SetDCFactory( wxDCFactory *factory ) +void wxDCFactory::Set(wxDCFactory *factory) { - if (wxDCFactory::m_factory) - delete wxDCFactory::m_factory; + delete m_factory; - wxDCFactory::m_factory = factory; + m_factory = factory; } wxDCFactory *wxDCFactory::Get() { - if (!wxDCFactory::m_factory) - wxDCFactory::m_factory = new wxNativeDCFactory; + if ( !m_factory ) + m_factory = new wxNativeDCFactory; - return wxDCFactory::m_factory; + return m_factory; } +class wxDCFactoryCleanupModule : public wxModule +{ +public: + virtual bool OnInit() { return true; } + virtual void OnExit() { wxDCFactory::Set(NULL); } + +private: + DECLARE_DYNAMIC_CLASS(wxDCFactoryCleanupModule) +}; + +IMPLEMENT_DYNAMIC_CLASS(wxDCFactoryCleanupModule, wxModule) + //----------------------------------------------------------------------------- // wxNativeDCFactory //-----------------------------------------------------------------------------