Module conrod::event
[−]
[src]
Contains all types used to describe the input events that Widgets may handle.
The two primary types of this module are:
Input: conrod's input type passed by the user toUi::handle_eventin order to drive theUi.Event: enumerates all possible events interpreted by conrod that may be propagated to widgets.
The Event System
Conrod's event system looks like this:
Input -> Ui -> Event -> Widget
The Ui receives Inputs such as Press and Release via the Ui::handle_event method.
It interprets these Inputs to create higher-level Events such as DoubleClick,
WidgetCapturesKeyboard, etc. These Events are stored and then fed to each Widget when
Ui::set_widgets is called. At the end of Ui::set_widgets the stored Events are flushed
ready for the next incoming Inputs.
Conrod uses the pistoncore-input crate's Input type. There are a few reasons for this:
- This
Inputtype already provides a number of useful variants of events that we wish to provide and handle within conrod, and we do not yet see any great need to re-write it and duplicate code. - The
Inputtype is already compatible with allpistoncore-windowbackends includingglfw_window,sdl2_windowandglutin_window. That said, co-ordinates and scroll directions may need to be translated to conrod's orientation. - The
pistoncore-inputcrate also provides aGenericEventtrait which allows us to easily provide a blanket implementation ofToRawEventfor all event types that already implement this trait.
Because we use the pistoncore-input Event type, we also re-export its associated data
types (Button, ControllerAxisArgs, Key, etc).
Structs
| Click |
Contains all the relevant information for a mouse click. |
| DoubleClick |
Contains all the relevant information for a double click. |
| Drag |
Contains all the relevant information for a mouse drag. |
| KeyPress |
Contains all relevant information for the event where a keyboard button was pressed. |
| KeyRelease |
Contains all relevant information for the event where a keyboard button was release. |
| MousePress |
Contains all relevant information for the event where a mouse button was pressed. |
| MouseRelease |
Contains all relevant information for the event where a mouse button was released. |
| Move |
Contains all relevant information for a Motion event. |
| Press |
Contains all relevant information for a Press event. |
| Release |
Contains all relevant information for a Release event. |
| Scroll |
Holds all the relevant information about a scroll event |
| Text |
Contains all relevant information for a Text event. |
Enums
| Button |
The different kinds of |
| Event |
Enum containing all the events that the |
| Input |
Models input events. |
| Motion |
Models different kinds of motion. |
| Ui |
Represents all events interpreted by the |
| Widget |
Events that apply to a specific widget. |