pub enum Event {
Show 53 variants
Startup,
Shutdown,
Foreground,
Background,
Resume,
Pause,
Draw(DrawEvent),
LiveEdit,
AppGotFocus,
AppLostFocus,
NextFrame(NextFrameEvent),
XrUpdate(XrUpdateEvent),
XrLocal(XrLocalEvent),
WindowDragQuery(WindowDragQueryEvent),
WindowCloseRequested(WindowCloseRequestedEvent),
WindowClosed(WindowClosedEvent),
WindowGeomChange(WindowGeomChangeEvent),
VirtualKeyboard(VirtualKeyboardEvent),
ClearAtlasses,
MouseDown(MouseDownEvent),
MouseMove(MouseMoveEvent),
MouseUp(MouseUpEvent),
MouseLeave(MouseLeaveEvent),
TouchUpdate(TouchUpdateEvent),
LongPress(LongPressEvent),
Scroll(ScrollEvent),
Timer(TimerEvent),
Signal,
Trigger(TriggerEvent),
MacosMenuCommand(LiveId),
KeyFocus(KeyFocusEvent),
KeyFocusLost(KeyFocusEvent),
KeyDown(KeyEvent),
KeyUp(KeyEvent),
TextInput(TextInputEvent),
TextCopy(TextClipboardEvent),
TextCut(TextClipboardEvent),
Drag(DragEvent),
Drop(DropEvent),
DragEnd,
Actions(Vec<Box<dyn ActionTrait>>),
AudioDevices(AudioDevicesEvent),
MidiPorts(MidiPortsEvent),
VideoInputs(VideoInputsEvent),
NetworkResponses(Vec<NetworkResponseItem>),
VideoPlaybackPrepared(VideoPlaybackPreparedEvent),
VideoTextureUpdated(VideoTextureUpdatedEvent),
VideoPlaybackCompleted(VideoPlaybackCompletedEvent),
VideoPlaybackResourcesReleased(VideoPlaybackResourcesReleasedEvent),
VideoDecodingError(VideoDecodingErrorEvent),
TextureHandleReady(TextureHandleReadyEvent),
BackPressed {
handled: Cell<bool>,
},
DesignerPick(DesignerPickEvent),
}
Expand description
Events that can be sent between the Makepad framework and the application.
Variants§
Startup
The application has just been created.
- This event is always sent exactly once (before any other event) at the very beginning of the application lifecycle.
- This is a good point for one-time initialization of application state, resources, tasks, etc.
Platform | Lifecycle Function/Callback |
---|---|
Android | onCreate |
others | coming soon… |
Shutdown
The application is being shut down is about to close and be destroyed.
- This event may not be sent at all, so you should not rely on it.
- For example, some mobile platforms do not always send this event when closing the app.
- Desktop platforms do typically send this event when the user closes the application.
- If it is sent, it will be sent only once at the end of the application lifecycle.
Platform | Lifecycle Function/Callback |
---|---|
Android | onDestroy |
others | coming soon… |
Foreground
The application has been started in the foreground and is now visible to the user, but is not yet actively receiving user input.
- This event can be sent multiple times over the course of the application’s lifecycle.
- For example, it will be sent right after
Startup
has been sent at the beginning of the application. - It can also be sent after
Stop
if the user starts the application again by navigating back to the application. - It will be sent when the application was re-opened and shown again after being previously hidden in the background.
- For example, it will be sent right after
Platform | Lifecycle Function/Callback |
---|---|
Android | [onStart ] |
others | coming soon… |
[onStart
]: https://developer.android.com/reference/android/app/Activity#onStart(
Background
The application has been hidden in the background and is no longer visible to the user.
- This event may be sent multiple times over the course of the application’s lifecycle.
- For example, it can be sent after
Pause
has been sent, i.e., when the user navigates away from the application, causing it to be no longer visible.
- For example, it can be sent after
- This is a good point to stop updating the UI/animations and other visual elements.
Platform | Lifecycle Function/Callback |
---|---|
Android | onStop |
others | coming soon… |
Resume
The application is now in the foreground and being actively used, i.e., it is receiving input from the user.
- This event may be sent multiple times over the course of the application’s lifecycle.
- For example, it will be sent after
Start
once the application is fully in the foreground. It can also be sent afterPause
, once the user navigates back to the application.
- For example, it will be sent after
Platform | Lifecycle Function/Callback |
---|---|
Android | onResume |
others | coming soon… |
Pause
The application has been temporarily paused and is still visible in the foregound, but is not actively receiving input from the user.
- This event may be sent multiple times over the course of the application’s lifecycle.
- This is a good point to save temporary application states in case the application is about to be stopped or destroyed.
Platform | Lifecycle Function/Callback |
---|---|
Android | onPause |
others | coming soon… |
Draw(DrawEvent)
LiveEdit
AppGotFocus
The application has gained focus and is now the active window receiving user input.
AppLostFocus
The application has lost focus and is no longer the active window receiving user input.
NextFrame(NextFrameEvent)
XrUpdate(XrUpdateEvent)
XrLocal(XrLocalEvent)
WindowDragQuery(WindowDragQueryEvent)
WindowCloseRequested(WindowCloseRequestedEvent)
WindowClosed(WindowClosedEvent)
WindowGeomChange(WindowGeomChangeEvent)
VirtualKeyboard(VirtualKeyboardEvent)
ClearAtlasses
MouseDown(MouseDownEvent)
The raw event that occurs when the user presses a mouse button down.
Do not match upon or handle this event directly; instead, use the family of
hit`` functions ([
Event::hits()]) and handle the returned [
Hit::FingerDown`].
MouseMove(MouseMoveEvent)
The raw event that occurs when the user moves the mouse.
Do not match upon or handle this event directly; instead, use the family of
hit
functions (Event::hits()
) and handle the returned Hit
.
MouseUp(MouseUpEvent)
The raw event that occurs when the user releases a previously-pressed mouse button.
Do not match upon or handle this event directly; instead, use the family of
hit
functions (Event::hits()
) and handle the returned Hit::FingerUp
.
MouseLeave(MouseLeaveEvent)
The raw event that occurs when the user moves the mouse outside of the window.
Do not match upon or handle this event directly; instead, use the family of
hit
functions (Event::hits()
) and handle the returned [Hit::FingerOverOut
].
TouchUpdate(TouchUpdateEvent)
The raw event that occurs when the user touches the screen.
Do not match upon or handle this event directly; instead, use the family of
hit
functions (Event::hits()
) and handle the returned Hit
.
LongPress(LongPressEvent)
The raw event that occurs when the user finishes a long press touch/click.
Do not match upon or handle this event directly; instead, use the family of
hit
functions (Event::hits()
) and handle the returned Hit::FingerLongPress
.
Scroll(ScrollEvent)
The raw event that occurs when the user scrolls, e.g., by using the mouse wheel or a touch flick.
Do not match upon or handle this event directly; instead use the family of
hit
functions (Event::hits()
) and handle the returned Hit::FingerScroll
.
Timer(TimerEvent)
Signal
Trigger(TriggerEvent)
MacosMenuCommand(LiveId)
KeyFocus(KeyFocusEvent)
KeyFocusLost(KeyFocusEvent)
KeyDown(KeyEvent)
KeyUp(KeyEvent)
TextInput(TextInputEvent)
TextCopy(TextClipboardEvent)
TextCut(TextClipboardEvent)
Drag(DragEvent)
Drop(DropEvent)
DragEnd
Actions(Vec<Box<dyn ActionTrait>>)
AudioDevices(AudioDevicesEvent)
MidiPorts(MidiPortsEvent)
VideoInputs(VideoInputsEvent)
NetworkResponses(Vec<NetworkResponseItem>)
VideoPlaybackPrepared(VideoPlaybackPreparedEvent)
VideoTextureUpdated(VideoTextureUpdatedEvent)
VideoPlaybackCompleted(VideoPlaybackCompletedEvent)
VideoPlaybackResourcesReleased(VideoPlaybackResourcesReleasedEvent)
VideoDecodingError(VideoDecodingErrorEvent)
TextureHandleReady(TextureHandleReadyEvent)
BackPressed
The “go back” navigational button or gesture was performed.
Tip: use the [Event::consume_back_pressed()
] method to handle this event
instead of matching on it directly.
Once a widget has handled this event, it should set the handled
flag to true
to ensure that a single “go back” action is not handled multiple times.
DesignerPick(DesignerPickEvent)
Implementations§
Source§impl Event
impl Event
pub fn name(&self) -> &'static str
pub fn name_from_u32(v: u32) -> &'static str
pub fn to_u32(&self) -> u32
Sourcepub fn back_pressed(&self) -> bool
pub fn back_pressed(&self) -> bool
A convenience function to check if the event is a [BackPressed
] event
that has not yet been handled, and then mark it as handled.
Returns true
if the event was a [BackPressed
] event that wasn’t already handled.