Move windows to uptr. Add simple text editing.

This commit is contained in:
jmsgrogan 2020-06-20 16:34:10 +01:00
parent 2bcc7b3d83
commit b99708e7d3
55 changed files with 1257 additions and 994 deletions

View file

@ -1,33 +1,34 @@
#include "HorizontalSpacer.h"
#include <algorithm>
HorizontalSpacer::HorizontalSpacer()
: Widget()
: Widget()
{
}
std::shared_ptr<HorizontalSpacer> HorizontalSpacer::Create()
std::unique_ptr<HorizontalSpacer> HorizontalSpacer::Create()
{
return std::make_shared<HorizontalSpacer>();
return std::make_unique<HorizontalSpacer>();
}
void HorizontalSpacer::AddChildLayers(PaintEventPtr event)
void HorizontalSpacer::AddChildLayers(const PaintEvent* event)
{
unsigned delta = mHeight / mChildren.size();
for(std::size_t idx=0; idx<mChildren.size(); idx++)
{
auto child = mChildren[idx];
child->SetSize(mWidth, delta);
child->SetLocation(DiscretePoint(mLocation.GetX(), mLocation.GetY() + delta*idx));
child->OnPaintEvent(event);
auto layers = child->GetLayers();
mLayers.insert(mLayers.end(), layers.begin(), layers.end());
}
mLayers.clear();
unsigned delta = mHeight / mChildren.size();
for(std::size_t idx=0; idx<mChildren.size(); idx++)
{
auto& child = mChildren[idx];
child->SetSize(mWidth, delta);
child->SetLocation(DiscretePoint(mLocation.GetX(), mLocation.GetY() + delta*idx));
child->OnPaintEvent(event);
auto layers = child->GetLayers();
mLayers.insert(mLayers.end(), layers.begin(), layers.end());
}
}
void HorizontalSpacer::OnPaintEvent(PaintEventPtr event)
void HorizontalSpacer::OnPaintEvent(const PaintEvent* event)
{
mLayers.clear();
AddChildLayers(event);
AddChildLayers(event);
}