elistboxcontent.cpp: paint background for selected entry also when transparent="1...
[enigma2.git] / lib / gui / ewindowstyle.cpp
index a2e0efb2651b9d67a1b8369fcf3117004e183825..68a74e0c836bf551d5380e9a49a9262bc6436610 100644 (file)
@@ -2,10 +2,42 @@
 #include <lib/gdi/esize.h>
 #include <lib/gui/ewindow.h>
 #include <lib/gui/ewindowstyle.h>
-
+#include <lib/base/init.h>
+#include <lib/base/init_num.h>
 
 eWindowStyle::~eWindowStyle() {}
 
+DEFINE_REF(eWindowStyleManager);
+
+ePtr<eWindowStyleManager> NewWindowStylePtr(void)
+{
+       ePtr<eWindowStyleManager> ptr;
+       eWindowStyleManager::getInstance(ptr);
+       return ptr;
+}
+
+eWindowStyleManager::eWindowStyleManager()
+{
+       m_instance = this;
+}
+
+eWindowStyleManager::~eWindowStyleManager()
+{
+       m_instance = 0;
+}
+
+void eWindowStyleManager::getStyle(int style_id, ePtr<eWindowStyle> &style)
+{
+       style = m_current_style[style_id];
+}
+
+void eWindowStyleManager::setStyle(int style_id, eWindowStyle *style)
+{
+       m_current_style[style_id] = style;
+}
+
+eWindowStyleManager *eWindowStyleManager::m_instance;
+
 DEFINE_REF(eWindowStyleSimple);
 
 eWindowStyleSimple::eWindowStyleSimple()
@@ -13,7 +45,7 @@ eWindowStyleSimple::eWindowStyleSimple()
        m_border_left = m_border_right = m_border_bottom = 2;
        m_border_top = 30;
 
-       m_fnt = new gFont("Arial", 25);
+       m_fnt = new gFont("Regular", 25);
        
        m_border_color_tl = gColor(0x1f);
        m_border_color_br = gColor(0x14);
@@ -22,7 +54,7 @@ eWindowStyleSimple::eWindowStyleSimple()
        m_background_color = gColor(0x19);
 }
 
-void eWindowStyleSimple::handleNewSize(eWindow *wnd, const eSize &size)
+void eWindowStyleSimple::handleNewSize(eWindow *wnd, eSize &size, eSize &offset)
 {
 //     eDebug("handle new size: %d x %d", size.width(), size.height());
        
@@ -84,6 +116,10 @@ void eWindowStyleSimple::setStyle(gPainter &painter, int what)
                painter.setForegroundColor(gColor(0x2F));
                painter.setBackgroundColor(gColor(0x2A));
                break;
+       case styleListboxMarkedAndSelected:
+               painter.setForegroundColor(gColor(0x3F));
+               painter.setBackgroundColor(gColor(0x3A));
+               break;
        }
 }
 
@@ -116,13 +152,13 @@ RESULT eWindowStyleSimple::getFont(int what, ePtr<gFont> &fnt)
        switch (what)
        {
        case fontStatic:
-               fnt = new gFont("Arial", 12);
+               fnt = new gFont("Regular", 12);
                break;
        case fontButton:
-               fnt = new gFont("Arial", 20);
+               fnt = new gFont("Regular", 20);
                break;
        case fontTitlebar:
-               fnt = new gFont("Arial", 25);
+               fnt = new gFont("Regular", 25);
                break;
        default:
                return -1;
@@ -130,35 +166,4 @@ RESULT eWindowStyleSimple::getFont(int what, ePtr<gFont> &fnt)
        return 0;
 }
 
-#if 0
-DEFINE_REF(eWindowStyleSkinned);
-
-eWindowStyleSkinned::eWindowStyleSkinned()
-{
-}
-
-void eWindowStyleSkinned::handleNewSize(eWindow *wnd, const eSize &size)
-{
-}
-
-void eWindowStyleSkinned::paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title)
-{
-}
-
-void eWindowStyleSkinned::paintBackground(gPainter &painter, const ePoint &offset, const eSize &size)
-{
-}
-
-void eWindowStyleSkinned::setStyle(gPainter &painter, int what)
-{
-}
-
-void eWindowStyleSkinned::drawFrame(gPainter &painter, const eRect &frame, int what)
-{
-}
-
-void eWindowStyleSkinned::drawBorder(gPainter &painter, const eSize &size, const struct borderSet &border, int where)
-{
-}
-
-#endif
+eAutoInitPtr<eWindowStyleManager> init_eWindowStyleManager(eAutoInitNumbers::skin, "eWindowStyleManager");