Stk.Widget
Widget base class.
Keys to make focus circulate between widgets:
val focus_next_keys : Key.keystate Stdlib.ref
Keys to move focus to next widget.
val focus_prev_keys : Key.keystate Stdlib.ref
Keys to move focus to previous widget.
This representation of widget tree is used for debugging.
val pp_tree :
(Stdlib.Format.formatter -> 'a -> unit) ->
?indent:string ->
Stdlib.Format.formatter ->
'b tree ->
unit
Button event (press, release, click) holding the original SDL event and fields with the button and coordinates of mouse cursor in event.
Mouse motion event holding the original SDL event and the coordinates of the mouse cursor in event.
Key event (press or release) with the origina SDL event, the concerned key and the activated modifiers.
type Events.ev +=
| Clicked : (button_ev -> bool) Events.ev
A click occured in widget (press and release button).
*)| Activated : (unit -> unit) Events.ev
The widget was activated, like a menu item or a button.
*)| Button_pressed : (button_ev -> bool) Events.ev
A button was pressed in widget.
*)| Button_released : (button_ev -> bool) Events.ev
A button was released in widget.
*)| Key_pressed : (key_ev -> bool) Events.ev
A key was pressed in a focused widget.
*)| Key_released : (key_ev -> bool) Events.ev
A key was released in a focused widget.
*)| Mouse_enter : (unit -> bool) Events.ev
Mouse cursor entered the widget.
*)| Mouse_leave : (unit -> bool) Events.ev
Mouse cursor leaved the widget.
*)| Mouse_motion : (mouse_motion_ev -> bool) Events.ev
Mouse moved over the widget.
*)| Destroy : (unit -> bool) Events.ev
Widget is being destroyed.
*)| Geometry_changed : (unit -> unit) Events.ev
Geometry of widget changed.
*)Events common to all widgets. Extend the Events.ev
type so that callbacks can be registered to be called when a widget triggers an event.
A widget can hold an optional value of the wdata
extensible type. This is useful to store application specific data directly in some widgets rather than storing them in a map aside.
class virtual widget : ?class_:string option -> ?name:string option -> ?props:Props.t option ->
unit -> object ... end
The base widget class. It contains methods to be called by children widgets, event if the base class does not handle child widgets.
All widget classes handle the following optional arguments, which are handled by the convenient functions provided to create widgets (like Bin.scrollbox
):
class_
specifies the class name of the widget. This is used to retrieve its default properties. The default class_
of a widget is defined by its class. class_
for a widget class is usually set to the same name as the class; for example, Bin.scrollbox
widgets have a default class_
set to "scrollbox"
.name
specifies the name of the widget. This is useful for debugging purposes and default properties can also be associated to names. Default name
is equal to class_
value.props
specifies properties to use in addition to the default properties associated to class_
and name
. Propertes props
are merged with the default properties, with Props.merge
. This is useful to override or add some properties at widget creation.Convenient functions also handle a pack
optional argument. It is a function called with the created widget coerced to widget
type, and is usually used to pack or add the created widget to another one.
pp_widget_tree ppf w
pretty-prints widget w
and its children to formatter ppf
, with some properties. This is for debugging purpose.
may_pack ?pack w
will apply the pack
function if provided, to widget w
. This is used by convenient functions, usually to pack a creatd widget, hence the name.
val widget_prop :
?after:widget Stk__Props.post_action list ->
?default:widget ->
?inherits:bool ->
string ->
widget Stk__Props.prop
A function to create a property holding a widget.
module Set : sig ... end
Set of widgets.
module Map : sig ... end
Map with widgets as keys.