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 6f727af585fbe9a860c7c9974cadb6970b124aa4..c096a5fe0efff0e36b218cfeb621a7a53fc252a8 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 eaaa81c88ea0f058ee7993f971380378c8de0796..4d0c0a9b73437cd04ee798b1892d8fa5906f018a 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 f88efa8823552cec5deb2baaa1870e28c1b8a706..fb4b3b82b2c3a7ab7e1f207b0e52bc19f80d007f 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 4cb2e76f1c1b73bdec223a77d3016423f7c1ad80..83e65ec3d21a0e05aad092c92cb1e45f3924ae6b 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 4cfaa8d4c6637bd72fbc11803dafba202ed49bb8..2558669ae363ae98ff33aec5711b809501d5bde1 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 3c9c805b92ef713ef4a4dabdbaca3f0b46d7b47b..4824aad62c44a2f8bcdd9ffa5d619ac428e785cd 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 ecd4355e28eb04fb6446da48465282b6e14cc861..c95d049dd4974ed4f466e506de65b39707c9b965 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[:]