|
TachyonUI 0.1.0
High-performance UI for building tools.
|
Where an element goes on one axis: in the parent's flow (Relative, Centered, Sticky) or out of it (Absolute, Fixed, Anchored). More...
#include <gui_core/layout/gui_constraints.h>
Public Member Functions | |
| constexpr bool | IsInFlow () const |
| Relative, Centered and Sticky take part in the parent's flex/grid flow. | |
| constexpr PositionConstraintAxis & | WithType (PositionType t) |
| Changes only the position type, keeping the insets. | |
| void | Apply (IntRect &rect, int axis, const IntRect &targetRect) const |
| Positions rect on axis (0 = x, 1 = y) against targetRect (the parent's, or the anchor's). | |
| bool | operator== (const PositionConstraintAxis &) const noexcept=default |
Static Public Member Functions | |
| static constexpr PositionConstraintAxis | Auto () |
| Default: relative, no offset. | |
| static constexpr PositionConstraintAxis | Centered () |
| Centered in the parent. | |
| static constexpr PositionConstraintAxis | Relative () |
| In flow, shifted by near (or back by far when near is unset). | |
| static constexpr PositionConstraintAxis | Relative (int16_t nearVal) |
| static constexpr PositionConstraintAxis | Relative (int16_t nearVal, int16_t farVal) |
| static constexpr PositionConstraintAxis | Absolute (int16_t nearVal=kAuto, int16_t farVal=kAuto) |
| Out of flow, inset near from the parent's start or far from its end; scrolls with the parent. | |
| static constexpr PositionConstraintAxis | Fixed (int16_t nearVal=kAuto, int16_t farVal=kAuto) |
| Like Absolute, but in overlay space: not moved by the parent's scroll. | |
| static constexpr PositionConstraintAxis | Anchored (ID target, AnchorPlacementAxis placement, int16_t offset=0, AutoFlipMode flip=AutoFlipMode::None) |
| Placed relative to the target element's rect, plus offset pixels. | |
| static constexpr PositionConstraintAxis | Sticky (int16_t threshold=0) |
| In flow, but scrolling doesn't move it past threshold pixels inside the parent's padding box, like CSS position: sticky. | |
Public Attributes | |
| PositionType | type = PositionType::Relative |
| AnchorPlacementAxis | anchorPlacement = AnchorPlacementAxis::None |
| Anchored only: where along the target. | |
| AutoFlipMode | autoFlip = AutoFlipMode::None |
| Anchored only. | |
| ID | anchorTarget = ID::Invalid() |
| Anchored only: the element to anchor to. | |
| int16_t | near = kAuto |
| left/top inset, or anchor offset (pixels) | |
| int16_t | far = kAuto |
| right/bottom inset; anchored: how far it may reach past the work area | |
Static Public Attributes | |
| static constexpr int16_t | kAuto = EdgeInset::kAuto |
| Inset not set. | |
Where an element goes on one axis: in the parent's flow (Relative, Centered, Sticky) or out of it (Absolute, Fixed, Anchored).
|
inlineconstexpr |
Relative, Centered and Sticky take part in the parent's flex/grid flow.
|
inlinestaticconstexpr |
Default: relative, no offset.
|
inlinestaticconstexpr |
Centered in the parent.
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
Like Absolute, but in overlay space: not moved by the parent's scroll.
|
inlinestaticconstexpr |
Placed relative to the target element's rect, plus offset pixels.
|
inlinestaticconstexpr |
In flow, but scrolling doesn't move it past threshold pixels inside the parent's padding box, like CSS position: sticky.
|
inlineconstexpr |
Changes only the position type, keeping the insets.
| void tachyon::PositionConstraintAxis::Apply | ( | IntRect & | rect, |
| int | axis, | ||
| const IntRect & | targetRect ) const |
Positions rect on axis (0 = x, 1 = y) against targetRect (the parent's, or the anchor's).
|
defaultnoexcept |
|
staticconstexpr |
Inset not set.
| PositionType tachyon::PositionConstraintAxis::type = PositionType::Relative |
| AnchorPlacementAxis tachyon::PositionConstraintAxis::anchorPlacement = AnchorPlacementAxis::None |
Anchored only: where along the target.
| AutoFlipMode tachyon::PositionConstraintAxis::autoFlip = AutoFlipMode::None |
Anchored only.
| ID tachyon::PositionConstraintAxis::anchorTarget = ID::Invalid() |
Anchored only: the element to anchor to.
| int16_t tachyon::PositionConstraintAxis::near = kAuto |
left/top inset, or anchor offset (pixels)
| int16_t tachyon::PositionConstraintAxis::far = kAuto |
right/bottom inset; anchored: how far it may reach past the work area