Skip to content

Event API

Declared by <huxerui/event.h>.

  • InteractionState: enabled, hovered, pressed, focused, and focus-visible state.
  • InteractionEvent::Type: Press, Release, or Cancel; InteractionEvent::Source: Pointer or Keyboard.
  • InteractionEvent: type, source, matching press_id, and optional node-local pointer position.
  • PointerEventType: Down, Up, Move, or Cancel; PointerDeviceKind: Mouse, Touch, or Pen.
  • PointerEvent: type, pointer ID, node-local position, device kind, and click count.
  • ScrollEvent: local delta and pointer position.
  • Key: Unknown, Tab, Enter, Space, Escape, Backspace, Delete, ArrowLeft, ArrowRight, ArrowUp, ArrowDown, Home, End, PageUp, PageDown, A, C, V, X, Y, Z, Shift, Control, Alt, and Meta.
  • KeyEventType: Down or Up; KeyModifiers carries Shift, Control, Alt, and Meta flags.
  • KeyEvent: type, key, text, modifiers, and repeat state.
  • BackPhase: Begin, Update, Cancel, or Commit; BackEvent carries phase and progress.

Base shape for an event key. A key supplies using Signature = void(Arguments...); its type is the identity.

  • ViewEvents: Click, PointerDown, PointerMove, PointerUp, PointerCancel, FocusChanged, KeyDown, KeyUp, and BackRequested.
  • ToggleEvents::Changed(bool).
  • SliderEvents::Changed(float).
  • SegmentedButtonEvents::Changed(std::size_t).
  • TabsEvents::Changed(std::size_t).
  • NavigationEvents::Changed(std::size_t).
  • DrawerEvents::OpenChanged(bool).
  • TextFieldEvents::Changed(const TextEditingValue&) and Submitted().

View::On<Key>(handler) binds a callable compatible with Key::Signature to that view declaration. UseEvents() returns a copyable EventEmitter; emitter.Emit<Key>(arguments...) sends a component-owned event through the current scope. EventEmitter::IsConnected() reports whether that scope still owns the event channel.

Handlers are copied into the transient View declaration and reconciled with its mounted node. They run on the Runtime UI thread and remain installed only while that node or scope is mounted. OnClick is the built-in activation event and also installs default indication; use On<Key> for another typed semantic event.

Pointer positions and scroll deltas are expressed in logical coordinates local to the receiving node. Platform adapters convert native pixels, screen coordinates, click counts, key identity, and modifiers before dispatch. EventEmitter is appropriate for a reusable scoped component’s own output; it is not a process-wide event bus. Handler erasure and dispatch storage live in huxerui::detail and are not extension contracts.