1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
#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() const override;
void updateProperties() override;
void updateChildren() override;
MyGUI::IntSize childScalingSize() const override;
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
{
return mHorizontal ? point.left : point.top;
}
template <typename T>
T& secondary(MyGUI::types::TPoint<T>& point) const
{
return mHorizontal ? point.top : point.left;
}
template <typename T>
T& primary(MyGUI::types::TSize<T>& size) const
{
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
{
return mHorizontal ? size.height : size.width;
}
};
}
#endif // OPENMW_LUAUI_FLEX
|