gui: experimental Z order for root widgets
[enigma2.git] / lib / gui / ewindow.cpp
index e637cf22078753588c0f6131301d8d11949af7e5..f8984729913c3cfc52365ac334e24240a74390bf 100644 (file)
@@ -6,7 +6,7 @@
 
 #include <lib/gdi/epng.h>
 
 
 #include <lib/gdi/epng.h>
 
-eWindow::eWindow(eWidgetDesktop *desktop): eWidget(0)
+eWindow::eWindow(eWidgetDesktop *desktop, int z): eWidget(0)
 {
        m_flags = 0;
                /* ask style manager for current style */
 {
        m_flags = 0;
                /* ask style manager for current style */
@@ -22,17 +22,20 @@ eWindow::eWindow(eWidgetDesktop *desktop): eWidget(0)
                style = new eWindowStyleSimple();
        
        setStyle(style);
                style = new eWindowStyleSimple();
        
        setStyle(style);
+       
+       setZPosition(z); /* must be done before addRootWidget */
 
                /* we are the parent for the child window. */
                /* as we are in the constructor, this is thread safe. */
        m_child = this;
        m_child = new eWidget(this);
 
                /* we are the parent for the child window. */
                /* as we are in the constructor, this is thread safe. */
        m_child = this;
        m_child = new eWidget(this);
-       desktop->addRootWidget(this, 0);
+       desktop->addRootWidget(this);
 }
 
 eWindow::~eWindow()
 {
        getDesktop()->removeRootWidget(this);
 }
 
 eWindow::~eWindow()
 {
        getDesktop()->removeRootWidget(this);
+       m_child->destruct();
 }
 
 void eWindow::setTitle(const std::string &string)
 }
 
 void eWindow::setTitle(const std::string &string)
@@ -43,6 +46,11 @@ void eWindow::setTitle(const std::string &string)
        event(evtTitleChanged);
 }
 
        event(evtTitleChanged);
 }
 
+std::string eWindow::getTitle() const
+{
+       return m_title;
+}
+
 void eWindow::setFlag(int flags)
 {
        m_flags |= flags;
 void eWindow::setFlag(int flags)
 {
        m_flags |= flags;
@@ -86,6 +94,12 @@ int eWindow::event(int event, void *data, void *data2)
                }
                return 0;
        }
                }
                return 0;
        }
+       case evtTitleChanged:
+                       /* m_visible_region contains, in contrast to m_visible_with_childs,
+                          only the decoration. though repainting the whole decoration is bad,
+                          repainting the whole window is even worse. */
+               invalidate(m_visible_region);
+               break;
        default:
                break;
        }
        default:
                break;
        }