module Trigger:sig
..end
Dealing with events.
Events are simply SDL events, plus a few additional events. They are also used for primitive communication between threads.
Events are detected by Layouts, and then sent to the resident
Widget. Finally, the Widget decides what to do with the events. There is one
exception: the Trigger.startup
event is directly sent to all Widgets.
typet =
Tsdl.Sdl.event_type
val text_input : t
Same as Tsdl.Sdl.Event.text_input
val key_down : t
Same as Tsdl.Sdl.Event.key_down
val key_up : t
Same as Tsdl.Sdl.Event.key_up
val startup : t
The startup
event is sent to all Widgets when the Bogue mainloop is
started using Main.run
.
val mouse_enter : t
The mouse_enter
event is triggered when the pointer (mouse motion, or
finger touch -- but not finger drag) enters a new layout.
val mouse_leave : t
Similar to Trigger.mouse_enter
, when the pointer leaves the layout.
val mouse_at_rest : t
Triggered when the mouse did not move for a while.
val var_changed : t
The var_changed
event can be sent to notify that some widget made a
change to a global variable.
val update : t
Currently the update
event is more or less equivalent to
var_changed
. This might change in future versions.
val user_event : t
Same as Tsdl.Sdl.Event.user_event
. This special event of type
SDL_UserEvent can trigger a global reaction, not associated with any
widget in particular, through the on_user_event
parameter of
Main.create
t list
: A list of events containing the mouse_button_down event, and the finger_down event.
t list
: A list of events containing the mouse_button_up event, and the finger_up event.
val pointer_motion : t list
A list of events containing the mouse_motion event, and the finger_motion event.
val should_exit : Tsdl.Sdl.event -> bool
Tell if the current thread should exit. This should only be called within a widget action. The event should be the event passed to the action function. A well programmed action should check this event to decide if it should exit.
val will_exit : Tsdl.Sdl.event -> unit
A nice thread should do this just before terminating. May be suppressed in future versions.
val nice_delay : Tsdl.Sdl.event -> float -> unit
nice_delay ev t
Wait during a delay (t
seconds), but quit anyway when
Trigger.should_exit
ev
is true.
val push_quit : unit -> unit
Send the SDL_QUIT event, as if the user clicked on the close button of the
last existing window. It will in principle raise the Main.Exit
exception and hence exit the mainloop.
val wait_for : ?timeout:float -> ?ev:Tsdl.Sdl.event -> (unit -> bool) -> unit
typesdl_event =
Tsdl.Sdl.Event.enum
typebogue_event =
[ `Bogue_destroy_window
| `Bogue_keyboard_focus
| `Bogue_keymap_changed
| `Bogue_mouse_at_rest
| `Bogue_mouse_enter
| `Bogue_mouse_focus
| `Bogue_mouse_leave
| `Bogue_redraw
| `Bogue_remove_focus
| `Bogue_startup
| `Bogue_stop
| `Bogue_stopped
| `Bogue_sync_action
| `Bogue_update
| `Bogue_var_changed ]
val event_kind : Tsdl.Sdl.event ->
[ `App_did_enter_background
| `App_did_enter_foreground
| `App_low_memory
| `App_terminating
| `App_will_enter_background
| `App_will_enter_foreground
| `Audio_device_added
| `Audio_device_removed
| `Bogue_destroy_window
| `Bogue_keyboard_focus
| `Bogue_keymap_changed
| `Bogue_mouse_at_rest
| `Bogue_mouse_enter
| `Bogue_mouse_focus
| `Bogue_mouse_leave
| `Bogue_redraw
| `Bogue_remove_focus
| `Bogue_startup
| `Bogue_stop
| `Bogue_stopped
| `Bogue_sync_action
| `Bogue_update
| `Bogue_var_changed
| `Clipboard_update
| `Controller_axis_motion
| `Controller_button_down
| `Controller_button_up
| `Controller_device_added
| `Controller_device_remapped
| `Controller_device_removed
| `Display_event
| `Dollar_gesture
| `Dollar_record
| `Drop_begin
| `Drop_complete
| `Drop_file
| `Drop_text
| `Finger_down
| `Finger_motion
| `Finger_up
| `Joy_axis_motion
| `Joy_ball_motion
| `Joy_button_down
| `Joy_button_up
| `Joy_device_added
| `Joy_device_removed
| `Joy_hat_motion
| `Key_down
| `Key_up
| `Keymap_changed
| `Mouse_button_down
| `Mouse_button_up
| `Mouse_motion
| `Mouse_wheel
| `Multi_gesture
| `Quit
| `Render_device_reset
| `Render_targets_reset
| `Sensor_update
| `Sys_wm_event
| `Text_editing
| `Text_input
| `Unknown of int
| `User_event
| `Window_event ]
Union of Trigger.sdl_event
and Trigger.bogue_event