fix linked tuners (i hope)
[enigma2.git] / lib / gui / ewindowstyleskinned.cpp
index a3152e5f5f466ba6375213e81eb9980e343d01e1..20d508f6ed5e5a65fb5fd2ed0cc9891b2b21a3a4 100644 (file)
@@ -8,7 +8,9 @@ DEFINE_REF(eWindowStyleSkinned);
 
 eWindowStyleSkinned::eWindowStyleSkinned()
 {
-       m_background_color = gRGB(0x808080);
+       // m_background_color = gRGB(0x808080);
+       
+       // TODO: initialize colors!!
 }
 
 void eWindowStyleSkinned::handleNewSize(eWindow *wnd, eSize &size, eSize &offset)
@@ -33,11 +35,19 @@ void eWindowStyleSkinned::handleNewSize(eWindow *wnd, eSize &size, eSize &offset
 void eWindowStyleSkinned::paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title)
 {
        drawBorder(painter, eRect(ePoint(0, 0), wnd->size()), m_border[bsWindow], bpAll);
+       
+       if (m_fnt)
+       {
+               painter.setBackgroundColor(m_color[colWindowTitleBackground]);
+               painter.setForegroundColor(m_color[colWindowTitleForeground]);
+               painter.setFont(m_fnt);
+               painter.renderText(eRect(m_title_offset.width(), m_title_offset.height(), wnd->size().width() - m_title_offset.width(), m_border[bsWindow].m_border_top - m_title_offset.height()), title);
+       }
 }
 
 void eWindowStyleSkinned::paintBackground(gPainter &painter, const ePoint &offset, const eSize &size)
 {
-       painter.setBackgroundColor(m_background_color);
+       painter.setBackgroundColor(m_color[colBackground]);
        painter.clear();
 }
 
@@ -46,19 +56,19 @@ void eWindowStyleSkinned::setStyle(gPainter &painter, int what)
        switch (what)
        {
        case styleLabel:
-               painter.setForegroundColor(gColor(0x1F));
+               painter.setForegroundColor(m_color[colLabelForeground]);
                break;
        case styleListboxSelected:
-               painter.setForegroundColor(gColor(0x1F));
-               painter.setBackgroundColor(gColor(0x1A));
+               painter.setForegroundColor(m_color[colListboxSelectedForeground]);
+               painter.setBackgroundColor(m_color[colListboxSelectedBackground]);
                break;
        case styleListboxNormal:
-               painter.setForegroundColor(gColor(0x1C));
-               painter.setBackgroundColor(m_background_color);
+               painter.setForegroundColor(m_color[colListboxForeground]);
+               painter.setBackgroundColor(m_color[colListboxBackground]);
                break;
        case styleListboxMarked:
-               painter.setForegroundColor(gColor(0x2F));
-               painter.setBackgroundColor(gColor(0x2A));
+               painter.setForegroundColor(m_color[colListboxMarkedForeground]);
+               painter.setBackgroundColor(m_color[colListboxMarkedBackground]);
                break;
        }
 }
@@ -240,9 +250,19 @@ void eWindowStyleSkinned::setPixmap(int bs, int bp, gPixmap &pixmap)
                m_border[bs].m_border_right, m_border[bs].m_border_bottom); 
 }
 
-void eWindowStyleSkinned::setDefaultBackgroundColor(const gRGB &back)
+void eWindowStyleSkinned::setColor(int what, const gRGB &col)
+{
+       if ((what < colMax) && (what >= 0))
+               m_color[what] = col;
+}
+
+void eWindowStyleSkinned::setTitleOffset(const eSize &offset)
+{
+       m_title_offset = offset;
+}
+
+void eWindowStyleSkinned::setTitleFont(gFont *fnt)
 {
-       m_background_color = back;
-       eDebug("set default background color!");
+       m_fnt = fnt;
 }