Struct druid::DruidHandler

source ·
pub struct DruidHandler<T> { /* private fields */ }
Expand description

The struct implements the druid-shell WinHandler trait.

One DruidHandler exists per window.

This is something of an internal detail and possibly we don’t want to surface it publicly.

Trait Implementations§

source§

impl<T: Data> WinHandler for DruidHandler<T>

source§

fn connect(&mut self, handle: &WindowHandle)

Provide the handler with a handle to the window so that it can invalidate or make other requests. Read more
source§

fn prepare_paint(&mut self)

Request the handler to prepare to paint the window contents. In particular, if there are any regions that need to be repainted on the next call to paint, the handler should invalidate those regions by calling WindowHandle::invalidate_rect or WindowHandle::invalidate.
source§

fn paint(&mut self, piet: &mut Piet<'_>, region: &Region)

Request the handler to paint the window contents. invalid is the region in display points that needs to be repainted; painting outside the invalid region will have no effect.
source§

fn size(&mut self, size: Size)

Called when the size of the window has changed. Read more
source§

fn scale(&mut self, scale: Scale)

Called when the scale of the window has changed. Read more
source§

fn command(&mut self, id: u32)

Called when a menu item is selected.
source§

fn save_as(&mut self, token: FileDialogToken, file_info: Option<FileInfo>)

Called when a “Save As” dialog is closed. Read more
source§

fn open_file(&mut self, token: FileDialogToken, file_info: Option<FileInfo>)

Called when an “Open” dialog is closed. Read more
source§

fn open_files(&mut self, token: FileDialogToken, file_info: Vec<FileInfo>)

Called when an “Open” dialog with multiple selection is closed. Read more
source§

fn mouse_down(&mut self, event: &MouseEvent)

Called on mouse button down.
source§

fn mouse_up(&mut self, event: &MouseEvent)

Called on mouse button up.
source§

fn mouse_move(&mut self, event: &MouseEvent)

Called when the mouse moves.
source§

fn mouse_leave(&mut self)

Called when the mouse cursor has left the application window
source§

fn key_down(&mut self, event: KeyEvent) -> bool

Called on a key down event. Read more
source§

fn key_up(&mut self, event: KeyEvent)

Called when a key is released. This corresponds to the WM_KEYUP message on Windows, or keyUp(withEvent:) on macOS.
source§

fn wheel(&mut self, event: &MouseEvent)

Called on a mouse wheel event. Read more
source§

fn zoom(&mut self, delta: f64)

Called when a platform-defined zoom gesture occurs (such as pinching on the trackpad).
source§

fn got_focus(&mut self)

Called when this window becomes the focused window.
source§

fn timer(&mut self, token: TimerToken)

Called on timer event. Read more
source§

fn idle(&mut self, token: IdleToken)

Called when a idle token is requested by IdleHandle::schedule_idle() call.
source§

fn as_any(&mut self) -> &mut dyn Any

Get a reference to the handler state. Used mostly by idle handlers.
source§

fn acquire_input_lock( &mut self, token: TextFieldToken, mutable: bool ) -> Box<dyn InputHandler>

Take a lock for the text document specified by token. Read more
source§

fn release_input_lock(&mut self, token: TextFieldToken)

Release a lock previously acquired by acquire_input_lock.
source§

fn request_close(&mut self)

Called when the shell requests to close the window, for example because the user clicked the little “X” in the titlebar. Read more
source§

fn destroy(&mut self)

Called when the window is being destroyed. Note that this happens earlier in the sequence than drop (at WM_DESTROY, while the latter is WM_NCDESTROY).
source§

fn rebuild_resources(&mut self)

Called when the resources need to be rebuilt. Read more
source§

fn lost_focus(&mut self)

Called when this window stops being the focused window.

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for DruidHandler<T>

§

impl<T> !Send for DruidHandler<T>

§

impl<T> !Sync for DruidHandler<T>

§

impl<T> Unpin for DruidHandler<T>

§

impl<T> !UnwindSafe for DruidHandler<T>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

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

const: unstable · 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.

§

impl<T> RoundFrom<T> for T

§

fn round_from(x: T) -> T

Performs the conversion.
§

impl<T, U> RoundInto<U> for Twhere U: RoundFrom<T>,

§

fn round_into(self) -> U

Performs the conversion.
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more