package nottui

  1. Overview
  2. Docs

Module Nottui.FocusSource

Sourcetype handle

A handle represents a primitive area that can request, receive and lose the focus. A visible UI is made of many handles, of which at most one can be active.

Sourceval make : unit -> handle

Create a new handle

Sourceval request : handle -> unit

Request the focus

Sourceval release : handle -> unit

Release the focus (if the handle has it)

Sourcetype status

status represents the state in which a handle can be. Externally we care about having or not the focus, which can be queried with the has_focus function. Internally, status also keeps track of conflicts (if multiple handles requested the focus).

Sourceval empty : status

A status that has no focus and no conflicts

Sourceval status : handle -> status Lwd.t

Get the status of a focus handle. The status is a reactive value: it will evolve over time, as focus is received or lost.

Sourceval has_focus : status -> bool

Check if this status corresponds to an active focus

TODO This implements a more general concept of "reactive auction":

  • multiple parties are competing for a single resource (focus here, but for instance a tab component can only display a single tab among many).
  • the result can evolve over time, parties can join or leave, or bid "more".
OCaml

Innovation. Community. Security.