38 lines
993 B
C++
38 lines
993 B
C++
#include <psemek/test/test.hpp>
|
|
|
|
#include <psemek/ui/impl/component_factory_base.hpp>
|
|
#include <psemek/ui/impl/single_container_base.hpp>
|
|
#include <psemek/ui/impl/stack_layout_base.hpp>
|
|
#include <psemek/ui/impl/box_layout_base.hpp>
|
|
#include <psemek/ui/rectangle.hpp>
|
|
|
|
#include <psemek/react/source.hpp>
|
|
|
|
using namespace psemek;
|
|
using namespace psemek::ui;
|
|
|
|
namespace
|
|
{
|
|
|
|
constexpr float layout_margin = 5.f;
|
|
|
|
struct rectangle_impl
|
|
: impl::component
|
|
{
|
|
void update(rectangle const &)
|
|
{}
|
|
};
|
|
|
|
struct test_component_factory
|
|
: impl::component_factory_base
|
|
{
|
|
test_component_factory()
|
|
{
|
|
register_type<rectangle, rectangle_impl>();
|
|
register_type<stack_layout, impl::stack_layout_base>();
|
|
register_type<box_layout::horizontal, impl::box_layout_base<0>>([]{ return std::make_unique<impl::box_layout_base<0>>(layout_margin); });
|
|
register_type<box_layout::vertical, impl::box_layout_base<1>>([]{ return std::make_unique<impl::box_layout_base<1>>(layout_margin); });
|
|
}
|
|
};
|
|
|
|
}
|