add window titles
authorFelix Domke <tmbinc@elitedvb.net>
Tue, 15 Nov 2005 04:20:11 +0000 (04:20 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Tue, 15 Nov 2005 04:20:11 +0000 (04:20 +0000)
lib/gui/ewindowstyleskinned.cpp
lib/gui/ewindowstyleskinned.h
skin.py

index 55092e1daf5b413eee97cd8ce0af60feb928c884..20d508f6ed5e5a65fb5fd2ed0cc9891b2b21a3a4 100644 (file)
@@ -35,6 +35,14 @@ 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)
@@ -248,3 +256,13 @@ void eWindowStyleSkinned::setColor(int what, const gRGB &col)
                m_color[what] = col;
 }
 
+void eWindowStyleSkinned::setTitleOffset(const eSize &offset)
+{
+       m_title_offset = offset;
+}
+
+void eWindowStyleSkinned::setTitleFont(gFont *fnt)
+{
+       m_fnt = fnt;
+}
+
index bc9c0549619d33d6737c8867f009feaf95d5cc9d..17988f65192632514fba666b00d6d801d56534c1 100644 (file)
@@ -61,11 +61,17 @@ public:
                colListboxSelectedForeground,
                colListboxMarkedBackground,
                colListboxMarkedForeground,
+               
+               colWindowTitleForeground,
+               colWindowTitleBackground,
                colMax
        };
        
        void setColor(int what, const gRGB &back);
        
+       void setTitleOffset(const eSize &offset);
+       void setTitleFont(gFont *fnt);
+       
 private:
        struct borderSet
        {
@@ -77,6 +83,9 @@ private:
        
        gRGB m_color[colMax];
        
+       eSize m_title_offset;
+       ePtr<gFont> m_fnt;
+       
        void drawBorder(gPainter &painter, const eRect &size, struct borderSet &border, int where);
 };
 
diff --git a/skin.py b/skin.py
index 5744855ce35d431077448c4378f77248892b465e..f31d637bb8a15ff43b31ccb54c2669f893f502bf 100644 (file)
--- a/skin.py
+++ b/skin.py
@@ -154,6 +154,9 @@ def loadSkin(desktop):
        for windowstyle in elementsWithTag(skin.childNodes, "windowstyle"):
                style = eWindowStyleSkinned()
                
+               style.setTitleFont(gFont("Arial", 13));
+               style.setTitleOffset(eSize(3, 3));
+               
                for borderset in elementsWithTag(windowstyle.childNodes, "borderset"):
                        bsName = str(borderset.getAttribute("name"))
                        for pixmap in elementsWithTag(borderset.childNodes, "pixmap"):