mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-07-04 13:17:08 -04:00
23 lines
567 B
C++
23 lines
567 B
C++
#pragma once
|
|
#include <Item.hpp>
|
|
|
|
inline void center(gui::Item *parent, gui::Item *child, gui::Axis axis)
|
|
{
|
|
if (!parent || !child)
|
|
return;
|
|
auto center = (parent->area().size(axis) - child->area().size(axis)) / 2;
|
|
if (center > 0) {
|
|
child->area().pos(axis) += center;
|
|
}
|
|
}
|
|
|
|
inline void bottom(gui::Item *parent, gui::Item *child, gui::Axis axis)
|
|
{
|
|
if (!parent || !child)
|
|
return;
|
|
auto bottom = (parent->area().size(axis) - child->area().size(axis));
|
|
if (bottom > 0) {
|
|
child->area().pos(axis) += bottom;
|
|
}
|
|
}
|