Stk.WidgetSourceWidget base class.
Keys to make focus circulate between widgets:
Keys to move focus to next widget.
Keys to move focus to previous widget.
This representation of widget tree is used for debugging.
val pp_tree :
(Format.formatter -> 'a -> unit) ->
?indent:string ->
Format.formatter ->
'a tree ->
unitButton 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.
Drop (filename or text) event, with mouse coordinates.
type Events.ev += | Clicked : (button_ev -> bool) Events.evA click occured in widget (press and release button).
*)| Activated : (unit -> unit) Events.evThe widget was activated, like a menu item or a button.
*)| Button_pressed : (button_ev -> bool) Events.evA button was pressed in widget.
*)| Button_released : (button_ev -> bool) Events.evA button was released in widget.
*)| Key_pressed : (key_ev -> bool) Events.evA key was pressed in a focused widget.
*)| Key_released : (key_ev -> bool) Events.evA key was released in a focused widget.
*)| Mouse_enter : (unit -> bool) Events.evMouse cursor entered the widget.
*)| Mouse_leave : (unit -> bool) Events.evMouse cursor leaved the widget.
*)| Mouse_motion : (mouse_motion_ev -> bool) Events.evMouse moved over the widget.
*)| Destroy : (unit -> bool) Events.evWidget is being destroyed.
*)| Geometry_changed : (unit -> unit) Events.evGeometry of widget changed.
*)| File_dropped : (drop_ev -> bool) Events.evA file is drag'n'dropped on widget
*)| Text_dropped : (drop_ev -> bool) Events.evText is drag'n'dropped on widget
*)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.
This extensible type is used to add constructor for each widget. The widget has a method typ returning an optional value of this type. When only values of class widget are available, this method can be used to retrieve the object corresponding to the widget type and use its specific methods.
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 : ?classes:string list option -> ?name:string option -> ?props:Props.t option -> ?wdata:
wdata
option -> unit -> object ... endThe 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 Scrollbox.scrollbox):
classes specifies the classes of the widget. This is used to retrieve its default properties when theming. Some widgets have default classes, some have classes depending on property values (like Props.orientation.name specifies the name of the widget. This is useful for debugging purposes and is also used in theming.props specifies properties to use in addition to the default properties associated to kind, classes and name when theme is applied. 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.
pp ppf w prints w#me to formater ppf.
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.