GPUI.View behaviour (gpui v0.2.0-rc.1)

Copy Markdown View Source

Behaviour for Elixir-rendered GPUI views.

Views render from assigns, handle native input through handle_event/3, and receive supervised application updates through handle_info/2 when a caller uses GPUI.Runtime.send_view/3.

Summary

Types

callback_result()

@type callback_result() ::
  {:noreply, map()}
  | {:close, map()}
  | {:open_window, GPUI.WindowSpec.t(), map()}
  | {:close_window, GPUI.WindowSpec.key() | pos_integer(), map()}

window_event()

@type window_event() :: :close_request | :focus | :blur

Callbacks

handle_event(t, map, map)

@callback handle_event(String.t(), map(), map()) :: callback_result()

handle_info(term, map)

(optional)
@callback handle_info(term(), map()) :: callback_result()

handle_window_event(window_event, map, map)

(optional)
@callback handle_window_event(window_event(), map(), map()) ::
  {:noreply, map()} | {:close, map()}

render(map)

@callback render(map()) :: GPUI.Element.t()