ui changes

* create UIResizeBorder
* restore miniwindow
* scroll fixes
This commit is contained in:
Eduardo Bart
2012-03-26 19:24:01 -03:00
parent ee869bb279
commit 060c1cf8e7
16 changed files with 325 additions and 107 deletions

View File

@@ -155,6 +155,23 @@ void UIAnchorLayout::updateWidget(const UIWidgetPtr& widget, UIAnchorGroup& anch
break;
}
if(hookedWidget == parentWidget) {
switch(anchor.getHookedEdge()) {
case Fw::AnchorLeft:
case Fw::AnchorRight:
case Fw::AnchorHorizontalCenter:
point -= parentWidget->getVirtualOffset().x;
break;
case Fw::AnchorBottom:
case Fw::AnchorTop:
case Fw::AnchorVerticalCenter:
point -= parentWidget->getVirtualOffset().y;
break;
default:
break;
}
}
switch(anchor.getAnchoredEdge()) {
case Fw::AnchorHorizontalCenter:
newRect.moveHorizontalCenter(point + widget->getMarginLeft() - widget->getMarginRight());
@@ -197,7 +214,6 @@ void UIAnchorLayout::updateWidget(const UIWidgetPtr& widget, UIAnchorGroup& anch
}
}
newRect.translate(-parentWidget->getVirtualOffset());
widget->setRect(newRect);
anchorGroup.setUpdated(true);
}

View File

@@ -902,19 +902,35 @@ Rect UIWidget::getClippingRect()
return rect;
}
Rect UIWidget::getMarginRect()
{
Rect rect = m_rect;
rect.expand(m_margin.top, m_margin.right, m_margin.bottom, m_margin.left);
return rect;
}
Rect UIWidget::getChildrenRect()
{
Rect childrenRect;
for(const UIWidgetPtr& child : m_children) {
if(!child->isExplicitlyVisible() || !child->getRect().isValid() || child->getOpacity() == 0.0f)
if(!child->isExplicitlyVisible() || !child->getRect().isValid())
continue;
Rect marginRect = child->getMarginRect();
if(!childrenRect.isValid())
childrenRect = child->getRect();
childrenRect = marginRect;
else
childrenRect = childrenRect.united(child->getRect());
childrenRect = childrenRect.united(marginRect);
}
Rect myClippingRect = getClippingRect();
if(!childrenRect.isValid())
childrenRect = getClippingRect();
childrenRect = myClippingRect;
else {
if(childrenRect.width() < myClippingRect.width())
childrenRect.setWidth(myClippingRect.width());
if(childrenRect.height() < myClippingRect.height())
childrenRect.setHeight(myClippingRect.height());
}
return childrenRect;
}

View File

@@ -134,6 +134,7 @@ public:
bool hasChild(const UIWidgetPtr& child);
int getChildIndex(const UIWidgetPtr& child);
Rect getClippingRect();
Rect getMarginRect();
Rect getChildrenRect();
UIAnchorLayoutPtr getAnchoredLayout();
UIWidgetPtr getRootParent();