allow using a pixmap as background for slider
[enigma2.git] / lib / gui / ewidget.cpp
index 6f7fa91b30c40b3a895d6a94c0ae7634383c5158..7c50f4af47344d2f0153c36d3de0062a0f19e12d 100644 (file)
@@ -100,16 +100,25 @@ void eWidget::show()
 {
        if (m_vis & wVisShow)
                return;
-       
-       m_vis |=  wVisShow;
 
+       m_vis |= wVisShow;
+       
                /* TODO: optimize here to only recalc what's required. possibly merge with hide. */
        eWidget *root = this;
        ePoint abspos = position();
        while (root && !root->m_desktop)
        {
                root = root->m_parent;
-               assert(root);
+               if (!root)
+               {
+                               /* oops: our root widget does not have a desktop associated. 
+                                       probably somebody already erased the root, but tries some
+                                       operations on a child window. 
+                                       
+                                       ignore them for now. */
+                       /* assert(root); */
+                       return;
+               }
                abspos += root->position();
        }
 
@@ -140,6 +149,8 @@ void eWidget::hide()
        while (root && !root->m_desktop)
        {
                root = root->m_parent;
+               if (!root)
+                       return;
                abspos += root->position();
        }
        assert(root->m_desktop);
@@ -188,6 +199,21 @@ void eWidget::setTransparent(int transp)
                m_vis &=~wVisTransparent;
 }
 
+ePoint eWidget::getAbsolutePosition()
+{
+       eWidget *root = this;
+       ePoint abspos = position();
+
+       while (root && !root->m_desktop)
+       {
+               root = root->m_parent;
+               assert(root);
+               abspos += root->position();
+       }
+
+       return abspos;
+}
+
 void eWidget::mayKillFocus()
 {
        setFocus(0);