[][src]Struct kas::event::Manager

pub struct Manager<'a> { /* fields omitted */ }

Manager of event-handling and toolkit actions

Methods

impl<'a> Manager<'a>[src]

pub fn handle_generic<W: ?Sized>(
    widget: &mut W,
    mgr: &mut Manager,
    event: Event
) -> Response<<W as Handler>::Msg> where
    W: Handler
[src]

Generic handler for low-level events passed to leaf widgets

impl<'a> Manager<'a>[src]

Public API (around toolkit functionality)

pub fn update_on_timer(&mut self, duration: Duration, w_id: WidgetId)[src]

Schedule an update

Widgets requiring animation should schedule an update; as a result, their Widget::update_timer method will be called, roughly at time now + duration.

Timings may be a few ms out, but should be sufficient for e.g. updating a clock each second. Very short positive durations (e.g. 1ns) may be used to schedule an update on the next frame. Frames should in any case be limited by vsync, avoiding excessive frame rates.

This should be called from Widget::configure or from an event handler. Note that scheduled updates are cleared if reconfigured.

pub fn update_on_handle(&mut self, handle: UpdateHandle, w_id: WidgetId)[src]

Subscribe to an update handle

All widgets subscribed to an update handle will have their Widget::update_handle method called when Manager::trigger_update is called with the corresponding handle.

This should be called from Widget::configure.

pub fn redraw(&mut self, _id: WidgetId)[src]

Notify that a widget must be redrawn

pub fn send_action(&mut self, action: TkAction)[src]

Notify that a TkAction action should happen

This causes the given action to happen after event handling.

Whenever a widget is added, removed or replaced, a reconfigure action is required. Should a widget's size requirements change, these will only affect the UI after a reconfigure action.

pub fn add_window(&mut self, widget: Box<dyn Window>) -> WindowId[src]

Add a window

Toolkits typically allow windows to be added directly, before start of the event loop (e.g. kas_wgpu::Toolkit::add).

This method is an alternative allowing a window to be added via event processing, albeit without error handling.

pub fn close_window(&mut self, id: WindowId)[src]

Close a window

pub fn trigger_update(&mut self, handle: UpdateHandle)[src]

Updates all subscribed widgets

All widgets subscribed to the given UpdateHandle, across all windows, will receive an update.

pub fn get_clipboard(&mut self) -> Option<String>[src]

Attempt to get clipboard contents

In case of failure, paste actions will simply fail. The implementation may wish to log an appropriate warning message.

pub fn set_clipboard(&mut self, content: String)[src]

Attempt to set clipboard contents

impl<'a> Manager<'a>[src]

Public API (around event manager state)

pub fn highlight_state(&self, w_id: WidgetId) -> HighlightState[src]

Get the complete highlight state

pub fn char_focus(&self, w_id: WidgetId) -> bool[src]

Get whether this widget has a grab on character input

pub fn key_focus(&self, w_id: WidgetId) -> bool[src]

Get whether this widget has keyboard focus

pub fn is_hovered(&self, w_id: WidgetId) -> bool[src]

Get whether the widget is under the mouse or finger

pub fn is_depressed(&self, w_id: WidgetId) -> bool[src]

Check whether the given widget is visually depressed

pub fn add_accel_key(&mut self, key: VirtualKeyCode, id: WidgetId)[src]

Adds an accelerator key for a widget

If this key is pressed when the window has focus and no widget has a key-grab, the given widget will receive an Action::Activate event.

This should be set from Widget::configure.

pub fn request_char_focus(&mut self, id: WidgetId)[src]

Request character-input focus

If successful, Action::ReceivedCharacter events are sent to this widget when character data is received.

Currently, this method always succeeds.

pub fn request_press_grab(
    &mut self,
    source: PressSource,
    widget: &dyn Widget,
    coord: Coord
) -> bool
[src]

Request a mouse grab on the given source

If successful, corresponding move/end events will be forwarded to the given w_id. The grab automatically ends after the end event. Since these events are requested, the widget should consume them even if e.g. the move events are not needed (although in practice this only affects parents intercepting Response::Unhandled events).

This method normally succeeds, but fails when multiple widgets attempt a grab the same press source simultaneously (only the first grab is successful).

This method automatically cancels any active char grab and updates keyboard navigation focus.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Manager<'a>

impl<'a> !Send for Manager<'a>

impl<'a> !Sync for Manager<'a>

impl<'a> Unpin for Manager<'a>

impl<'a> !UnwindSafe for Manager<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.