From 240889a18cb17f20884c6ce36e52a6dcf589bb08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 4 Nov 2001 23:32:16 +0000 Subject: [PATCH] implemented late(r) initialization of wxUniv themes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12319 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/univ/themes/gtk.cpp | 27 +++++++++++++++++++++++---- src/univ/themes/win32.cpp | 20 +++++++++++++++++--- 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/src/univ/themes/gtk.cpp b/src/univ/themes/gtk.cpp index ce8692df8d..99d48189d6 100644 --- a/src/univ/themes/gtk.cpp +++ b/src/univ/themes/gtk.cpp @@ -549,9 +549,9 @@ public: wxGTKTheme(); virtual ~wxGTKTheme(); - virtual wxRenderer *GetRenderer() { return m_renderer; } + virtual wxRenderer *GetRenderer(); virtual wxInputHandler *GetInputHandler(const wxString& control); - virtual wxColourScheme *GetColourScheme() { return m_scheme; } + virtual wxColourScheme *GetColourScheme(); private: // get the default input handler @@ -583,8 +583,8 @@ WX_IMPLEMENT_THEME(wxGTKTheme, gtk, wxTRANSLATE("GTK+ theme")); wxGTKTheme::wxGTKTheme() { - m_scheme = new wxGTKColourScheme; - m_renderer = new wxGTKRenderer(m_scheme); + m_scheme = NULL; + m_renderer = NULL; m_handlerDefault = NULL; } @@ -602,6 +602,25 @@ wxGTKTheme::~wxGTKTheme() delete m_scheme; } +wxRenderer *wxGTKTheme::GetRenderer() +{ + if ( !m_renderer ) + { + m_renderer = new wxGTKRenderer(GetColourScheme()); + } + + return m_renderer; +} + +wxColourScheme *wxGTKTheme::GetColourScheme() +{ + if ( !m_scheme ) + { + m_scheme = new wxGTKColourScheme; + } + return m_scheme; +} + wxInputHandler *wxGTKTheme::GetDefaultInputHandler() { if ( !m_handlerDefault ) diff --git a/src/univ/themes/win32.cpp b/src/univ/themes/win32.cpp index 540676b5ea..d2850f2519 100644 --- a/src/univ/themes/win32.cpp +++ b/src/univ/themes/win32.cpp @@ -600,7 +600,7 @@ public: wxWin32Theme(); virtual ~wxWin32Theme(); - virtual wxRenderer *GetRenderer() { return m_renderer; } + virtual wxRenderer *GetRenderer(); virtual wxInputHandler *GetInputHandler(const wxString& control); virtual wxColourScheme *GetColourScheme(); @@ -1111,8 +1111,8 @@ WX_IMPLEMENT_THEME(wxWin32Theme, win32, wxTRANSLATE("Win32 theme")); wxWin32Theme::wxWin32Theme() { - m_scheme = new wxWin32ColourScheme; - m_renderer = new wxWin32Renderer(m_scheme); + m_scheme = NULL; + m_renderer = NULL; m_handlerDefault = NULL; } @@ -1131,6 +1131,16 @@ wxWin32Theme::~wxWin32Theme() delete m_scheme; } +wxRenderer *wxWin32Theme::GetRenderer() +{ + if ( !m_renderer ) + { + m_renderer = new wxWin32Renderer(GetColourScheme()); + } + + return m_renderer; +} + wxInputHandler *wxWin32Theme::GetDefaultInputHandler() { if ( !m_handlerDefault ) @@ -1209,6 +1219,10 @@ wxInputHandler *wxWin32Theme::GetInputHandler(const wxString& control) wxColourScheme *wxWin32Theme::GetColourScheme() { + if ( !m_scheme ) + { + m_scheme = new wxWin32ColourScheme; + } return m_scheme; }