TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
Elements and state

IDs, element storage and the state kept between frames. More...

Classes

struct  tachyon::Element
struct  tachyon::ElementRect
struct  tachyon::HierarchyInfo
struct  tachyon::ElementRef
 An element's slot in ElementStorage: its depth and index within that depth. More...
struct  tachyon::IndexRange
 A half-open range [begin, end) of indices within one depth. More...
struct  tachyon::ElementMove
 What a MoveChild did: the slot rotations it applied at each depth, so code that stores ElementRefs (e.g. More...
struct  tachyon::PostDrawEntry
 Node in the flat post-draw linked list stored in ElementStorage. More...
struct  tachyon::ElementCustomDraw
 callback fires before the children render; the after-list fires after the whole subtree. More...
class  tachyon::ElementDataStore
 Per-element typed state keyed by ID, kept across frames (drag start, double-click timing). More...
struct  tachyon::DepthScanCursor
struct  tachyon::TopDownDepthScanIterator
struct  tachyon::BottomUpDepthScanIterator
class  tachyon::Range< Iterator >
struct  tachyon::AddResult
 What Add returns: the new element's ref and status; true on success. More...
class  tachyon::ElementStorage
 The frame's element tree. More...
struct  tachyon::ID
 A 64-bit element ID whose bit layout depends on its IDMode. More...
class  tachyon::IDManager
 Makes element IDs: per-frame dynamic / ranged IDs (hashed from the call site or a hint and the parent stack) and persistent static IDs. More...
struct  tachyon::DragVisualContext
 What a DragVisualizer draws from: the pointer, the source and target, and the payload. More...
class  tachyon::DragDropState
 Drag-and-drop state, owned by GUIStateManager. More...
class  tachyon::InteractionState
 The hovered, active, focused and captured elements, the active window, the one-shot click, hover suppression and the focus scroll axis. More...
class  tachyon::ScrollManagement
 Scroll containers' offsets (pixels), kept across frames by ID behind handles. More...
class  tachyon::CursorState
 The mouse cursor requested this frame. More...
class  tachyon::TextEditorFocusState
 The focused text editor, plus the one as of the last Commit, to detect changes. More...
class  tachyon::ConstructionScopes
 Construction-time Push/Pop nesting read by GUIStateManager::GetCurrentState. More...
struct  tachyon::FrameInput
 What the window layer reports at the end of a frame's construction; GUIStateManager::EndFrame turns it into the hovered element and the active window. More...
struct  tachyon::FrameHover
 Where the frame's input goes, from GUIStateManager::EndFrame. More...
class  tachyon::GUIStateManager
 Owns the per-frame state objects and runs their BeginFrame / EndFrame in order. More...
class  tachyon::TabChainManager
 Tracks the next/prev tab targets around the focused element, rebuilt each frame during construction and scoped to the active window. More...

Macros

#define TACHYON_ITERATOR_TRAITS_USING_DECLS(type)

Typedefs

using tachyon::CustomDrawCallback = std::function<void(CustomDrawContext& ctx)>
 Render-time callback.
using tachyon::PostLayoutCallback = std::function<void(PostLayoutContext& ctx)>
 Runs after layout, before rendering, with read-only access to final rects/transforms.
using tachyon::TopDownDepthScanRangeIterator = Range<TopDownDepthScanIterator>
using tachyon::BottomUpDepthScanRangeIterator = Range<BottomUpDepthScanIterator>
using tachyon::DragVisualizer = std::function<void(const DragVisualContext& context)>
 Draws the dragged item while a drag is in progress.

Enumerations

enum class  tachyon::ElementFlags : uint32_t {
  tachyon::ElementFlags::None = 0 , tachyon::ElementFlags::IsLabel = 1u << 0 , tachyon::ElementFlags::IsControl = 1u << 1 , tachyon::ElementFlags::HasText = 1u << 2 ,
  tachyon::ElementFlags::HasIcon = 1u << 3 , tachyon::ElementFlags::DoNotMeasureText = 1u << 4 , tachyon::ElementFlags::IsWindow = 1u << 5 , tachyon::ElementFlags::WindowCanMove = 1u << 6 ,
  tachyon::ElementFlags::WindowCanResize = 1u << 7 , tachyon::ElementFlags::WindowUserControlled = WindowCanMove | WindowCanResize , tachyon::ElementFlags::WindowNoCaption = 1u << 8 , tachyon::ElementFlags::WindowIsCentered = 1u << 9 ,
  tachyon::ElementFlags::WindowIsTransparent = 1u << 10 , tachyon::ElementFlags::WindowIsModal = 1u << 11 , tachyon::ElementFlags::WindowIsPopup = 1u << 12 , tachyon::ElementFlags::WindowCloseWithParent = 1u << 13 ,
  tachyon::ElementFlags::WindowNotFocusable = 1u << 14 , tachyon::ElementFlags::WindowRenderToImage = 1u << 18 , tachyon::ElementFlags::WindowCustomTitleBar = 1u << 19 , tachyon::ElementFlags::WindowConfirmClose = 1u << 21 ,
  tachyon::ElementFlags::Shadows = 1u << 15 , tachyon::ElementFlags::PropagatesDescendantState = 1u << 16 , tachyon::ElementFlags::NoInput = 1u << 17 , tachyon::ElementFlags::IsCachedScope = 1u << 20 ,
  tachyon::ElementFlags::SharesID = 1u << 22 , tachyon::ElementFlags::AnimatesSelected = 1u << 23 , tachyon::ElementFlags::IsMenuWindow = IsWindow | WindowUserControlled | WindowNoCaption | WindowIsPopup | Shadows
}
 What an element is and how it behaves, combined with |. More...
enum class  tachyon::ScrollOffsetHandle : uint32_t { tachyon::ScrollOffsetHandle::Invalid = 0 }
 A handle to a stored scroll offset. More...
enum class  tachyon::ElementStorageResult {
  tachyon::ElementStorageResult::Success , tachyon::ElementStorageResult::NotConstructing , tachyon::ElementStorageResult::MissingAdd , tachyon::ElementStorageResult::MissingBeginChildren ,
  tachyon::ElementStorageResult::MissingEndChildren , tachyon::ElementStorageResult::DuplicateCall , tachyon::ElementStorageResult::InvalidStyle , tachyon::ElementStorageResult::UnknownProblem
}
 Outcome of an ElementStorage call. More...
enum class  tachyon::IDMode : uint64_t { tachyon::IDMode::Static = 0 , tachyon::IDMode::Dynamic = 1 , tachyon::IDMode::Ranged = 2 , tachyon::IDMode::SubRange = 3 }
 How an ID was made; stored in 2 bits of the ID. More...
enum class  tachyon::ScrollAxis : uint8_t { tachyon::ScrollAxis::None = 0 , tachyon::ScrollAxis::X = 1 << 0 , tachyon::ScrollAxis::Y = 1 << 1 , tachyon::ScrollAxis::Both = X | Y }
 Axis mask for scroll-into-view, so e.g. a horizontal sizer doesn't scroll vertically. More...

Functions

template<typename T, typename... Args>
T & tachyon::ElementDataStore::GetOrCreate (ID id, Args &&... args)
 The T stored for id, constructed from args when absent.
template<typename T>
T * tachyon::ElementDataStore::Get (ID id)
 The T stored for id, or nullptr (also on a type mismatch). Touches the entry if found.
bool tachyon::TopDownDepthScanIterator::Validate () const
bool tachyon::BottomUpDepthScanIterator::Validate () const
TopDownDepthScanIterator & tachyon::TopDownDepthScanIterator::operator++ ()
TopDownDepthScanIterator tachyon::TopDownDepthScanIterator::operator++ (int)
BottomUpDepthScanIterator & tachyon::BottomUpDepthScanIterator::operator++ ()
BottomUpDepthScanIterator tachyon::BottomUpDepthScanIterator::operator++ (int)

Variables

IntRect tachyon::ElementRect::rect {}
 Computed during layout.
IntRect tachyon::ElementRect::innerRect {}
 Padding box (screen space).
IntRect tachyon::ElementRect::clipRect {}
 Clip bounds (screen space).
IntRect tachyon::ElementRect::contentBounds {}
 Bounds of all children (parent-local space).

Detailed Description

IDs, element storage and the state kept between frames.

See IDs for how IDs stay stable.

Macro Definition Documentation

◆ TACHYON_ITERATOR_TRAITS_USING_DECLS

#define TACHYON_ITERATOR_TRAITS_USING_DECLS ( type)

#include <gui_core/elements/gui_element_iterators.h>

Value:
using value_type = type; \
using difference_type = std::ptrdiff_t; \
using reference = const value_type&; \
using pointer = const value_type*;

Typedef Documentation

◆ CustomDrawCallback

using tachyon::CustomDrawCallback = std::function<void(CustomDrawContext& ctx)>

#include <gui_core/elements/gui_element.h>

Render-time callback.

Coordinates are inner-rect-local LAYOUT space; the renderer's transform applies the inner-rect offset and content transforms. See CustomDrawContext for the coordinate-space contract.

◆ PostLayoutCallback

using tachyon::PostLayoutCallback = std::function<void(PostLayoutContext& ctx)>

#include <gui_core/elements/gui_element.h>

Runs after layout, before rendering, with read-only access to final rects/transforms.

◆ TopDownDepthScanRangeIterator

◆ BottomUpDepthScanRangeIterator

◆ DragVisualizer

using tachyon::DragVisualizer = std::function<void(const DragVisualContext& context)>

#include <gui_core/state/gui_drag_drop_state.h>

Draws the dragged item while a drag is in progress.

Enumeration Type Documentation

◆ ElementFlags

enum class tachyon::ElementFlags : uint32_t
strong

#include <gui_core/elements/gui_element_flags.h>

What an element is and how it behaves, combined with |.

The indented flags go with the kind above them (IsControl, IsWindow).

Enumerator
None 
IsLabel 
IsControl 
HasText 
HasIcon 
DoNotMeasureText 
IsWindow 
WindowCanMove 
WindowCanResize 
WindowUserControlled 
WindowNoCaption 
WindowIsCentered 
WindowIsTransparent 
WindowIsModal 
WindowIsPopup 
WindowCloseWithParent 
WindowNotFocusable 
WindowRenderToImage 

no OS window; see WindowFlags::RenderToImage

WindowCustomTitleBar 

draws its own title bar; see WindowFlags::CustomTitleBar

WindowConfirmClose 

closing it asks the app first: GUIApplication::CloseRequested

Shadows 

OS drop shadow for windows (elements use CSS box-shadow).

PropagatesDescendantState 

Hover/Focused when any descendant is.

NoInput 

Mouse hits pass through; a window's, to the windows under it.

IsCachedScope 

BeginCached scope; blits its cached primitives while clean.

SharesID 

Has an earlier element's ID on purpose: a part of it, e.g. a row's tree cell.

AnimatesSelected 

Turning Selected on or off blends like a toggle (a switch's track, a check box's box); without it Selected changes at once, as a row's selection does.

IsMenuWindow 

◆ ScrollOffsetHandle

enum class tachyon::ScrollOffsetHandle : uint32_t
strong

#include <gui_core/elements/gui_element_storage.h>

A handle to a stored scroll offset.

Zero-initialized handles are Invalid; real handles are 1..N.

Enumerator
Invalid 

◆ ElementStorageResult

enum class tachyon::ElementStorageResult
strong

#include <gui_core/elements/gui_element_storage.h>

Outcome of an ElementStorage call.

Enumerator
Success 
NotConstructing 

Called outside BeginConstruction/EndConstruction.

MissingAdd 

Called without first calling Add.

MissingBeginChildren 

EndChildren without an open BeginChildren.

MissingEndChildren 

BeginChildren left open when construction ended.

DuplicateCall 

Called again where once is allowed (e.g. BeginChildren twice).

InvalidStyle 

The element's style is invalid.

UnknownProblem 

An invalid ref or another unexpected state.

◆ IDMode

enum class tachyon::IDMode : uint64_t
strong

#include <gui_core/gui_id.h>

How an ID was made; stored in 2 bits of the ID.

Enumerator
Static 

persistent; created and released through IDManager, checked by generation

Dynamic 

remade each frame from the call site or a hint and the parent stack

Ranged 

remade each frame; a block of sub-IDs for indexed content (IDManager::GetSubID)

SubRange 

one item of a Ranged ID: the range's hash plus an index

◆ ScrollAxis

enum class tachyon::ScrollAxis : uint8_t
strong

#include <gui_core/state/gui_scroll_management.h>

Axis mask for scroll-into-view, so e.g. a horizontal sizer doesn't scroll vertically.

Enumerator
None 
X 
Y 
Both 

Function Documentation

◆ GetOrCreate()

template<typename T, typename... Args>
T & tachyon::ElementDataStore::GetOrCreate ( ID id,
Args &&... args )

#include <gui_core/elements/gui_element_data_store.h>

The T stored for id, constructed from args when absent.

Touches the entry. One id holds one type: asserts on a type mismatch (release builds replace the entry).

◆ Get()

template<typename T>
T * tachyon::ElementDataStore::Get ( ID id)

#include <gui_core/elements/gui_element_data_store.h>

The T stored for id, or nullptr (also on a type mismatch). Touches the entry if found.

◆ Validate() [1/2]

bool tachyon::TopDownDepthScanIterator::Validate ( ) const
inline

◆ Validate() [2/2]

bool tachyon::BottomUpDepthScanIterator::Validate ( ) const
inline

◆ operator++() [1/4]

TopDownDepthScanIterator & tachyon::TopDownDepthScanIterator::operator++ ( )
inline

◆ operator++() [2/4]

TopDownDepthScanIterator tachyon::TopDownDepthScanIterator::operator++ ( int )
inline

◆ operator++() [3/4]

BottomUpDepthScanIterator & tachyon::BottomUpDepthScanIterator::operator++ ( )
inline

◆ operator++() [4/4]

BottomUpDepthScanIterator tachyon::BottomUpDepthScanIterator::operator++ ( int )
inline

Variable Documentation

◆ rect

IntRect tachyon::ElementRect::rect {}

Computed during layout.

Border box (screen space)

◆ innerRect

IntRect tachyon::ElementRect::innerRect {}

Padding box (screen space).

◆ clipRect

IntRect tachyon::ElementRect::clipRect {}

Clip bounds (screen space).

◆ contentBounds

IntRect tachyon::ElementRect::contentBounds {}

Bounds of all children (parent-local space).