Enum Event

Source
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.
PlatformLifecycle Function/Callback
AndroidonCreate
otherscoming 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.
PlatformLifecycle Function/Callback
AndroidonDestroy
otherscoming 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.
PlatformLifecycle Function/Callback
Android[onStart]
otherscoming 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.
  • This is a good point to stop updating the UI/animations and other visual elements.
PlatformLifecycle Function/Callback
AndroidonStop
otherscoming 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 after Pause, once the user navigates back to the application.
PlatformLifecycle Function/Callback
AndroidonResume
otherscoming 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.
PlatformLifecycle Function/Callback
AndroidonPause
otherscoming 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.

Fields

§handled: Cell<bool>
§

DesignerPick(DesignerPickEvent)

Implementations§

Source§

impl Event

Source

pub fn name(&self) -> &'static str

Source

pub fn name_from_u32(v: u32) -> &'static str

Source

pub fn to_u32(&self) -> u32

Source

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.

Source§

impl Event

Source§

impl Event

Source

pub fn unhandle(&self, cx: &mut Cx, area: &Area)

Source§

impl Event

Source

pub fn hits(&self, cx: &mut Cx, area: Area) -> Hit

Source

pub fn hits_with_test<F>(&self, cx: &mut Cx, area: Area, hit_test: F) -> Hit
where F: Fn(DVec2, &Rect, &Option<Margin>) -> bool,

Source

pub fn hits_with_sweep_area( &self, cx: &mut Cx, area: Area, sweep_area: Area, ) -> Hit

Source

pub fn hits_with_capture_overload( &self, cx: &mut Cx, area: Area, capture_overload: bool, ) -> Hit

Source

pub fn hits_with_options( &self, cx: &mut Cx, area: Area, options: HitOptions, ) -> Hit

Source

pub fn hits_with_options_and_test<F>( &self, cx: &mut Cx, area: Area, options: HitOptions, hit_test: F, ) -> Hit
where F: Fn(DVec2, &Rect, &Option<Margin>) -> bool,

Source§

impl Event

Source

pub fn drag_hits(&self, cx: &mut Cx, area: Area) -> DragHit

Source

pub fn drag_hits_with_options( &self, cx: &mut Cx, area: Area, options: HitOptions, ) -> DragHit

Source§

impl Event

Source

pub fn hit_designer(&self, cx: &mut Cx, area: Area) -> HitDesigner

Trait Implementations§

Source§

impl Debug for Event

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Event

§

impl !RefUnwindSafe for Event

§

impl !Send for Event

§

impl !Sync for Event

§

impl Unpin for Event

§

impl !UnwindSafe for Event

Blanket Implementations§

Source§

impl<T> ActionTrait for T
where T: 'static + Debug + ?Sized,

Source§

fn debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Source§

fn ref_cast_type_id(&self) -> TypeId
where Self: 'static,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.