TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
Application

GUIApplication, the frame, GUIContent and event handlers. More...

Namespaces

namespace  tachyon::Easing

Classes

class  tachyon::FrameClock
 Animation time locked to the display refresh. More...
struct  tachyon::FrameContext
 Per-frame values plus references to long-lived managers, passed to every stage callback. More...
class  tachyon::FramePipeline
 Stage callbacks run in registration order (no priorities): if A must run before B, construct A first (see GUIApplication::Initialize()). More...
struct  tachyon::CubicBezier
 A CSS cubic-bezier(x1, y1, x2, y2) timing curve: maps the share of a transition's time that has passed (0..1) to how far its value has gone (0..1). More...
struct  tachyon::MessageButton
 A button of a MessageDialog. More...
struct  tachyon::MessageDialogItem
 An affected item, listed in a well: a name, an optional color dot and note, and a checkbox when checked is set. More...
struct  tachyon::MessageDialogDesc
 What a MessageDialog shows. More...
struct  tachyon::GUIApplicationInitializeOptions
 What GUIApplication::Initialize sets up besides the core systems. More...
class  tachyon::GUIApplication
 The application: owns the windows, the systems and the frame loop. More...
struct  tachyon::GUIContent
 What a control shows: a text, an icon or both, and an optional tooltip. More...
struct  tachyon::PropertyHelp
 A property's help, shown in a larger tooltip (SetTooltip): its name, what it does, and where it lives in the API with its type, such as "MeshRenderer.castShadows (bool)". More...
struct  tachyon::SizerState
 Per-element state of the sizer handlers (element data store); internal. More...
struct  tachyon::SliderState
 Per-element state of MakeSliderHandler and the integer slider (element data store); internal. More...
struct  tachyon::DragLabelState
 Per-element state of a draggable label (element data store); internal. More...
struct  tachyon::LabelGroupVisualState
 Shared by all labels in a group, so the edge highlight is synchronized. More...
struct  tachyon::ScrollbarDragState
 Per-element state of MakeScrollbarHandler (element data store); internal. More...
struct  tachyon::TransitionState
 Pre-computed GPU style indices for a box that is mid-transition (or not). More...
struct  tachyon::TransitionTiming
 How long a change of state takes, and how it eases. A duration of 0 is instant. More...
class  tachyon::TransitionManager
 Tracks in-progress visual state transitions per element ID. More...

Typedefs

using tachyon::StageCallback = std::function<void(FrameContext&)>

Enumerations

enum class  tachyon::FrameStage : uint8_t {
  tachyon::FrameStage::PreFrame , tachyon::FrameStage::PreConstruct , tachyon::FrameStage::PostConstruct , tachyon::FrameStage::PreLayout ,
  tachyon::FrameStage::PostLayout , tachyon::FrameStage::PreInput , tachyon::FrameStage::PostInput , tachyon::FrameStage::PreRender ,
  tachyon::FrameStage::PostRender , tachyon::FrameStage::EndFrame
}
 The stages of a frame, in run order. More...
enum class  tachyon::MessageIcon : uint8_t {
  tachyon::MessageIcon::Warning , tachyon::MessageIcon::Quit , tachyon::MessageIcon::Question , tachyon::MessageIcon::Info ,
  tachyon::MessageIcon::Error
}
 The icon beside a MessageDialog's text. More...
enum class  tachyon::MessageButtonKind : uint8_t { tachyon::MessageButtonKind::Secondary , tachyon::MessageButtonKind::Primary , tachyon::MessageButtonKind::Danger }
 How a MessageButton is styled: Primary for the main choice, Danger for a destructive one. More...
enum class  tachyon::SliderPress : uint8_t { tachyon::SliderPress::Edit , tachyon::SliderPress::Jump }
 What pressing a slider does: Edit - a click (no drag) opens its value for typing; Jump - the value moves to the cursor at once and follows it while held. More...

Functions

