package miaou-core
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=60a3b9f181f24572a06a9492532bfdda
sha512=fcc35a275066be2900e6201782faf47503076fa4640f08cf78067835a6f447b74613009e55b2ac799adb7ca46f1bffa261fc5971753f2cc3c6bef327511c7ef6
doc/miaou-core.internals/Miaou_internals/Focus_container/index.html
Module Miaou_internals.Focus_containerSource
Focus container: GADT-based heterogeneous widget container.
Holds a Focus_ring.t and a list of existentially packed widget slots. Tab/Shift+Tab cycle focus; other keys are routed to the focused widget automatically.
let c = FC.create [
FC.slot "enable" checkbox_ops (Checkbox_widget.create ());
FC.slot "name" textbox_ops (Textbox_widget.create ());
FC.slot "go" button_ops (Button_widget.create ~label:"Go"
~on_click:ignore ());
]
let c', result = FC.on_key c ~key:"Tab"type 'a widget_ops = {render : 'a -> focus:bool -> string;on_key : 'a -> key:string -> 'a * Miaou_interfaces.Key_event.result;
}Widget operations record -- uniform interface for any widget type.
Existentially packed widget slot.
Create a named slot.
The container type.
Create from a list of slots. Focus ring built from slot IDs.
Handle a key. Tab/Shift+Tab cycle focus; other keys route to the focused widget. Returns Key_event.result.
Render all widgets: (id, focused, rendered_string) in order.
Access the underlying focus ring (for scope nesting).
Replace the focus ring.
Type-safe extraction via witness
Adapter constructors
val ops :
render:('a -> focus:bool -> string) ->
on_key:('a -> key:string -> 'a * Miaou_interfaces.Key_event.result) ->
'a widget_opsCreate widget_ops from render and on_key functions.
val ops_simple :
render:('a -> focus:bool -> string) ->
handle_key:('a -> key:string -> 'a) ->
'a widget_opsval ops_bool :
render:('a -> focus:bool -> string) ->
handle_key:('a -> key:string -> 'a * bool) ->
'a widget_opsAdapter: wrap legacy handle_key returning polymorphic variant.