Module Stk.Object

Objects.

Class o is the base class for widget and other classes which can trigger events and hold properties Props.props.

type Events.ev +=
  1. | Prop_changed : 'a Props.prop -> (prev:'a option -> now:'a -> unit) Events.ev

Introduce the Prop_changed property to register callbacks called when the value of a given property changed. Previous and current values of the property are passed to the callback.

type id = Oid.t

Object id. Each object of o is given a unique id.

val transition_step_delay : int

Transition step minimum delay, in milliseconds.

class o : ?props:Props.t option -> unit -> object ... end

An object. See Widget arguments for props arguments.

val add_mirror : src:(o * 'a Props.prop) -> dst:(o * 'b Props.prop) -> map_to:('a -> 'b) -> map_from:('b -> 'a) -> Events.callback_id * Events.callback_id

add_mirror ~src:(object1,prop1) ~dst:(object2,prop2) ~map_to ~map_from registers event handlers to that a change on prop1 in object1 triggers a change of propery prop2 of object2, using map_to to map the new value of prop1 to the value given to prop2, and conversely (using map_from). The function returns the event handlers on object1 and object2, so that this mirror can be removed using object1#disconnect id1; object2#disconnect id2.

val add_mirror_id : src:(o * 'a Props.prop) -> dst:(o * 'a Props.prop) -> Events.callback_id * Events.callback_id

Same as add_mirror, using Fun.id as mappers, i.e. when both properties have the same time and meaning.

val app : o

Application object. Can be used to register callbacks on some global events. It is used to handle mouse motion and button release events for scrollboxes, ranges and paned, when we must track mouse motion event outside a widget until button is released.