Skip to content

Commit

Permalink
Apply size=minSize to some container children
Browse files Browse the repository at this point in the history
This works around children with no h-grow not updating their parents' size.
The if is required because minSize does not always properly populate now.
  • Loading branch information
black-sliver committed Dec 26, 2024
1 parent ab68afe commit c495a0f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/uilib/simplecontainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ class SimpleContainer : public Container {
Container::setSize(size);
for (auto child : _children) {
Size childSize = child->getSize();
if (child->getHGrow()) childSize.width = _size.width-child->getLeft();
if (child->getVGrow()) childSize.height = _size.height-child->getTop();
if (child->getHGrow())
childSize.width = _size.width-child->getLeft();
else if (childSize.width < child->getMinWidth()) // FIXME: this also be done for HGrow
childSize.width = child->getMinWidth();
if (child->getVGrow())
childSize.height = _size.height-child->getTop();
else if (childSize.height < child->getMinWidth()) // FIXME: this also be done for VGrow
childSize.height = child->getMinWidth();
child->setSize(childSize);
break; // only the first child for now; TODO: only container-sized widgets?
}
Expand Down

0 comments on commit c495a0f

Please sign in to comment.