43 enum Edge { AUTO, LEFT_MARGIN, RIGHT_MARGIN, BESIDE };
48 Anchor() : x(0), y(0), w(0), h(0),
valid(false), edge(AUTO) {}
50 Anchor(
int ax,
int ay,
int aw,
int ah,
Edge e = AUTO) : x(ax), y(ay), w(aw), h(ah),
valid(true), edge(e) {}
59 int top, bottom, side;
60 Insets(
int t = 0,
int b = 0,
int s = 0) : top(t), bottom(b), side(s) {}
67 enum class TAIL { UP, DOWN, LEFT, RIGHT };
70 struct Tail {
bool shown;
TAIL direction;
int x, y, w, h; };
81 void setPanel(GuiCard& panel,
PixelColor tailColor);
82 void setPanel(GuiCard& panel);
85 int maxPanelHeight()
const {
return maxHeight(screenH, insets); }
87 const Position& position()
const {
return placed; }
89 const Tail& tail()
const {
return placedTail; }
94 bool isDismissed()
const {
return dismissed; }
96 int dismissedBy()
const {
return by; }
98 void reopen() { dismissed =
false; by = -1; }
100 void update(InputController * c)
override;
103 static int maxHeight(
int screenHeight,
const Insets& insets);
109 static Position place(
const Anchor& anchor,
int w,
int h,
int screenWidth,
int screenHeight,
const Insets& insets);
119 int screenW, screenH;
int getTop()
Gets the current topmost coordinate of the element Considers vertical alignment, y offset,...
int getWidth()
Gets the current width of the element.
int getLeft()
Gets the current leftmost coordinate of the element Considers horizontal alignment,...
int getHeight()
Gets the height of the element.
void update(InputController *c) override
Called constantly to allow the element to respond to the current input data.
GuiOverlay(int w=0, int h=0)
GuiPopover(const Anchor &anchor=Anchor(), const Insets &insets=Insets())
A popover as large as the screen the platform reports, opening beside anchor (centered with none) and...
static Tail tailAt(const Anchor &anchor, const Position &at, int panelW, int panelH)
Puts the built panel (a card owned by ui, fixed or fit to its content: it is laid out here to measure...
UiScope ui
Owns the panel and everything else the popover is made of; build the panel with it.
TAIL
Which way the tail points.
Input-condition matcher attached to a GuiElement (via setSimpleTrigger() etc.) and evaluated against ...
The control a popover opens beside, in canvas pixels.
Edge
Which way the panel lines up: with the anchor's nearer edge (AUTO), or against a side margin to leave...
Anchor()
No anchor: the popover is centered.
Anchor(GuiElement &control, Edge e=AUTO)
The popover opens beside control, where it is now.
Anchor(int ax, int ay, int aw, int ah, Edge e=AUTO)
The popover opens beside the rectangle ax,ay,aw,ah
bool valid
false for a popover with no anchor: it is centered
What a popover keeps clear at the screen's edges: the bars at the top and bottom, and the margin at b...
Where the panel's top-left corner goes.
The little tail on the panel: x,y is its top-left corner, w,h its size, direction the way it points (...
8-bit-per-channel RGBA color used by the video interfaces.