OMG the chat is finally scrolling!

* implement UIScrollArea
* rework console to allow scrolling
* many core ui changes in the way.. so maybe we will have new bugs
* fix in UIScrollBar
This commit is contained in:
Eduardo Bart
2012-03-25 14:10:19 -03:00
parent 179e53bb77
commit ccf55132a1
18 changed files with 200 additions and 72 deletions

View File

@@ -57,7 +57,13 @@ void UIWidget::draw(const Rect& visibleRect)
g_graphics.beginClipping(visibleRect);
drawSelf();
drawChildren(visibleRect);
if(m_children.size() > 0) {
if(m_clipping)
g_graphics.beginClipping(visibleRect.intersection(getClippingRect()));
drawChildren(visibleRect);
}
if(m_clipping)
g_graphics.endClipping();
@@ -890,13 +896,29 @@ int UIWidget::getChildIndex(const UIWidgetPtr& child)
return -1;
}
Rect UIWidget::getChildrenRect()
Rect UIWidget::getClippingRect()
{
Rect rect = m_rect;
rect.expand(-m_padding.top, -m_padding.right, -m_padding.bottom, -m_padding.left);
return rect;
}
Rect UIWidget::getChildrenRect()
{
Rect childrenRect;
for(const UIWidgetPtr& child : m_children) {
if(!child->isExplicitlyVisible() || !child->getRect().isValid() || child->getOpacity() == 0.0f)
continue;
if(!childrenRect.isValid())
childrenRect = child->getRect();
else
childrenRect = childrenRect.united(child->getRect());
}
if(!childrenRect.isValid())
childrenRect = getClippingRect();
return childrenRect;
}
UIAnchorLayoutPtr UIWidget::getAnchoredLayout()
{
UIWidgetPtr parent = getParent();
@@ -1231,6 +1253,13 @@ void UIWidget::onGeometryChange(const Rect& oldRect, const Rect& newRect)
callLuaField("onGeometryChange", oldRect, newRect);
}
void UIWidget::onLayoutUpdate()
{
callLuaField("onLayoutUpdate");
if(UIWidgetPtr parent = getParent())
parent->onLayoutUpdate();
}
void UIWidget::onFocusChange(bool focused, Fw::FocusReason reason)
{
callLuaField("onFocusChange", focused, reason);