void tachyon::FramePipeline::OnPreFrame (StageCallback cb)
 Adds cb to the end of that stage's callbacks.
void tachyon::FramePipeline::OnPreConstruct (StageCallback cb)
void tachyon::FramePipeline::OnPostConstruct (StageCallback cb)
void tachyon::FramePipeline::OnPreLayout (StageCallback cb)
void tachyon::FramePipeline::OnPostLayout (StageCallback cb)
void tachyon::FramePipeline::OnPreInput (StageCallback cb)
void tachyon::FramePipeline::OnPostInput (StageCallback cb)
void tachyon::FramePipeline::OnPreRender (StageCallback cb)
void tachyon::FramePipeline::OnPostRender (StageCallback cb)
void tachyon::FramePipeline::OnEndFrame (StageCallback cb)
void tachyon::VERIFY (ElementStorageResult result)
 Checks the result of an element-storage call (e.g.
void tachyon::VERIFY (RegistryResult result)
 As above, for windowRegistry calls.
void tachyon::VERIFY (AddWindowResult result)
 WindowUserClosed is accepted too: it's the expected outcome when a window can't be reopened.
void tachyon::VERIFY (RequestCloseResult result)
 Checks the result of closing a window: misuse (outside a frame, already closed) is reported; other failures assert.
bool tachyon::IsActivationKey (const ElementEvent &event)
 True for a KeyDown of Return, keypad Enter or Space.
bool tachyon::TextEditorUsesKey (const InputState &state, bool readOnly)
 Whether a focused text editor acts on this key (KeyDown/KeyUp), so its handler takes it; the rest reach the app's shortcuts.
EventHandler tachyon::MakeTextBoxHandler (GUIStateManager &guiStateManager)
 Text box handler: a left click focuses it for editing; while focused it takes text input and the keys its editor uses.
EventHandler tachyon::MakeHorizontalSizerHandler (GUIStateManager &guiStateManager, const ElementStorage &elementStorage, int &sizeValue, int minSize, int maxSize, std::function< void(int)> onChanged=nullptr, std::function< int()> onAutoSize=nullptr, bool invertMouseDelta=false, float pixelsPerUnit=1.0f)
 Sizer handler that drags sizeValue within [minSize, maxSize], calling onChanged with each new size.
EventHandler tachyon::MakeVerticalSizerHandler (GUIStateManager &guiStateManager, const ElementStorage &elementStorage, int &sizeValue, int minSize, int maxSize, std::function< void(int)> onChanged=nullptr, std::function< int()> onAutoSize=nullptr, bool invertMouseDelta=false, float pixelsPerUnit=1.0f)
 Y-axis counterpart of MakeHorizontalSizerHandler; invertMouseDelta grows the size when dragging up.
EventHandler tachyon::MakeSliderHandler (GUIStateManager &guiStateManager, const ElementStorage &elementStorage, float *value, int elementWidth, std::function< void()> onChanged=nullptr, float minVal=0.0f, float maxVal=1.0f, SliderPress press=SliderPress::Edit)
 Slider handler for *value in [minVal, maxVal]; elementWidth (pixels, <= 0 is treated as 1) maps drag distance onto that range.
EventHandler tachyon::MakeDraggableLabelHandler (GUIStateManager &guiStateManager, const ElementStorage &elementStorage)
 Turns mouse drags on a label into LabelDrag* events sent to the next sibling element.
EventHandler tachyon::MakeLabelHandler (GUIStateManager &guiStateManager, const ElementStorage &elementStorage)
 Label handler: a left click focuses the control bound to the label (else the label).
EventHandler tachyon::MakeGroupLabelHandler (GUIStateManager &guiStateManager, const ElementStorage &elementStorage, LabelGroupVisualState groupVisual)
 Label group variants: the right edge resizes the shared label width.
EventHandler tachyon::MakeGroupDraggableLabelHandler (GUIStateManager &guiStateManager, const ElementStorage &elementStorage, LabelGroupVisualState groupVisual)
EventHandler tachyon::MakeButtonHandler (GUIStateManager &guiStateManager, std::function< void()> onClick)
 Button handler: a left click, or an activation key while focused, calls onClick.
EventHandler tachyon::MakeMouseWheelScrollHandler (ScrollManagement &scrollManagement, float wheelStep)
 Wheel handler that scrolls the element's own scroll offset by wheelStep pixels per notch (StyleManager::Px(kWheelScrollStep)).
EventHandler tachyon::MakeScrollbarHandler (GUIStateManager &guiStateManager, ElementStorage &elementStorage, ID containerID, bool vertical, int32_t trackLength=0)
 Scrollbar track/thumb handler; writes the scroll offset of containerID (the scrollable parent).
EventHandler tachyon::MakeDragSourceHandler (GUIStateManager &guiStateManager, uint32_t payloadType, std::function< uintptr_t()> getPayloadValue=nullptr, std::function< std::any()> getPayload=nullptr, DragVisualizer sourceVisualizer={})
 Drag source handler: a left press starts a drag of payloadType, with the value from getPayloadValue (else 0) and the payload from getPayload (else that value).
EventHandler tachyon::MakeDropTargetHandler (uint32_t acceptedPayloadType, std::function< void(uintptr_t payloadValue, ID sourceID)> onDrop, std::function< bool(uintptr_t payloadValue)> canDrop=nullptr)
 Drop target handler for acceptedPayloadType; onDrop gets the payload value and the source ID.
double tachyon::LabelDragSpeedScale (const InputState &state)
 Label-drag speed multiplier: 0.1 with Ctrl, 10 with Shift (which wins), else 1.
template<typename T>
EventHandler tachyon::ReportingChanges (GUIStateManager &guiStateManager, T *value, EventHandler inner)
 Wraps a handler that writes *value: it runs during input, after the control's call returned, so a change marks the element clicked and the next call reports it (Interaction().HasBeenClicked(id)).
template<typename T>
EventHandler tachyon::MakeNumericalBoxHandler (GUIStateManager &guiStateManager, T &value, NumericFieldConfig< T > config={})
 Numeric field handler: a left click focuses it for typing, and LabelDrag* events from its label drag value (a cancelled drag restores the start value).
template<typename T>
EventHandler tachyon::MakeMultiDimDragHandler (GUIStateManager &guiStateManager, T &value, NumericFieldConfig< typename TypeDimensions< T >::ComponentType > config={})
 Applies LabelDrag* events to all components (multi-dimensional Field groups).
uint32_t tachyon::ComputeGPUStyleIndex (VisualBoxStyleIndex base, ElementState state)
 Flat GPU style index for a base pool index and state.

Variables

constexpr int32_t tachyon::kScrollbarMinThumbLength = 20
 Minimum thumb length in CSS pixels (scale with StyleManager::Px), so the thumb stays clickable over huge content.

Detailed Description

GUIApplication, the frame, GUIContent and event handlers.

Derive from tachyon::GUIApplication and describe the UI in OnGUI(); every control is one of its member functions. The class page groups them by family. The Overview explains the frame model, and Controls covers each control.

Typedef Documentation

◆ StageCallback

Enumeration Type Documentation

◆ FrameStage

enum class tachyon::FrameStage : uint8_t
strong

#include <gui_core/frame/gui_frame_pipeline.h>

The stages of a frame, in run order.

Enumerator
PreFrame 

theme reload, synthetic mouse events, per-frame cache clears

PreConstruct 

after elementStorage.BeginConstruction(), before OnGUI()

PostConstruct 

after OnGUI() returns, before elementStorage.EndConstruction()

PreLayout 

after textSystem->Update() and SyncWindowsBeforeLayout, before Layout()

PostLayout 

after Layout() and per-element AddPostLayout callbacks

PreInput 

hit-test, hover/active/cursor resolution, transitions

PostInput 

after inputManager->Process; scroll-offset/rect snapshots

PreRender 

before OnRender()

PostRender 

after OnRender(); transition purge

EndFrame 

before idManager.EndFrame / windowManager.EndFrame

◆ MessageIcon

enum class tachyon::MessageIcon : uint8_t
strong

#include <gui_controls/gui_application.h>

The icon beside a MessageDialog's text.

Enumerator
Warning 
Quit 
Question 
Info 
Error 

◆ MessageButtonKind

enum class tachyon::MessageButtonKind : uint8_t
strong

#include <gui_controls/gui_application.h>

How a MessageButton is styled: Primary for the main choice, Danger for a destructive one.

Enumerator
Secondary 
Primary 
Danger 

◆ SliderPress

enum class tachyon::SliderPress : uint8_t
strong

#include <gui_controls/gui_default_handlers.h>

What pressing a slider does: Edit - a click (no drag) opens its value for typing; Jump - the value moves to the cursor at once and follows it while held.

Enumerator
Edit 
Jump 

Function Documentation

◆ OnPreFrame()

void tachyon::FramePipeline::OnPreFrame ( StageCallback cb)
inline

#include <gui_core/frame/gui_frame_pipeline.h>

Adds cb to the end of that stage's callbacks.

◆ OnPreConstruct()

void tachyon::FramePipeline::OnPreConstruct ( StageCallback cb)
inline

◆ OnPostConstruct()

void tachyon::FramePipeline::OnPostConstruct ( StageCallback cb)
inline

◆ OnPreLayout()

void tachyon::FramePipeline::OnPreLayout ( StageCallback cb)
inline

◆ OnPostLayout()

void tachyon::FramePipeline::OnPostLayout ( StageCallback cb)
inline

◆ OnPreInput()

void tachyon::FramePipeline::OnPreInput ( StageCallback cb)
inline

◆ OnPostInput()

void tachyon::FramePipeline::OnPostInput ( StageCallback cb)
inline

◆ OnPreRender()

void tachyon::FramePipeline::OnPreRender ( StageCallback cb)
inline

◆ OnPostRender()

void tachyon::FramePipeline::OnPostRender ( StageCallback cb)
inline

◆ OnEndFrame()

void tachyon::FramePipeline::OnEndFrame ( StageCallback cb)
inline

◆ VERIFY() [1/4]

void tachyon::VERIFY ( ElementStorageResult result)

#include <gui_controls/gui_application.h>

Checks the result of an element-storage call (e.g.

elementStorage.Add): a failure is reported as API misuse and the caller carries on.

◆ VERIFY() [2/4]

void tachyon::VERIFY ( RegistryResult result)

#include <gui_controls/gui_application.h>

As above, for windowRegistry calls.

◆ VERIFY() [3/4]

void tachyon::VERIFY ( AddWindowResult result)

#include <gui_controls/gui_application.h>

WindowUserClosed is accepted too: it's the expected outcome when a window can't be reopened.

◆ VERIFY() [4/4]

void tachyon::VERIFY ( RequestCloseResult result)

#include <gui_controls/gui_application.h>

Checks the result of closing a window: misuse (outside a frame, already closed) is reported; other failures assert.

◆ IsActivationKey()

bool tachyon::IsActivationKey ( const ElementEvent & event)
inline

#include <gui_controls/gui_default_handlers.h>

True for a KeyDown of Return, keypad Enter or Space.

◆ TextEditorUsesKey()

bool tachyon::TextEditorUsesKey ( const InputState & state,
bool readOnly )

#include <gui_controls/gui_default_handlers.h>

Whether a focused text editor acts on this key (KeyDown/KeyUp), so its handler takes it; the rest reach the app's shortcuts.

Read-only text only selects and copies.

◆ MakeTextBoxHandler()

EventHandler tachyon::MakeTextBoxHandler ( GUIStateManager & guiStateManager)

#include <gui_controls/gui_default_handlers.h>

Text box handler: a left click focuses it for editing; while focused it takes text input and the keys its editor uses.

◆ MakeHorizontalSizerHandler()

EventHandler tachyon::MakeHorizontalSizerHandler ( GUIStateManager & guiStateManager,
const ElementStorage & elementStorage,
int & sizeValue,
int minSize,
int maxSize,
std::function< void(int)> onChanged = nullptr,
std::function< int()> onAutoSize = nullptr,
bool invertMouseDelta = false,
float pixelsPerUnit = 1.0f )

#include <gui_controls/gui_default_handlers.h>

Sizer handler that drags sizeValue within [minSize, maxSize], calling onChanged with each new size.

Sizes are in units of pixelsPerUnit pixels of the sizer's layout (for CSS px pass StyleManager::GetUIScale()). onAutoSize runs on double-click and returns the desired size in pixels, or -1 to skip. invertMouseDelta grows the size when dragging left. Escape during the drag puts the size back.

◆ MakeVerticalSizerHandler()

EventHandler tachyon::MakeVerticalSizerHandler ( GUIStateManager & guiStateManager,
const ElementStorage & elementStorage,
int & sizeValue,
int minSize,
int maxSize,
std::function< void(int)> onChanged = nullptr,
std::function< int()> onAutoSize = nullptr,
bool invertMouseDelta = false,
float pixelsPerUnit = 1.0f )

#include <gui_controls/gui_default_handlers.h>

Y-axis counterpart of MakeHorizontalSizerHandler; invertMouseDelta grows the size when dragging up.

◆ MakeSliderHandler()

EventHandler tachyon::MakeSliderHandler ( GUIStateManager & guiStateManager,
const ElementStorage & elementStorage,
float * value,
int elementWidth,
std::function< void()> onChanged = nullptr,
float minVal = 0.0f,
float maxVal = 1.0f,
SliderPress press = SliderPress::Edit )

#include <gui_controls/gui_default_handlers.h>

Slider handler for *value in [minVal, maxVal]; elementWidth (pixels, <= 0 is treated as 1) maps drag distance onto that range.

Arrow keys step 1% of the range, PageUp/Down 10%.

◆ MakeDraggableLabelHandler()

EventHandler tachyon::MakeDraggableLabelHandler ( GUIStateManager & guiStateManager,
const ElementStorage & elementStorage )

#include <gui_controls/gui_default_handlers.h>

Turns mouse drags on a label into LabelDrag* events sent to the next sibling element.

A press released without dragging focuses that control; Escape during a drag cancels it.

◆ MakeLabelHandler()

EventHandler tachyon::MakeLabelHandler ( GUIStateManager & guiStateManager,
const ElementStorage & elementStorage )

#include <gui_controls/gui_default_handlers.h>

Label handler: a left click focuses the control bound to the label (else the label).

◆ MakeGroupLabelHandler()

EventHandler tachyon::MakeGroupLabelHandler ( GUIStateManager & guiStateManager,
const ElementStorage & elementStorage,
LabelGroupVisualState groupVisual )

#include <gui_controls/gui_default_handlers.h>

Label group variants: the right edge resizes the shared label width.

◆ MakeGroupDraggableLabelHandler()

EventHandler tachyon::MakeGroupDraggableLabelHandler ( GUIStateManager & guiStateManager,
const ElementStorage & elementStorage,
LabelGroupVisualState groupVisual )

◆ MakeButtonHandler()

EventHandler tachyon::MakeButtonHandler ( GUIStateManager & guiStateManager,
std::function< void()> onClick )

#include <gui_controls/gui_default_handlers.h>

Button handler: a left click, or an activation key while focused, calls onClick.

◆ MakeMouseWheelScrollHandler()

EventHandler tachyon::MakeMouseWheelScrollHandler ( ScrollManagement & scrollManagement,
float wheelStep )

#include <gui_controls/gui_default_handlers.h>

Wheel handler that scrolls the element's own scroll offset by wheelStep pixels per notch (StyleManager::Px(kWheelScrollStep)).

◆ MakeScrollbarHandler()

EventHandler tachyon::MakeScrollbarHandler ( GUIStateManager & guiStateManager,
ElementStorage & elementStorage,
ID containerID,
bool vertical,
int32_t trackLength = 0 )

#include <gui_controls/gui_default_handlers.h>

Scrollbar track/thumb handler; writes the scroll offset of containerID (the scrollable parent).

Escape during a drag puts the scroll position back. trackLength = 0: span-and-clip, the bar spans kScrollbarAxisSpan and the track is the parent's innerRect. trackLength > 0: the bar is sized explicitly (to leave room for a corner cap, say) and the track is its own rect.

◆ MakeDragSourceHandler()

EventHandler tachyon::MakeDragSourceHandler ( GUIStateManager & guiStateManager,
uint32_t payloadType,
std::function< uintptr_t()> getPayloadValue = nullptr,
std::function< std::any()> getPayload = nullptr,
DragVisualizer sourceVisualizer = {} )

#include <gui_controls/gui_default_handlers.h>

Drag source handler: a left press starts a drag of payloadType, with the value from getPayloadValue (else 0) and the payload from getPayload (else that value).

◆ MakeDropTargetHandler()

EventHandler tachyon::MakeDropTargetHandler ( uint32_t acceptedPayloadType,
std::function< void(uintptr_t payloadValue, ID sourceID)> onDrop,
std::function< bool(uintptr_t payloadValue)> canDrop = nullptr )

#include <gui_controls/gui_default_handlers.h>

Drop target handler for acceptedPayloadType; onDrop gets the payload value and the source ID.

canDrop (optional) returning false makes the element a non-target for that payload.

◆ LabelDragSpeedScale()

double tachyon::LabelDragSpeedScale ( const InputState & state)
inline

#include <gui_controls/gui_default_handlers.h>

Label-drag speed multiplier: 0.1 with Ctrl, 10 with Shift (which wins), else 1.

◆ ReportingChanges()

template<typename T>
EventHandler tachyon::ReportingChanges ( GUIStateManager & guiStateManager,
T * value,
EventHandler inner )
inline

#include <gui_controls/gui_default_handlers.h>

Wraps a handler that writes *value: it runs during input, after the control's call returned, so a change marks the element clicked and the next call reports it (Interaction().HasBeenClicked(id)).

◆ MakeNumericalBoxHandler()

template<typename T>
EventHandler tachyon::MakeNumericalBoxHandler ( GUIStateManager & guiStateManager,
T & value,
NumericFieldConfig< T > config = {} )
inline

#include <gui_controls/gui_default_handlers.h>

Numeric field handler: a left click focuses it for typing, and LabelDrag* events from its label drag value (a cancelled drag restores the start value).

◆ MakeMultiDimDragHandler()

template<typename T>
EventHandler tachyon::MakeMultiDimDragHandler ( GUIStateManager & guiStateManager,
T & value,
NumericFieldConfig< typename TypeDimensions< T >::ComponentType > config = {} )
inline

#include <gui_controls/gui_default_handlers.h>

Applies LabelDrag* events to all components (multi-dimensional Field groups).

◆ ComputeGPUStyleIndex()

uint32_t tachyon::ComputeGPUStyleIndex ( VisualBoxStyleIndex base,
ElementState state )

#include <gui_controls/gui_transition_manager.h>

Flat GPU style index for a base pool index and state.

Must match vk_renderer.cpp and StyleManager::GetVisualBoxStyle (VisualMask, Disabled collapsing).

Variable Documentation

◆ kScrollbarMinThumbLength

int32_t tachyon::kScrollbarMinThumbLength = 20
constexpr

#include <gui_controls/gui_default_handlers.h>

Minimum thumb length in CSS pixels (scale with StyleManager::Px), so the thumb stays clickable over huge content.

The thickness is GUITheme::scrollbarThickness.