git.cweiske.de
/
enigma2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
pmt.h: add missing const modifier to capid_pair
[enigma2.git]
/
lib
/
gui
/
ewidget.cpp
diff --git
a/lib/gui/ewidget.cpp
b/lib/gui/ewidget.cpp
index 6d02ebaf9c143b31624f795fdea4e38bf5c33eaa..19009fb9f969a299a600678a4b1c446173dc847e 100644
(file)
--- a/
lib/gui/ewidget.cpp
+++ b/
lib/gui/ewidget.cpp
@@
-6,6
+6,7
@@
extern void dumpRegion(const gRegion ®ion);
eWidget::eWidget(eWidget *parent): m_animation(this), m_parent(parent ? parent->child() : 0)
{
m_vis = 0;
eWidget::eWidget(eWidget *parent): m_animation(this), m_parent(parent ? parent->child() : 0)
{
m_vis = 0;
+ m_layer = 0;
m_desktop = 0;
m_have_background_color = 0;
m_z_position = 0;
m_desktop = 0;
m_have_background_color = 0;
m_z_position = 0;
@@
-53,6
+54,7
@@
void eWidget::resize(eSize size)
only once. */
eSize old_size = m_size;
eSize old_offset = m_client_offset;
only once. */
eSize old_size = m_size;
eSize old_offset = m_client_offset;
+ m_client_size = size;
m_client_offset = eSize(0, 0);
event(evtWillChangeSize, &size, &m_client_offset);
if (old_size == m_size)
m_client_offset = eSize(0, 0);
event(evtWillChangeSize, &size, &m_client_offset);
if (old_size == m_size)
@@
-82,16
+84,20
@@
void eWidget::invalidate(const gRegion ®ion)
return;
eWidget *root = this;
ePoint abspos = position();
return;
eWidget *root = this;
ePoint abspos = position();
+ int target_layer = m_layer;
+
while (root && !root->m_desktop)
{
root = root->m_parent;
while (root && !root->m_desktop)
{
root = root->m_parent;
- assert(root);
+ ASSERT(root);
+ if (root->m_layer != -1)
+ target_layer = root->m_layer;
abspos += root->position();
}
res.moveBy(abspos);
// eDebug("region to invalidate:");
// dumpRegion(res);
abspos += root->position();
}
res.moveBy(abspos);
// eDebug("region to invalidate:");
// dumpRegion(res);
- root->m_desktop->invalidate(res);
+ root->m_desktop->invalidate(res
, this, target_layer
);
}
void eWidget::show()
}
void eWidget::show()
@@
-100,9
+106,14
@@
void eWidget::show()
return;
m_vis |= wVisShow;
return;
m_vis |= wVisShow;
+// eDebug("show widget %p", this);
+ notifyShowHide();
+
/* TODO: optimize here to only recalc what's required. possibly merge with hide. */
eWidget *root = this;
ePoint abspos = position();
/* TODO: optimize here to only recalc what's required. possibly merge with hide. */
eWidget *root = this;
ePoint abspos = position();
+ int target_layer = m_layer;
+
while (root && !root->m_desktop)
{
root = root->m_parent;
while (root && !root->m_desktop)
{
root = root->m_parent;
@@
-112,9
+123,11
@@
void eWidget::show()
probably somebody already erased the root, but tries some
operations on a child window.
ignore them for now. */
probably somebody already erased the root, but tries some
operations on a child window.
ignore them for now. */
- /*
assert
(root); */
+ /*
ASSERT
(root); */
return;
}
return;
}
+ if (root->m_layer != -1)
+ target_layer = root->m_layer;
abspos += root->position();
}
abspos += root->position();
}
@@
-122,7
+135,7
@@
void eWidget::show()
gRegion abs = m_visible_with_childs;
abs.moveBy(abspos);
gRegion abs = m_visible_with_childs;
abs.moveBy(abspos);
- root->m_desktop->invalidate(abs);
+ root->m_desktop->invalidate(abs
, this, target_layer
);
}
void eWidget::hide()
}
void eWidget::hide()
@@
-133,10
+146,12
@@
void eWidget::hide()
if (!(m_vis & wVisShow))
return;
m_vis &= ~wVisShow;
if (!(m_vis & wVisShow))
return;
m_vis &= ~wVisShow;
+
/* this is a workaround to the above problem. when we are in the delete phase,
don't hide childs. */
if (!(m_parent || m_desktop))
return;
/* this is a workaround to the above problem. when we are in the delete phase,
don't hide childs. */
if (!(m_parent || m_desktop))
return;
+ notifyShowHide();
/* TODO: optimize here to only recalc what's required. possibly merge with show. */
eWidget *root = this;
/* TODO: optimize here to only recalc what's required. possibly merge with show. */
eWidget *root = this;
@@
-148,7
+163,7
@@
void eWidget::hide()
return;
abspos += root->position();
}
return;
abspos += root->position();
}
-
assert
(root->m_desktop);
+
ASSERT
(root->m_desktop);
gRegion abs = m_visible_with_childs;
abs.moveBy(abspos);
gRegion abs = m_visible_with_childs;
abs.moveBy(abspos);
@@
-204,7
+219,7
@@
ePoint eWidget::getAbsolutePosition()
while (root && !root->m_desktop)
{
root = root->m_parent;
while (root && !root->m_desktop)
{
root = root->m_parent;
-
assert
(root);
+
ASSERT
(root);
abspos += root->position();
}
abspos += root->position();
}
@@
-250,7
+265,7
@@
void eWidget::insertIntoParent()
}
}
}
}
-void eWidget::doPaint(gPainter &painter, const gRegion &r)
+void eWidget::doPaint(gPainter &painter, const gRegion &r
, int layer
)
{
if (m_visible_with_childs.empty())
return;
{
if (m_visible_with_childs.empty())
return;
@@
-259,17
+274,20
@@
void eWidget::doPaint(gPainter &painter, const gRegion &r)
region.moveBy(-position());
painter.moveOffset(position());
/* check if there's anything for us to paint */
region.moveBy(-position());
painter.moveOffset(position());
/* check if there's anything for us to paint */
- region &= m_visible_region;
- if (!region.empty())
+ if (layer == m_layer)
{
{
- painter.resetClip(region);
- event(evtPaint, ®ion, &painter);
+ region &= m_visible_region;
+ if (!region.empty())
+ {
+ painter.resetClip(region);
+ event(evtPaint, ®ion, &painter);
+ }
}
childs.moveBy(-position());
/* walk all childs */
for (ePtrList<eWidget>::iterator i(m_childs.begin()); i != m_childs.end(); ++i)
}
childs.moveBy(-position());
/* walk all childs */
for (ePtrList<eWidget>::iterator i(m_childs.begin()); i != m_childs.end(); ++i)
- i->doPaint(painter, childs);
+ i->doPaint(painter, childs
, layer
);
painter.moveOffset(-position());
}
painter.moveOffset(-position());
}
@@
-286,7
+304,7
@@
void eWidget::recalcClipRegionsWhenVisible()
break;
}
t = t->m_parent;
break;
}
t = t->m_parent;
-
assert
(t);
+
ASSERT
(t);
} while(1);
}
} while(1);
}
@@
-319,7
+337,7
@@
int eWidget::event(int event, void *data, void *data2)
} else
{
eWidget *w = this;
} else
{
eWidget *w = this;
-
while (w && !w->m_have_background_color)
+ while (w && !w->m_have_background_color)
w = w->m_parent;
if (w)
w = w->m_parent;
if (w)
@@
-361,3
+379,9
@@
void eWidget::setFocus(eWidget *focus)
m_current_focus->event(evtFocusGot, this);
}
m_current_focus->event(evtFocusGot, this);
}
+void eWidget::notifyShowHide()
+{
+ event(evtParentVisibilityChanged);
+ for (ePtrList<eWidget>::iterator i(m_childs.begin()); i != m_childs.end(); ++i)
+ i->notifyShowHide();
+}