Initial commit.
This commit is contained in:
commit
59c6161fdb
134 changed files with 4751 additions and 0 deletions
33
src/ui_elements/widgets/HorizontalSpacer.cpp
Normal file
33
src/ui_elements/widgets/HorizontalSpacer.cpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include "HorizontalSpacer.h"
|
||||
|
||||
HorizontalSpacer::HorizontalSpacer()
|
||||
: Widget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::shared_ptr<HorizontalSpacer> HorizontalSpacer::Create()
|
||||
{
|
||||
return std::make_shared<HorizontalSpacer>();
|
||||
}
|
||||
|
||||
void HorizontalSpacer::AddChildLayers(PaintEventPtr 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());
|
||||
}
|
||||
}
|
||||
|
||||
void HorizontalSpacer::OnPaintEvent(PaintEventPtr event)
|
||||
{
|
||||
mLayers.clear();
|
||||
|
||||
AddChildLayers(event);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue