Index: /main/waeup.sirp/trunk/src/waeup/sirp/browser/theming.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/browser/theming.py	(revision 5960)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/browser/theming.py	(revision 5960)
@@ -0,0 +1,67 @@
+##
+## theming.py
+## Login : <uli@pu.smp.net>
+## Started on  Thu Apr 21 19:50:04 2011 Uli Fouquet
+## $Id$
+## 
+## Copyright (C) 2011 Uli Fouquet
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+## 
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+## 
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+"""
+Components to support themes.
+"""
+import grok
+from zope.component import getUtilitiesFor
+from zope.interface import Interface
+from waeup.sirp.interfaces import IThemeProvider
+from waeup.sirp.browser.interfaces import ITheme
+from waeup.sirp.browser.resources import waeuptheme_red1, waeuptheme_gray1
+
+class WAeUPThemeRed1(grok.GlobalUtility):
+    grok.implements(ITheme)
+    grok.name('red waeup theme')
+
+    description = u"Uli's Red Theme"
+
+    def getResources(self):
+        return [waeuptheme_red1]
+
+class WAeUPThemeGray1(grok.GlobalUtility):
+    grok.implements(ITheme)
+    grok.name('gray waeup theme')
+
+    description = u"Henrik's Gray Theme"
+
+    def getResources(self):
+        return [waeuptheme_gray1]
+
+def get_all_themes():
+    """Return all themes registered as `ITheme` somewhere.
+
+    Returns a list of ``(<NAME>, <THEME>)`` tuples where ``<NAME>`` is
+    the internal name under which a theme was registered and
+    ``<THEME>`` is the real theme implementing `ITheme`.
+    """
+    for name, theme in getUtilitiesFor(ITheme):
+        yield name, theme
+
+class ThemesProvider(grok.GlobalUtility):
+    """A global utility providing all themes available.
+    """
+    grok.implements(IThemeProvider)
+    grok.name('default')
+
+    def __call__(self):
+        return get_all_themes()
