Chesto 0.9
A declarative and element-based library for creating GUIs on homebrew'd consoles
Constraint.hpp
1#pragma once
2#include "Element.hpp"
3
4#include <vector>
5class Element;
6
7
8// clang-format on
9#define ALIGN_LEFT 0x01
10#define ALIGN_RIGHT 0x02
11#define ALIGN_TOP 0x04
12#define ALIGN_BOTTOM 0x08
13#define ALIGN_CENTER_HORIZONTAL 0x10
14#define ALIGN_CENTER_VERTICAL 0x20
15#define ALIGN_CENTER_BOTH 0x30
16
17#define OFFSET_LEFT 0x40
18#define OFFSET_RIGHT 0x80
19#define OFFSET_TOP 0x100
20#define OFFSET_BOTTOM 0x200
21#define OFFSET_ALL 0x3C0
22// clang-format off
23
25public:
26 Constraint(int flags, int padding = 0, std::vector<Element*> targets = {});
27 void clearFlags();
28 void addFlags(int flags);
29 void clearTargets();
30 void addTarget(Element* target);
31 void update();
32
33 void apply(Element* element);
34
35 /* positioning flags */
36 int positioningFlags = 0;
37
38 /* any referenced Elements that this constraint may define itself relative to */
39 std::vector<Element*> targets;
40
41 /* the amount to pad or offset this element by */
42 int paddingOffset = 0;
43};
Constraint(int flags, int padding=0, std::vector< Element * > targets={})
Definition: Constraint.cpp:15