Module: ui.event

Source: ./ui/event.reef


Overview

ui/event.reef - Event types for UI system Part of reef-stdlib UI module

This module defines all event types used in the UI system: mouse events, keyboard events, focus events, and window events.


Types

MouseButton (enum)

Variants:

  • Left
  • Right
  • Middle
  • Button4
  • Button5

MouseEventKind (enum)

Variants:

  • Down
  • Up
  • Move
  • Enter
  • Leave
  • Click
  • DoubleClick
  • Scroll

MouseEvent

Fields:

Name Type
kind MouseEventKind
button MouseButton
x float
y float
scroll_dx float
scroll_dy float
mods keys.Modifiers

KeyEventKind (enum)

Variants:

  • Down
  • Up
  • Press

KeyEvent

ROADMAP 8.2a: character is gone. It was the same parallel-field pattern reefvision.event carried as KeyEvent.ch -- a second place to keep the codepoint, and therefore a way for the two to disagree. The codepoint lives in the KeyCode now: keys.key_codepoint(e.code).

Fields:

Name Type
kind KeyEventKind
code keys.KeyCode
mods keys.Modifiers

FocusEventKind (enum)

Variants:

  • In
  • Out

FocusEvent

Fields:

Name Type
kind FocusEventKind

WindowEventKind (enum)

Variants:

  • Resize
  • Close
  • Minimize
  • Maximize
  • Restore
  • Move
  • Expose

WindowEvent

Fields:

Name Type
kind WindowEventKind
width int
height int
x int
y int

EventKind (enum)

Variants:

  • Mouse
  • Key
  • Focus
  • Window

Event

Fields:

Name Type
kind EventKind
mouse MouseEvent
key KeyEvent
focus FocusEvent
window WindowEvent

Functions

fn mouse_button_left(): MouseButton

fn mouse_button_right(): MouseButton

fn mouse_button_middle(): MouseButton

fn mouse_down(button: MouseButton, x: float, y: float, mods: keys.Modifiers): MouseEvent

fn mouse_up(button: MouseButton, x: float, y: float, mods: keys.Modifiers): MouseEvent

fn mouse_move(x: float, y: float, mods: keys.Modifiers): MouseEvent

fn mouse_enter(x: float, y: float): MouseEvent

fn mouse_leave(): MouseEvent

fn mouse_click(button: MouseButton, x: float, y: float, mods: keys.Modifiers): MouseEvent

fn mouse_double_click(button: MouseButton, x: float, y: float, mods: keys.Modifiers): MouseEvent

fn mouse_scroll(dx: float, dy: float, x: float, y: float, mods: keys.Modifiers): MouseEvent

fn key_down(code: keys.KeyCode, mods: keys.Modifiers): KeyEvent

fn key_up(code: keys.KeyCode, mods: keys.Modifiers): KeyEvent

fn key_press(codepoint: int, mods: keys.Modifiers): KeyEvent

The codepoint is an int now, not a char: a Reef char is one byte, so this package could not previously carry a keypress above U+007F.

fn focus_in(): FocusEvent

fn focus_out(): FocusEvent

fn window_resize(width: int, height: int): WindowEvent

fn window_close(): WindowEvent

fn window_minimize(): WindowEvent

fn window_maximize(): WindowEvent

fn window_restore(): WindowEvent

fn window_move(x: int, y: int): WindowEvent

fn window_expose(): WindowEvent

fn default_mouse_event(): MouseEvent

fn default_key_event(): KeyEvent

fn default_focus_event(): FocusEvent

fn default_window_event(): WindowEvent

fn event_mouse(e: MouseEvent): Event

fn event_key(e: KeyEvent): Event

fn event_focus(e: FocusEvent): Event

fn event_window(e: WindowEvent): Event

fn is_mouse_event(e: Event): bool

fn is_key_event(e: Event): bool

fn is_focus_event(e: Event): bool

fn is_window_event(e: Event): bool


Generated by reefc doc