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;
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)
return;
eWidget *root = this;
ePoint abspos = position();
+ int target_layer = m_layer;
+
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);
- root->m_desktop->invalidate(res);
+ root->m_desktop->invalidate(res, this, target_layer);
}
void eWidget::show()
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();
+ int target_layer = m_layer;
+
while (root && !root->m_desktop)
{
root = root->m_parent;
probably somebody already erased the root, but tries some
operations on a child window.
ignore them for now. */
- /* assert(root); */
+ /* ASSERT(root); */
return;
}
+ if (root->m_layer != -1)
+ target_layer = root->m_layer;
abspos += root->position();
}
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()
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;
+ notifyShowHide();
/* TODO: optimize here to only recalc what's required. possibly merge with show. */
eWidget *root = this;
return;
abspos += root->position();
}
- assert(root->m_desktop);
+ ASSERT(root->m_desktop);
gRegion abs = m_visible_with_childs;
abs.moveBy(abspos);
while (root && !root->m_desktop)
{
root = root->m_parent;
- assert(root);
+ ASSERT(root);
abspos += root->position();
}
}
}
-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;
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)
- i->doPaint(painter, childs);
+ i->doPaint(painter, childs, layer);
painter.moveOffset(-position());
}
break;
}
t = t->m_parent;
- assert(t);
+ ASSERT(t);
} while(1);
}
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();
+}