// headers
// ---------------------------------------------------------------------------
-#ifdef __GNUG__
- #pragma implementation "theme.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
if ( ms_theme )
{
// we already have a theme
- return TRUE;
+ return true;
}
wxString nameDefTheme;
{
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);
{
wxLogError(_("Failed to initialize GUI: no built-in themes found."));
- return FALSE;
+ return false;
}
// Set the theme as current.
wxTheme::Set(theme);
- return TRUE;
+ return true;
}
/* static */ wxTheme *wxTheme::Set(wxTheme *theme)
// has one
wxArtProvider *art = ms_theme->GetArtProvider();
if ( art )
- wxArtProvider::PushProvider(art);
+ wxArtProvider::Push(art);
}
return themeOld;
{
}
+
+// ----------------------------------------------------------------------------
+// wxDelegateTheme
+// ----------------------------------------------------------------------------
+
+wxDelegateTheme::wxDelegateTheme(const wxChar *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();
+}