add possibility to have multiple windowstyles. LCD can have different colors now.
authorFelix Domke <tmbinc@elitedvb.net>
Wed, 9 Aug 2006 00:24:38 +0000 (00:24 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Wed, 9 Aug 2006 00:24:38 +0000 (00:24 +0000)
data/skin.xml
lib/gui/ewidgetdesktop.cpp
lib/gui/ewidgetdesktop.h
lib/gui/ewindow.cpp
lib/gui/ewindowstyle.cpp
lib/gui/ewindowstyle.h
skin.py

index 6f727af..c096a5f 100644 (file)
@@ -13,7 +13,8 @@
                <color name="transpBlack" value="#80000000" />
        </colors>
        
-       <windowstyle type="skinned">
+               <!-- this is for the main screen -->
+       <windowstyle type="skinned" id="0">
                <title offset="20,5" font="Regular;20" />
                <color name="Background" color="#33294a6b" />
                <color name="LabelForeground" color="#ffffff" />
                </borderset>
        </windowstyle>
 
+               <!-- this is for LCD -->
+       <windowstyle type="skinned" id="1">
+               <color name="Background" color="#000000" />
+               <color name="LabelForeground" color="#ffffff" />
+               <color name="ListboxBackground" color="#000000" />
+               <color name="ListboxForeground" color="#ffffff" />
+               <color name="ListboxSelectedBackground" color="#000000" />
+               <color name="ListboxSelectedForeground" color="#ffffff" />
+               <color name="ListboxMarkedBackground" color="#000000" />
+               <color name="ListboxMarkedForeground" color="#ffffff" />
+               <color name="ListboxMarkedAndSelectedBackground" color="#000000" />
+               <color name="ListboxMarkedAndSelectedForeground" color="#ffffff" />
+               <color name="WindowTitleForeground" color="#ffffff" />
+               <color name="WindowTitleBackground" color="#000000" />
+       </windowstyle>
+
        <fonts>
                <font filename="md_khmurabi_10.ttf" name="Regular" scale="100" />
                <font filename="ae_AlMateen.ttf" name="Replacement" scale="90" replacement="1" />
index eaaa81c..4d0c0a9 100644 (file)
@@ -330,6 +330,7 @@ eWidgetDesktop::eWidgetDesktop(eSize size): m_mainloop(0), m_timer(0)
        m_screen.m_dirty_region = gRegion(eRect(ePoint(0, 0), size));
        m_screen.m_screen_size = size;
        m_require_redraw = 0;
+       m_style_id = 0;
 
        CONNECT(gRC::getInstance()->notify, eWidgetDesktop::notify);
        setCompositionMode(cmImmediate);
index f88efa8..fb4b3b8 100644 (file)
@@ -63,6 +63,9 @@ public:
        };
        
        void setCompositionMode(int mode);
+       
+       int getStyleID() { return m_style_id; }
+       void setStyleID(int id) { m_style_id = id; }
 private:
        ePtrList<eWidget> m_root;
        void calcWidgetClipRegion(eWidget *widget, gRegion &parent_visible);
@@ -83,6 +86,8 @@ private:
        void notify();
        
        void clearVisibility(eWidget *widget);
+       
+       int m_style_id;
 };
 
 #endif
index 4cb2e76..83e65ec 100644 (file)
@@ -16,7 +16,7 @@ eWindow::eWindow(eWidgetDesktop *desktop, int z): eWidget(0)
        
        ePtr<eWindowStyle> style;
        if (mgr)
-               mgr->getStyle(style);
+               mgr->getStyle(desktop->getStyleID(), style);
        
                /* when there is either no style manager or no style, revert to simple style. */
        if (!style)
index 4cfaa8d..2558669 100644 (file)
@@ -19,14 +19,14 @@ eWindowStyleManager::~eWindowStyleManager()
        m_instance = 0;
 }
 
-void eWindowStyleManager::getStyle(ePtr<eWindowStyle> &style)
+void eWindowStyleManager::getStyle(int style_id, ePtr<eWindowStyle> &style)
 {
-       style = m_current_style;
+       style = m_current_style[style_id];
 }
 
-void eWindowStyleManager::setStyle(eWindowStyle *style)
+void eWindowStyleManager::setStyle(int style_id, eWindowStyle *style)
 {
-       m_current_style = style;
+       m_current_style[style_id] = style;
 }
 
 eWindowStyleManager *eWindowStyleManager::m_instance;
index 3c9c805..4824aad 100644 (file)
@@ -51,12 +51,12 @@ public:
        eWindowStyleManager();
        ~eWindowStyleManager();
 #endif
-       void getStyle(ePtr<eWindowStyle> &style);
-       void setStyle(eWindowStyle *style);
+       void getStyle(int style_id, ePtr<eWindowStyle> &style);
+       void setStyle(int style_id, eWindowStyle *style);
        static int getInstance(ePtr<eWindowStyleManager> &mgr) { mgr = m_instance; if (!mgr) return -1; return 0; }
 private:
        static eWindowStyleManager *m_instance;
-       ePtr<eWindowStyle> m_current_style;
+       std::map<int, ePtr<eWindowStyle> > m_current_style;
 };
 
 TEMPLATE_TYPEDEF(ePtr<eWindowStyleManager>, eWindowStyleManagerPtr);
diff --git a/skin.py b/skin.py
index ecd4355..c95d049 100644 (file)
--- a/skin.py
+++ b/skin.py
@@ -228,6 +228,7 @@ def loadSingleSkinData(desktop, dom_skin, path_prefix):
        
        for windowstyle in elementsWithTag(skin.childNodes, "windowstyle"):
                style = eWindowStyleSkinned()
+               id = int(windowstyle.getAttribute("id") or "0")
                
                # defaults
                font = gFont("Regular", 20)
@@ -263,7 +264,7 @@ def loadSingleSkinData(desktop, dom_skin, path_prefix):
                        
                x = eWindowStyleManagerPtr()
                eWindowStyleManager.getInstance(x)
-               x.setStyle(style)
+               x.setStyle(id, style)
 
 def loadSkinData(desktop):
        skins = dom_skins[:]