Refactor layout and size policies - dirty
This commit is contained in:
parent
e71b8a5230
commit
89cca1b90e
8 changed files with 284 additions and 96 deletions
|
|
@ -42,7 +42,7 @@ RectF Widget::getAreaT() const {
|
|||
return mArea.getTargetRect();
|
||||
}
|
||||
|
||||
RectF Widget::getAreaCache() const {
|
||||
const RectF& Widget::getAreaCache() const {
|
||||
return mAreaCache;
|
||||
}
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ void Widget::removeChild(Widget* child) {
|
|||
child->triggerWidgetUpdate("parent changed");
|
||||
}
|
||||
|
||||
void Widget::setSizePolicy(tp::Widget::SizePolicy x, tp::Widget::SizePolicy y) {
|
||||
void Widget::setSizePolicy(SizePolicy x, SizePolicy y) {
|
||||
mSizePolicy = { x, y };
|
||||
triggerWidgetUpdate("chane size policy");
|
||||
}
|
||||
|
|
@ -162,7 +162,7 @@ void Widget::pickRect() {
|
|||
auto newArea = RectF(rangeX, rangeY);
|
||||
|
||||
for (auto child : mChildren) {
|
||||
child->setAreaCache(child->getAreaCache().move(current.pos - newArea.pos));
|
||||
child->setAreaCache(RectF(child->getAreaCache()).move(current.pos - newArea.pos));
|
||||
}
|
||||
|
||||
setAreaCache(newArea);
|
||||
|
|
@ -184,8 +184,8 @@ void Widget::adjustChildrenRect() {
|
|||
|
||||
switch (mLayoutPolicy) {
|
||||
case LayoutPolicy::Passive: break;
|
||||
case LayoutPolicy::Vertically: adjustLayout(true); break;
|
||||
case LayoutPolicy::Horizontally: adjustLayout(false); break;
|
||||
case LayoutPolicy::Vertical: adjustLayout(true); break;
|
||||
case LayoutPolicy::Horizontal: adjustLayout(false); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -305,7 +305,7 @@ RangeF Widget::clampRange(const RangeF& current, const RangeF& children, const R
|
|||
return out;
|
||||
}
|
||||
|
||||
RectF Widget::getChildrenEnclosure() {
|
||||
RectF Widget::getChildrenEnclosure() const {
|
||||
RectF out;
|
||||
|
||||
if (mChildren.empty()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue