Module: reefvision.desktop

Source: ./reefvision/desktop.reef


Overview

reefvision.desktop — Desktop + Application event loop (design §10.1–10.2)

object Desktop extends view.Group: windows are children via add. object Application is passive (not an Active Object). It owns terminal lifecycle, double-buffered cells, key/mouse decode, and the poll → dispatch → dirty-draw → flush loop.

Usage: mut app = new desktop.Application(theme.default_theme()) app.desktop().add(win) if app.open() while app.running() app.do_step() end while app.close() end if

F2 cycles built-in themes; F3 cycles canvas fill textures. Nested modals: app.message_box. Host I/O is reef_rv_* only (no curses). MenuBar is desktop chrome at row 0 (set_menubar), not a Group child.


Objects

Desktop

Extends: view.Group

Fields:

Name Type
active_idx int
menubar menubar.MenuBar
has_menubar bool
status string
status_right string
show_status bool
canvas_fill int
context menubar.PopupMenu
has_context bool
cmds commands.CommandTable
has_cmds bool

proc init()

Methods:

shared fn window_count(): int

shared fn window_at(idx: int): window.Window

shared fn has_window(): bool

shared fn active_idx(): int

shared fn status(): string

shared fn status_right(): string

shared fn has_menubar(): bool

shared fn menubar(): menubar.MenuBar

shared fn has_context_menu(): bool

shared fn context_is_open(): bool

shared fn context_last_command(): int

shared fn content_rect(): cell.Rect

exclusive proc set_bounds(bounds: cell.Rect)

exclusive proc set_status(text: string)

exclusive proc set_status_right(text: string)

exclusive proc set_canvas_fill(ch: int)

exclusive proc set_commands(cmds: commands.CommandTable)

exclusive proc set_active_idx(idx: int)

override exclusive proc add(v: view.View)

exclusive proc close_window_at(idx: int)

exclusive proc show_window_at(idx: int)

exclusive proc close_active()

exclusive proc restore_minimized()

exclusive proc cascade()

exclusive proc tile()

exclusive proc set_menubar(mb: menubar.MenuBar)

exclusive proc set_context_menu(p: menubar.PopupMenu)

exclusive proc show_context_at(x: int, y: int)

exclusive proc close_context()

exclusive proc context_clear_command()

exclusive proc layout_on_resize()

shared fn window_hit_test(mx: int, my: int): int

shared fn window_drag_owner(): int

override exclusive proc draw(buf: cell.CellBuffer, abs: cell.Rect, clip: cell.Rect, focused: bool, th: theme.Theme)

override exclusive fn handle_event(e: event.Event): view.EventResult

Application

Fields:

Name Type
term term.Term
front cell.CellBuffer
back cell.CellBuffer
desktop Desktop
th theme.Theme
decoder input.KeyDecoder
running bool
dirty bool
open_flag bool
last_command int
read_buf string
key_scratch [event.KeyEvent]
event_scratch [event.Event]
theme_cycle_idx int
fill_cycle_idx int
canvas_fill_override bool
cmds commands.CommandTable
has_cmds bool
modals [window.Window]
modal_count int
modal_dim bool

proc init(th: theme.Theme)

Methods:

shared fn desktop(): Desktop

shared fn theme(): theme.Theme

shared fn running(): bool

shared fn is_open(): bool

shared fn last_command(): int

shared fn theme_cycle_idx(): int

shared fn desktop_fill_cycle_idx(): int

shared fn desktop_fill_overridden(): bool

shared fn desktop_fill(): int

shared fn status(): string

shared fn status_right(): string

shared fn commands(): commands.CommandTable

shared fn window_count(): int

shared fn window_at(idx: int): window.Window

shared fn has_modal(): bool

shared fn modal_count(): int

shared fn modal_top(): window.Window

shared fn modal_dim(): bool

exclusive proc clear_command()

exclusive proc quit()

exclusive proc set_dirty()

exclusive proc set_modal_dim(on: bool)

exclusive proc sync_canvas_fill_from_theme()

exclusive proc set_theme(th: theme.Theme)

exclusive proc cycle_theme()

exclusive proc set_desktop_fill(ch: int)

exclusive proc clear_desktop_fill_override()

exclusive proc cycle_desktop_fill()

exclusive proc set_status(text: string)

exclusive proc set_status_right(text: string)

exclusive proc add_window(w: window.Window)

exclusive proc show_window_at(idx: int)

exclusive proc close_active_window()

exclusive proc restore_minimized()

exclusive proc cascade_windows()

exclusive proc tile_windows()

exclusive proc set_menubar(mb: menubar.MenuBar)

exclusive proc register_menu_accels()

exclusive proc set_context_menu(p: menubar.PopupMenu)

exclusive proc show_context_at(x: int, y: int)

exclusive proc close_context()

exclusive proc set_commands(cmds: commands.CommandTable)

exclusive proc modal_push(w: window.Window)

exclusive proc modal_pop()

exclusive proc apply_window_command(cmd: int, idx: int)

exclusive fn dispatch_to_desktop(e: event.Event): bool

exclusive proc read_feed()

exclusive proc consume_paste()

exclusive proc paste_text(text: string)

exclusive proc clipboard_set(text: string)

exclusive proc clipboard_query()

exclusive proc rebuild_buffers()

exclusive proc check_resize()

exclusive proc draw_modal_dim()

exclusive proc redraw()

exclusive proc drain_keys_desktop(flush_pending: bool)

exclusive proc poll_input_desktop()

exclusive fn dispatch_modal_event(e: event.Event): int

exclusive proc drain_keys_modal(flush_pending: bool, out_cmd: [int])

exclusive fn modal_poll(): int

exclusive fn modal_run(): int

exclusive fn message_box(title: string, text: string, kind: msgbox.MessageBoxKind): int

exclusive fn open(): bool

exclusive proc close()

exclusive proc do_step()

step and run are reserved words (for-loop step; AO run()).

exclusive fn run_loop(): int


Functions

fn empty_window(): window.Window

fn make_empty_term(): term.Term

fn is_modal_end_cmd(cmd: int): bool


Generated by reefc doc