aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2005-11-25 01:09:17 +0000
committerFelix Domke <tmbinc@elitedvb.net>2005-11-25 01:09:17 +0000
commit20b3eedd8825ba8a52ce4a1b991b215d0a0a6789 (patch)
tree84af8fd5dd1c9c7dc9069c21c85a8c251338ea61
parent02abc5bdd22f1143fdf76b35495fed871db58848 (diff)
downloadenigma2-20b3eedd8825ba8a52ce4a1b991b215d0a0a6789.tar.gz
enigma2-20b3eedd8825ba8a52ce4a1b991b215d0a0a6789.zip
widget: add - untested, as usual - z ordering
-rw-r--r--lib/gui/ewidget.cpp28
-rw-r--r--lib/gui/ewidget.h6
2 files changed, 33 insertions, 1 deletions
diff --git a/lib/gui/ewidget.cpp b/lib/gui/ewidget.cpp
index 8cb7d4ae..f71d7e1d 100644
--- a/lib/gui/ewidget.cpp
+++ b/lib/gui/ewidget.cpp
@@ -8,6 +8,7 @@ eWidget::eWidget(eWidget *parent): m_animation(this), m_parent(parent ? parent->
m_vis = 0;
m_desktop = 0;
m_have_background_color = 0;
+ m_z_position = 0;
m_client_offset = eSize(0, 0);
@@ -16,7 +17,7 @@ eWidget::eWidget(eWidget *parent): m_animation(this), m_parent(parent ? parent->
if (m_parent)
{
- m_parent->m_childs.push_back(this);
+ insertIntoParent();
m_parent->getStyle(m_style);
}
@@ -165,6 +166,17 @@ void eWidget::clearBackgroundColor()
m_have_background_color = 0;
}
+void eWidget::setZPosition(int z)
+{
+ m_z_position = z;
+ if (!m_parent)
+ return;
+
+ m_parent->m_childs.remove(this);
+
+ insertIntoParent(); /* now at the new Z position */
+}
+
void eWidget::mayKillFocus()
{
setFocus(0);
@@ -192,6 +204,20 @@ eWidget::~eWidget()
}
}
+void eWidget::insertIntoParent()
+{
+ ePtrList<eWidget>::iterator i = m_parent->m_childs.begin();
+
+ for(;;)
+ {
+ if ((i == m_parent->m_childs.end()) || (i->m_z_position > m_z_position))
+ {
+ m_parent->m_childs.insert(i, this);
+ return;
+ }
+ }
+}
+
void eWidget::doPaint(gPainter &painter, const gRegion &r)
{
if (m_visible_with_childs.empty())
diff --git a/lib/gui/ewidget.h b/lib/gui/ewidget.h
index 5cb139c5..879e5eaa 100644
--- a/lib/gui/ewidget.h
+++ b/lib/gui/ewidget.h
@@ -39,6 +39,8 @@ public:
void setBackgroundColor(const gRGB &col);
void clearBackgroundColor();
+ void setZPosition(int z);
+
/* untested code */
int isVisible() { return (m_vis & wVisShow) && ((!m_parent) || m_parent->isVisible()); }
/* ... */
@@ -63,6 +65,7 @@ private:
ePtr<eWindowStyle> m_style;
+ void insertIntoParent();
void doPaint(gPainter &painter, const gRegion &region);
void recalcClipRegionsWhenVisible();
@@ -70,6 +73,9 @@ private:
int m_have_background_color;
eWidget *m_current_focus, *m_focus_owner;
+
+ int m_z_position;
+
protected:
virtual ~eWidget();
void mayKillFocus();