Trait kas::widgets::AdaptWidget

source ·
pub trait AdaptWidget: Widget + Sized {
    // Provided methods
    fn map<A, F>(self, f: F) -> Map<A, Self, F>
       where F: for<'a> Fn(&'a A) -> &'a Self::Data { ... }
    fn on_configure<F>(self, f: F) -> AdaptEvents<Self>
       where F: Fn(&mut AdaptConfigCx<'_, '_>, &mut Self) + 'static { ... }
    fn on_update<F>(self, f: F) -> AdaptEvents<Self>
       where F: Fn(&mut AdaptConfigCx<'_, '_>, &mut Self, &Self::Data) + 'static { ... }
    fn on_message<M, H>(self, handler: H) -> AdaptEvents<Self>
       where M: Debug + 'static,
             H: Fn(&mut AdaptEventCx<'_, '_>, &mut Self, M) + 'static { ... }
    fn on_messages<H>(self, handler: H) -> AdaptEvents<Self>
       where H: Fn(&mut AdaptEventCx<'_, '_>, &mut Self, &Self::Data) + 'static { ... }
    fn with_min_size_px(self, w: i32, h: i32) -> Reserve<Self> { ... }
    fn with_min_size_em(self, w: f32, h: f32) -> Reserve<Self> { ... }
    fn with_label<D, T>(self, direction: D, label: T) -> WithLabel<Self, D>
       where D: Directional,
             T: Into<AccessString> { ... }
}
Expand description

Provides some convenience methods on widgets

Provided Methods§

source

fn map<A, F>(self, f: F) -> Map<A, Self, F>
where F: for<'a> Fn(&'a A) -> &'a Self::Data,

Map data type via a function

Returns a wrapper around the input widget.

source

fn on_configure<F>(self, f: F) -> AdaptEvents<Self>
where F: Fn(&mut AdaptConfigCx<'_, '_>, &mut Self) + 'static,

Call the given closure on Events::configure

Returns a wrapper around the input widget.

source

fn on_update<F>(self, f: F) -> AdaptEvents<Self>
where F: Fn(&mut AdaptConfigCx<'_, '_>, &mut Self, &Self::Data) + 'static,

Call the given closure on Events::update

Returns a wrapper around the input widget.

source

fn on_message<M, H>(self, handler: H) -> AdaptEvents<Self>
where M: Debug + 'static, H: Fn(&mut AdaptEventCx<'_, '_>, &mut Self, M) + 'static,

Add a handler on message of type M

Where access to input data is required, use Self::on_messages instead.

Returns a wrapper around the input widget.

source

fn on_messages<H>(self, handler: H) -> AdaptEvents<Self>
where H: Fn(&mut AdaptEventCx<'_, '_>, &mut Self, &Self::Data) + 'static,

Add a generic message handler

Returns a wrapper around the input widget.

source

fn with_min_size_px(self, w: i32, h: i32) -> Reserve<Self>

Construct a wrapper, setting minimum size in pixels

The input size is scaled by the scale factor.

Returns a wrapper around the input widget.

source

fn with_min_size_em(self, w: f32, h: f32) -> Reserve<Self>

Construct a wrapper, setting minimum size in Em

This depends on the font size, though not the exact font in use.

Returns a wrapper around the input widget.

source

fn with_label<D, T>(self, direction: D, label: T) -> WithLabel<Self, D>

Construct a wrapper widget adding a label

Returns a wrapper around the input widget.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<W> AdaptWidget for W
where W: Widget,