Set up stacked widget.

This commit is contained in:
jmsgrogan 2020-06-27 10:47:30 +01:00
parent 4e85edacc8
commit ee51f3ee09
51 changed files with 808 additions and 195 deletions

View file

@ -31,21 +31,22 @@ void HorizontalSpacer::AddChildLayers(const PaintEvent* event)
mLayers.clear();
double scaleSum = std::accumulate(mScales.begin(), mScales.end(), 0.0);
double offset = 0;
double height = mHeight;
if (mMaxHeight > 0 && height > mMaxHeight)
double height = mSize.mHeight;
if (mSize.mMaxHeight > 0 && height > mSize.mMaxHeight)
{
height = mMaxHeight;
height = mSize.mMaxHeight;
}
for(std::size_t idx=0; idx<mChildren.size(); idx++)
{
auto& child = mChildren[idx];
double scale = mScales[idx];
double delta = height * (scale/scaleSum);
if (child->GetMaxHeight() > 0 && delta > child->GetMaxHeight())
auto size = child->GetSize();
if (size.mMaxHeight > 0 && delta > size.mMaxHeight)
{
delta = child->GetMaxHeight();
delta = size.mMaxHeight;
}
child->SetSize(mWidth, delta);
child->SetBounds(mSize.mWidth, delta);
child->SetLocation(DiscretePoint(mLocation.GetX(), mLocation.GetY() + offset));
child->OnPaintEvent(event);
auto layers = child->GetLayers();