1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-30 03:32:36 +00:00

67 lines
1.6 KiB
C++
Raw Normal View History

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