More window cleaning
This commit is contained in:
parent
6adc441e6f
commit
53c98a227d
29 changed files with 422 additions and 261 deletions
|
@ -15,20 +15,19 @@ std::unique_ptr<HorizontalSpacer> HorizontalSpacer::Create()
|
|||
return std::make_unique<HorizontalSpacer>();
|
||||
}
|
||||
|
||||
void HorizontalSpacer::AddWidget(WidgetUPtr widget)
|
||||
void HorizontalSpacer::addWidget(WidgetUPtr widget)
|
||||
{
|
||||
AddWidgetWithScale(std::move(widget), 1.0);
|
||||
addWidgetWithScale(std::move(widget), 1.0);
|
||||
}
|
||||
|
||||
void HorizontalSpacer::AddWidgetWithScale(WidgetUPtr widget, double scale)
|
||||
void HorizontalSpacer::addWidgetWithScale(WidgetUPtr widget, double scale)
|
||||
{
|
||||
Widget::AddWidget(std::move(widget));
|
||||
Widget::addWidget(std::move(widget));
|
||||
mScales.push_back(scale);
|
||||
}
|
||||
|
||||
void HorizontalSpacer::AddChildLayers(const PaintEvent* event)
|
||||
void HorizontalSpacer::addChildLayers(const PaintEvent* event)
|
||||
{
|
||||
mLayers.clear();
|
||||
double scaleSum = std::accumulate(mScales.begin(), mScales.end(), 0.0);
|
||||
double offset = 0;
|
||||
double height = mSize.mHeight;
|
||||
|
@ -41,21 +40,27 @@ void HorizontalSpacer::AddChildLayers(const PaintEvent* event)
|
|||
auto& child = mChildren[idx];
|
||||
double scale = mScales[idx];
|
||||
double delta = height * (scale/scaleSum);
|
||||
auto size = child->GetSize();
|
||||
auto size = child->getSize();
|
||||
if (size.mMaxHeight > 0 && delta > size.mMaxHeight)
|
||||
{
|
||||
delta = size.mMaxHeight;
|
||||
}
|
||||
child->SetBounds(mSize.mWidth, unsigned(delta));
|
||||
child->SetLocation(DiscretePoint(mLocation.GetX(), mLocation.GetY() + unsigned(offset)));
|
||||
child->OnPaintEvent(event);
|
||||
auto layers = child->GetLayers();
|
||||
child->setBounds(mSize.mWidth, unsigned(delta));
|
||||
child->setLocation(DiscretePoint(mLocation.GetX(), mLocation.GetY() + unsigned(offset)));
|
||||
child->onPaintEvent(event);
|
||||
auto layers = child->getLayers();
|
||||
mLayers.insert(mLayers.end(), layers.begin(), layers.end());
|
||||
offset += delta;
|
||||
}
|
||||
}
|
||||
|
||||
void HorizontalSpacer::OnPaintEvent(const PaintEvent* event)
|
||||
void HorizontalSpacer::onPaintEvent(const PaintEvent* event)
|
||||
{
|
||||
AddChildLayers(event);
|
||||
if (!needsUpdate())
|
||||
{
|
||||
return;
|
||||
}
|
||||
mLayers.clear();
|
||||
|
||||
addChildLayers(event);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue