1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-07 12:54:00 +00:00
OpenMW/components/lua_ui/flex.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
1.3 KiB
C++
Raw Normal View History

#ifndef OPENMW_LUAUI_FLEX
#define OPENMW_LUAUI_FLEX
#include "alignment.hpp"
#include "widget.hpp"
namespace LuaUi
{
class LuaFlex : public MyGUI::Widget, public WidgetExtension
{
MYGUI_RTTI_DERIVED(LuaFlex)
protected:
MyGUI::IntSize calculateSize() override;
void updateProperties() override;
void updateChildren() override;
2022-05-14 10:27:30 +00:00
MyGUI::IntSize childScalingSize() override;
2022-09-22 18:26:05 +00:00
void updateCoord() override;
2022-09-22 18:26:05 +00:00
private:
bool mHorizontal;
bool mAutoSized;
MyGUI::IntSize mChildrenSize;
Alignment mAlign;
Alignment mArrange;
2022-09-22 18:26:05 +00:00
template <typename T>
T& primary(MyGUI::types::TPoint<T>& point)
{
return mHorizontal ? point.left : point.top;
}
2022-09-22 18:26:05 +00:00
template <typename T>
T& secondary(MyGUI::types::TPoint<T>& point)
{
return mHorizontal ? point.top : point.left;
}
2022-09-22 18:26:05 +00:00
template <typename T>
T& primary(MyGUI::types::TSize<T>& size)
{
return mHorizontal ? size.width : size.height;
}
2022-09-22 18:26:05 +00:00
template <typename T>
T& secondary(MyGUI::types::TSize<T>& size)
{
return mHorizontal ? size.height : size.width;
}
};
}
#endif // OPENMW_LUAUI_FLEX