element.hpp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#pragma once


#include <planet/affine/rectangle2d.hpp>
#include <planet/ui/constrained.hpp>
#include <planet/ui/forward.hpp>

#include <optional>


namespace planet::ui {

Layout element

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
    template<typename T>
    struct element<void, T> {
        using constrained_type = constrained2d<T>;


        element() noexcept {}
        explicit element(constrained_type const &s) noexcept : constraints{s} {}


        constrained_type constraints;
        std::optional<affine::rectangle2d> position;
    };


    template<typename E, typename T>
    struct element final : public element<void, T> {
        using element<void, T>::element;

        using value_type = E;
        value_type value;
    };


}