Files
MuditaOS/module-apps/application-desktop/windows/Common.hpp
Radoslaw Wicik a8573a404c Apply new style
2020-03-17 10:03:16 +01:00

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;
}
}