package stk

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Stk.WkeySource

Convenient functions to handle key press events in widgets.

Setting handlers for simple key press events.

Sourceval add : Widget.widget -> ?cond:(unit -> bool) -> Key.keystate -> (unit -> unit) -> unit

add widget keystate callback associates the callback function to the event "key_press" with the given keystate for the given widget.

The optional parameter conf is a guard: the callback function is not called if the cond function returns false. The default cond function always returns true.

Sourceval add_list : Widget.widget -> ?cond:(unit -> bool) -> Key.keystate list -> (unit -> unit) -> unit

add_list widget ?cond list callback calls add widget ?cond ks callback for each keystate ks of the given list.

Sourceval set : Widget.widget -> ?cond:(unit -> bool) -> Key.keystate -> (unit -> unit) -> unit

Like add but the previous handlers for the given keystate are not kept.

Sourceval set_list : Widget.widget -> ?cond:(unit -> bool) -> Key.keystate list -> (unit -> unit) -> unit

set_list widget ?cond list callback calls set widget ?cond ks callback for each keystate ks of the given list.

Setting handlers for combination of key press events, a la emacs

Sourcetype handler
Sourceval ignored_keys : Tsdl.Sdl.keycode list ref

The keys which are ignored when they are pressed alone.

Sourcetype keyhit_state = (Tsdl.Sdl.keymod * Tsdl.Sdl.keycode) list
Sourcetype handler_tree_node =
  1. | Handler of handler
  2. | Node of handler_tree list
Sourceand handler_tree = {
  1. mutable hst_spec : Key.keystate;
  2. mutable hst_v : handler_tree_node;
}
Sourceval string_of_handler_trees : handler_tree list -> string
Sourceval pp_handler_trees : Format.formatter -> handler_tree list -> unit
Sourceval reset_state : Widget.widget -> unit
Sourceval set_handler_trees : ?stop:Key.keystate -> (unit -> handler_tree list) -> ?display_state:(after_handler:bool -> keyhit_state -> unit) -> Widget.widget -> unit
Sourceval handler : ?cond:(unit -> bool) -> (unit -> unit) -> handler
Sourceval trees_of_list : (Key.keystate list * (unit -> unit)) list -> handler_tree list
Sourceval string_of_keyhit_state : keyhit_state -> string
Sourceval pp_keyhit_state : Format.formatter -> keyhit_state -> unit
OCaml

Innovation. Community. Security.