]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/theme.cpp
Revert "Make wxMSW stack walking methods work with Unicode identifiers."
[wxWidgets.git] / src / univ / theme.cpp
index 2eb31fb1d4af442b68a6e801eec3ef04408a05af..c47cc8010b70424764065e3a339401e2a87b8284 100644 (file)
@@ -1,10 +1,9 @@
 ///////////////////////////////////////////////////////////////////////////////
-// Name:        univ/theme.cpp
+// Name:        src/univ/theme.cpp
 // Purpose:     implementation of wxTheme
 // Author:      Vadim Zeitlin
 // Modified by:
 // Created:     06.08.00
-// RCS-ID:      $Id$
 // Copyright:   (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 // implementation
 // ============================================================================
 
-wxThemeInfo *wxTheme::ms_allThemes = (wxThemeInfo *)NULL;
-wxTheme *wxTheme::ms_theme = (wxTheme *)NULL;
+wxThemeInfo *wxTheme::ms_allThemes = NULL;
+wxTheme *wxTheme::ms_theme = NULL;
 
 // ----------------------------------------------------------------------------
 // "dynamic" theme creation
 // ----------------------------------------------------------------------------
 
 wxThemeInfo::wxThemeInfo(Constructor c,
-                         const wxChar *n,
-                         const wxChar *d)
+                         const wxString& n,
+                         const wxString& d)
            : name(n), desc(d), ctor(c)
 {
     // insert us (in the head of) the linked list
@@ -70,7 +69,7 @@ wxThemeInfo::wxThemeInfo(Constructor c,
         info = info->next;
     }
 
-    return (wxTheme *)NULL;
+    return NULL;
 }
 
 // ----------------------------------------------------------------------------
@@ -88,21 +87,17 @@ wxThemeInfo::wxThemeInfo(Constructor c,
     wxString nameDefTheme;
 
     // use the environment variable first
-    const wxChar *p = wxGetenv(_T("WXTHEME"));
+    const wxChar *p = wxGetenv(wxT("WXTHEME"));
     if ( p )
     {
         nameDefTheme = p;
     }
+#ifdef wxUNIV_DEFAULT_THEME
     else // use native theme by default
     {
-        #if defined(__WXGTK__)
-            nameDefTheme = _T("gtk");
-        #elif defined(__WXX11__)
-            nameDefTheme = _T("win32");
-        #else
-            nameDefTheme = _T("win32");
-        #endif
+        nameDefTheme = wxSTRINGIZE_T(wxUNIV_DEFAULT_THEME);
     }
+#endif // wxUNIV_DEFAULT_THEME
 
     wxTheme *theme = Create(nameDefTheme);
 
@@ -151,3 +146,58 @@ wxTheme::~wxTheme()
 {
 }
 
+
+// ----------------------------------------------------------------------------
+// wxDelegateTheme
+// ----------------------------------------------------------------------------
+
+wxDelegateTheme::wxDelegateTheme(const wxString& theme)
+{
+    m_themeName = theme;
+    m_theme = NULL;
+}
+
+wxDelegateTheme::~wxDelegateTheme()
+{
+    delete m_theme;
+}
+
+bool wxDelegateTheme::GetOrCreateTheme()
+{
+    if ( !m_theme )
+        m_theme = wxTheme::Create(m_themeName);
+    return m_theme != NULL;
+}
+
+wxRenderer *wxDelegateTheme::GetRenderer()
+{
+    if ( !GetOrCreateTheme() )
+        return NULL;
+
+    return m_theme->GetRenderer();
+}
+
+wxArtProvider *wxDelegateTheme::GetArtProvider()
+{
+    if ( !GetOrCreateTheme() )
+        return NULL;
+
+    return m_theme->GetArtProvider();
+}
+
+wxInputHandler *wxDelegateTheme::GetInputHandler(const wxString& control,
+                                                 wxInputConsumer *consumer)
+{
+    if ( !GetOrCreateTheme() )
+        return NULL;
+
+    return m_theme->GetInputHandler(control, consumer);
+}
+
+wxColourScheme *wxDelegateTheme::GetColourScheme()
+{
+    if ( !GetOrCreateTheme() )
+        return NULL;
+
+    return m_theme->GetColourScheme();
+}