vizia::view

Struct Handle

pub struct Handle<'a, V> { /* private fields */ }
Expand description

A handle to a view which has been built into the tree.

Implementations§

§

impl<V> Handle<'_, V>

pub fn entity(&self) -> Entity

Returns the [Entity] id of the view.

pub fn context(&mut self) -> &mut Context

Returns a mutable reference to the context.

pub fn parent(&self) -> Entity

pub fn lock_focus_to_within(self) -> Handle<'_, V>

Stop the user from tabbing out of a subtree, which is useful for modal dialogs.

pub fn modify<F>(self, f: F) -> Handle<'_, V>
where F: FnOnce(&mut V), V: 'static,

Mody the internal data of the view.

pub fn on_build<F>(self, callback: F) -> Handle<'_, V>
where F: Fn(&mut EventContext<'_>),

Callback which is run when the view is built/rebuilt.

pub fn bind<R, T, F>(self, res: R, closure: F) -> Handle<'_, V>
where R: Res<T>, F: 'static + Clone + Fn(Handle<'_, V>, R),

pub fn needs_relayout(&mut self)

Marks the view as needing a relayout.

pub fn needs_restyle(&mut self)

Marks the view as needing a restyle.

pub fn needs_redraw(&mut self)

Marks the view as needing a redraw.

pub fn bounds(&self) -> BoundingBox

Returns the bounding box of the view.

pub fn scale_factor(&self) -> f32

Returns the scale factor of the device.

§

impl Handle<'_, Avatar>

pub fn variant<U>(self, variant: impl Res<U>) -> Handle<'_, Avatar>
where U: Into<AvatarVariant>,

Selects the style variant for the Avatar.

pub fn badge<F>(self, content: F) -> Handle<'_, Avatar>
where F: FnOnce(&mut Context) -> Handle<'_, Badge>,

Adds a badge to the Avatar.

§

impl Handle<'_, Badge>

pub fn placement(self, placement: BadgePlacement) -> Handle<'_, Badge>

Sets the placement of a badge relative to its parent when used with the badge modifier.

§

impl Handle<'_, ButtonGroup>

pub fn vertical(self, is_vertical: impl Res<bool>) -> Handle<'_, ButtonGroup>

§

impl Handle<'_, Checkbox>

pub fn on_toggle<F>(self, callback: F) -> Handle<'_, Checkbox>
where F: 'static + Fn(&mut EventContext<'_>),

Set the callback triggered when the checkbox is pressed.

§Examples
Checkbox::new(cx, AppData::value).on_toggle(|cx| cx.emit(AppEvent::ToggleValue));
§

impl Handle<'_, Chip>

pub fn on_close( self, callback: impl Fn(&mut EventContext<'_>) + Send + Sync + 'static, ) -> Handle<'_, Chip>

pub fn variant<U>(self, variant: impl Res<U>) -> Handle<'_, Chip>
where U: Into<ChipVariant>,

Selects the style variant to be used by the chip.

§Example
Chip::new(cx, "Chip")
    .variant(ChipVariant::Filled);
§

impl<L1, L2, T> Handle<'_, ComboBox<L1, L2, T>>
where L1: Lens<Target = Vec<T>>, T: 'static + Data + ToString, L2: Lens<Target = usize>,

pub fn on_select<F>(self, callback: F) -> Handle<'_, ComboBox<L1, L2, T>>
where F: 'static + Fn(&mut EventContext<'_>, usize),

§

impl Handle<'_, Datepicker>

pub fn on_select<F>(self, callback: F) -> Handle<'_, Datepicker>
where F: 'static + Fn(&mut EventContext<'_>, NaiveDate),

§

impl Handle<'_, Divider>

pub fn orientation( self, orientation: impl Res<Orientation>, ) -> Handle<'_, Divider>

§

impl<L> Handle<'_, Knob<L>>
where L: Lens<Target = f32>,

pub fn on_changing<F>(self, callback: F) -> Handle<'_, Knob<L>>
where F: 'static + Fn(&mut EventContext<'_>, f32),

§

impl Handle<'_, ArcTrack>

pub fn value<L>(self, lens: L) -> Handle<'_, ArcTrack>
where L: Lens<Target = f32>,

§

impl Handle<'_, TickKnob>

pub fn value<L>(self, lens: L) -> Handle<'_, TickKnob>
where L: Lens<Target = f32>,

§

impl Handle<'_, Label>

pub fn describing( self, entity_identifier: impl Into<String>, ) -> Handle<'_, Label>

Which form element does this label describe.

§Examples
Checkbox::new(cx, AppData::value).on_toggle(|cx| cx.emit(AppEvent::ToggleValue)).id("checkbox_identifier");
Label::new(cx, "hello").describing("checkbox_identifier");
§

impl Handle<'_, PickList>

pub fn on_select<F>(self, callback: F) -> Handle<'_, PickList>
where F: 'static + Fn(&mut EventContext<'_>, usize),

§

impl Handle<'_, ScrollList>

pub fn on_select<F>(self, callback: F) -> Handle<'_, ScrollList>
where F: 'static + Fn(&mut EventContext<'_>, usize),

§

impl Handle<'_, Popup>

pub fn placement(self, placement: impl Res<Placement>) -> Handle<'_, Popup>

Sets the position where the tooltip should appear relative to its parent element. Defaults to Placement::Bottom.

pub fn arrow(self, show_arrow: bool) -> Handle<'_, Popup>

Sets whether the popup should include an arrow. Defaults to true.

pub fn arrow_size(self, size: impl Into<Length>) -> Handle<'_, Popup>

Sets the size of the popup arrow, or gap if the arrow is hidden.

pub fn should_reposition(self, flag: bool) -> Handle<'_, Popup>

Set to whether the popup should reposition to always be visible.

pub fn on_blur<F>(self, f: F) -> Handle<'_, Popup>
where F: 'static + Fn(&mut EventContext<'_>),

Registers a callback for when the user clicks off of the popup, usually with the intent of closing it.

§

impl Handle<'_, ProgressBar>

pub fn bar_color(self, color: impl Res<Color>) -> Handle<'_, ProgressBar>

Set the color of the bar inside the ProgressBar.

you also pass a lens to this method if you want to be able to change the color dynamically.

§

impl Handle<'_, RadioButton>

pub fn on_select<F>(self, callback: F) -> Handle<'_, RadioButton>
where F: 'static + Fn(&mut EventContext<'_>),

Set the callback triggered when the radio button is selected.

§Examples
RadioButton::new(cx, AppData::value).on_select(|cx| cx.emit(AppEvent::ToggleValue));
§

impl Handle<'_, Rating>

pub fn on_change<F>(self, callback: F) -> Handle<'_, Rating>
where F: 'static + Fn(&mut EventContext<'_>, u32),

§

impl<L1> Handle<'_, Scrollbar<L1>>
where L1: 'static + Lens<Target = f32>,

pub fn scroll_to_cursor( self, scroll_to_cursor: impl Res<bool>, ) -> Handle<'_, Scrollbar<L1>>

§

impl Handle<'_, ScrollView>

pub fn on_scroll( self, callback: impl Fn(&mut EventContext<'_>, f32, f32) + Send + Sync + 'static, ) -> Handle<'_, ScrollView>

Sets a callback which will be called when a scrollview is scrolled, either with the mouse wheel, touchpad, or using the scroll bars.

pub fn scroll_to_cursor(self, scroll_to_cursor: bool) -> Handle<'_, ScrollView>

pub fn scrollx(self, scrollx: impl Res<f32>) -> Handle<'_, ScrollView>

pub fn scrolly(self, scrollx: impl Res<f32>) -> Handle<'_, ScrollView>

§

impl<L> Handle<'_, Slider<L>>
where L: Lens,

pub fn on_changing<F>(self, callback: F) -> Handle<'_, Slider<L>>
where F: 'static + Fn(&mut EventContext<'_>, f32),

Sets the callback triggered when the slider value is changing (dragging).

Takes a closure which triggers when the slider value is changing, either by pressing the track or dragging the thumb along the track.

§Example
Slider::new(cx, AppData::value)
    .on_changing(|cx, value| {
        debug!("Slider on_changing: {}", value);
    });

pub fn range(self, range: Range<f32>) -> Handle<'_, Slider<L>>

Sets the range of the slider.

If the bound data is outside of the range then the slider will clip to min/max of the range.

§Example
Slider::new(cx, AppData::value)
    .range(-20.0..50.0)
    .on_changing(|cx, value| {
        debug!("Slider on_changing: {}", value);
    });

pub fn step(self, step: f32) -> Handle<'_, Slider<L>>

pub fn keyboard_fraction(self, keyboard_fraction: f32) -> Handle<'_, Slider<L>>

Sets the fraction of a slider that a press of an arrow key will change.

§Example
Slider::new(cx, AppData::value)
    .keyboard_fraction(0.05)
    .on_changing(|cx, value| {
        debug!("Slider on_changing: {}", value);
    });
§

impl Handle<'_, NamedSlider>

pub fn on_changing<F>(self, callback: F) -> Handle<'_, NamedSlider>
where F: 'static + Fn(&mut EventContext<'_>, f32),

pub fn range(self, range: Range<f32>) -> Handle<'_, NamedSlider>

pub fn keyboard_fraction( self, keyboard_fraction: f32, ) -> Handle<'_, NamedSlider>

§

impl Handle<'_, Spinbox>

pub fn on_increment<F>(self, callback: F) -> Handle<'_, Spinbox>
where F: 'static + Fn(&mut EventContext<'_>) + Send + Sync,

pub fn on_decrement<F>(self, callback: F) -> Handle<'_, Spinbox>
where F: 'static + Fn(&mut EventContext<'_>) + Send + Sync,

pub fn orientation( self, orientation: impl Res<Orientation>, ) -> Handle<'_, Spinbox>

pub fn icons(self, icons: impl Res<SpinboxIcons>) -> Handle<'_, Spinbox>

§

impl Handle<'_, Switch>

pub fn on_toggle<F>(self, callback: F) -> Handle<'_, Switch>
where F: 'static + Fn(&mut EventContext<'_>),

Set the callback triggered when the Switch is pressed.

§Examples
Switch::new(cx, AppData::value).on_toggle(|cx| cx.emit(AppEvent::ToggleValue));
§

impl Handle<'_, TabView>

pub fn vertical(self) -> Handle<'_, TabView>

pub fn on_select( self, callback: impl Fn(&mut EventContext<'_>, usize) + 'static, ) -> Handle<'_, TabView>

pub fn with_selected<U>(self, selected: impl Res<U>) -> Handle<'_, TabView>
where U: Into<usize>,

§

impl<L> Handle<'_, Textbox<L>>
where L: Lens,

pub fn on_edit<F>(self, callback: F) -> Handle<'_, Textbox<L>>
where F: 'static + Fn(&mut EventContext<'_>, String) + Send + Sync,

Sets the callback triggered when a textbox is edited, i.e. text is inserted/deleted.

Callback provides the current text of the textbox.

pub fn on_submit<F>(self, callback: F) -> Handle<'_, Textbox<L>>
where F: 'static + Fn(&mut EventContext<'_>, <L as Lens>::Target, bool) + Send + Sync,

Sets the callback triggered when a textbox is submitted, i.e. when the enter key is pressed with a single-line textbox or the textbox loses focus.

Callback provides the text of the textbox and a flag to indicate if the submit was due to a key press or a loss of focus.

pub fn on_blur<F>(self, callback: F) -> Handle<'_, Textbox<L>>
where F: 'static + Fn(&mut EventContext<'_>) + Send + Sync,

Sets the callback triggered when a textbox is blurred, i.e. the mouse is pressed outside of the textbox.

pub fn on_cancel<F>(self, callback: F) -> Handle<'_, Textbox<L>>
where F: 'static + Fn(&mut EventContext<'_>) + Send + Sync,

Sets the callback triggered when a textbox edit is cancelled, i.e. the escape key is pressed while editing.

pub fn validate<F>(self, is_valid: F) -> Handle<'_, Textbox<L>>
where F: 'static + Fn(&<L as Lens>::Target) -> bool + Send + Sync,

Sets a validation closure which is called when the textbox is edited and sets the validity attribute to the output of the closure.

If a textbox is modified with the validate modifier then the on_submit will not be called if the text is invalid.

pub fn placeholder<P>(self, text: impl Res<P>) -> Handle<'_, Textbox<L>>

Sets the placeholder text that appears when the textbox has no value.

§

impl Handle<'_, Tooltip>

pub fn placement(self, placement: Placement) -> Handle<'_, Tooltip>

Sets the position where the tooltip should appear relative to its parent element. Defaults to Placement::Bottom.

pub fn arrow(self, show_arrow: bool) -> Handle<'_, Tooltip>

Sets whether the tooltip should include an arrow. Defaults to true.

pub fn arrow_size(self, size: impl Into<Length>) -> Handle<'_, Tooltip>

§

impl Handle<'_, VirtualList>

pub fn scroll_to_cursor(self, flag: bool) -> Handle<'_, VirtualList>

§

impl Handle<'_, XYPad>

pub fn on_change<F>(self, callback: F) -> Handle<'_, XYPad>
where F: Fn(&mut EventContext<'_>, f32, f32) + 'static,

Trait Implementations§

§

impl<V> AbilityModifiers for Handle<'_, V>

§

fn hoverable<U>(self, state: impl Res<U>) -> Self
where U: Into<bool>,

Sets whether the view can be hovered by the mouse and receive mouse events. Read more
§

fn focusable<U>(self, state: impl Res<U>) -> Self
where U: Into<bool>,

Sets whether the view can be focused to receive keyboard input events. Read more
§

fn checkable<U>(self, state: impl Res<U>) -> Self
where U: Into<bool>,

Sets whether the view can be checked. Read more
§

fn navigable<U>(self, state: impl Res<U>) -> Self
where U: Into<bool>,

Sets whether the view can be navigated to, i.e. focused, by the keyboard. Read more
§

impl<V> AccessibilityModifiers for Handle<'_, V>
where V: View,

§

fn role(self, role: Role) -> Self

Sets the accessibility role of the view.
§

fn name<U>(self, name: impl Res<U>) -> Self

Sets the accessibility name of the view.
§

fn default_action_verb(self, action_verb: DefaultActionVerb) -> Self

Sets the accessibility default action for the view.
§

fn live(self, live: Live) -> Self

Sets whether the view should act as an accessibility live region.
§

fn hidden<U>(self, hidden: impl Res<U>) -> Self
where U: Into<bool>,

Sets whether the view should be hidden from accessibility.
§

fn numeric_value<U>(self, value: impl Res<U>) -> Self
where U: Into<f64>,

Sets the accessibility numeric value for the view.
§

fn text_value<U>(self, value: impl Res<U>) -> Self

Sets the accessibility text value for the view.
§

impl<V> ActionModifiers<V> for Handle<'_, V>
where V: View,

§

fn tooltip<C>(self, content: C) -> Handle<'_, V>
where C: Fn(&mut Context) -> Handle<'_, Tooltip> + 'static,

§

fn menu<C, T>(self, content: C) -> Handle<'_, V>
where C: FnOnce(&mut Context) -> Handle<'_, T>, T: View,

§

fn on_press<F>(self, action: F) -> Handle<'_, V>
where F: 'static + Fn(&mut EventContext<'_>) + Send + Sync,

Adds a callback which is performed when the the view receives the Press event. By default a view receives the Press event when the left mouse button is pressed and then released on the view, or when the space or enter keys are pressed and then released while the view is focused. Read more
§

fn on_press_down<F>(self, action: F) -> Handle<'_, V>
where F: 'static + Fn(&mut EventContext<'_>) + Send + Sync,

Adds a callback which is performed when the the view receives the PressDown event. or when the space or enter keys are pressed while the view is focused. Read more
§

fn on_double_click<F>(self, action: F) -> Handle<'_, V>
where F: 'static + Fn(&mut EventContext<'_>, MouseButton) + Send + Sync,

Adds a callback which is performed when the the view receives the MouseDoubleClick event. Read more
§

fn on_hover<F>(self, action: F) -> Handle<'_, V>
where F: 'static + Fn(&mut EventContext<'_>) + Send + Sync,

Adds a callback which is performed when the mouse pointer moves over a view. This callback is not triggered when the mouse pointer moves over an overlapping child of the view. Read more
§

fn on_hover_out<F>(self, action: F) -> Handle<'_, V>
where F: 'static + Fn(&mut EventContext<'_>) + Send + Sync,

Adds a callback which is performed when the mouse pointer moves away from a view. This callback is not triggered when the mouse pointer moves away from an overlapping child of the view. Read more
§

fn on_over<F>(self, action: F) -> Handle<'_, V>
where F: 'static + Fn(&mut EventContext<'_>) + Send + Sync,

Adds a callback which is performed when the mouse pointer moves over the bounds of a view, including any overlapping children. Read more
§

fn on_over_out<F>(self, action: F) -> Handle<'_, V>
where F: 'static + Fn(&mut EventContext<'_>) + Send + Sync,

Adds a callback which is performed when the mouse pointer moves away from the bounds of a view, including any overlapping children. Read more
§

fn on_mouse_move<F>(self, action: F) -> Handle<'_, V>
where F: 'static + Fn(&mut EventContext<'_>, f32, f32) + Send + Sync,

Adds a callback which is performed when the mouse pointer moves within the bounds of a view. Read more
§

fn on_mouse_down<F>(self, action: F) -> Handle<'_, V>
where F: 'static + Fn(&mut EventContext<'_>, MouseButton) + Send + Sync,

Adds a callback which is performed when a mouse button is pressed on the view. Unlike the on_press callback, this callback is triggered for all mouse buttons and not for any keyboard keys. Read more
§

fn on_mouse_up<F>(self, action: F) -> Handle<'_, V>
where F: 'static + Fn(&mut EventContext<'_>, MouseButton) + Send + Sync,

Adds a callback which is performed when a mouse button is released on the view. Unlike the on_release callback, this callback is triggered for all mouse buttons and not for any keyboard keys. Read more
§

fn on_focus_in<F>(self, action: F) -> Handle<'_, V>
where F: 'static + Fn(&mut EventContext<'_>) + Send + Sync,

Adds a callback which is performed when the view gains keyboard focus. Read more
§

fn on_focus_out<F>(self, action: F) -> Handle<'_, V>
where F: 'static + Fn(&mut EventContext<'_>) + Send + Sync,

Adds a callback which is performed when the view loses keyboard focus. Read more
§

fn on_geo_changed<F>(self, action: F) -> Handle<'_, V>
where F: 'static + Fn(&mut EventContext<'_>, GeoChanged) + Send + Sync,

Adds a callback which is performed when the the view changes size or position after layout. Read more
§

fn on_drag<F>(self, action: F) -> Handle<'_, V>
where F: 'static + Fn(&mut EventContext<'_>) + Send + Sync,

§

fn on_drop<F>(self, action: F) -> Handle<'_, V>
where F: 'static + Fn(&mut EventContext<'_>, DropData) + Send + Sync,

§

impl<V> AsMut<Context> for Handle<'_, V>

§

fn as_mut(&mut self) -> &mut Context

Converts this type into a mutable reference of the (usually inferred) input type.
§

impl ButtonModifiers for Handle<'_, Button>

§

fn variant<U>(self, variant: impl Res<U>) -> Handle<'_, Button>
where U: Into<ButtonVariant>,

Selects the style variant to be used by the button or button group. Read more
§

impl ButtonModifiers for Handle<'_, ButtonGroup>

§

fn variant<U>(self, variant: impl Res<U>) -> Handle<'_, ButtonGroup>
where U: Into<ButtonVariant>,

Selects the style variant to be used by the button or button group. Read more
§

impl<V> DataContext for Handle<'_, V>

§

fn data<T>(&self) -> Option<&T>
where T: 'static,

Get model/view data from the context. Returns None if the data does not exist.
§

fn as_context(&self) -> Option<LocalizationContext<'_>>

§

impl<V> LayoutModifiers for Handle<'_, V>
where V: View,

§

fn layout_type<U>(self, value: impl Res<U>) -> Self
where U: Into<LayoutType>,

Sets the layout type of the view. Read more
§

fn position_type<U>(self, value: impl Res<U>) -> Self
where U: Into<PositionType>,

Sets the position type of the view. Read more
§

fn left<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the space on the left side of the view. Read more
§

fn right<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the space on the right side of the view. Read more
§

fn top<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the space on the top side of the view. Read more
§

fn bottom<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the space on the bottom side of the view. Read more
§

fn space<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the space for all sides of the view.
§

fn width<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the width of the view.
§

fn height<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the height of the view.
§

fn size<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the width and height of the view.
§

fn child_left<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the space between the left side of the view and the left side of its children. Read more
§

fn child_right<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the space between the right side of the view and the right side of its children. Read more
§

fn child_top<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the space between the top side of the view and the top side of its children. Read more
§

fn child_bottom<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the space between the bottom side of the view and the bottom side of its children. Read more
§

fn child_space<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the space between the vew and its children. Read more
§

fn row_between<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the space between the views children in a vertical stack.
§

fn col_between<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the space between the views children in a horizontal stack.
§

fn min_width<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the minimum width of the view.
§

fn min_height<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the minimum height of the view.
§

fn min_size<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the minimum width and minimum height of the view.
§

fn max_width<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the maximum width of the view.
§

fn max_height<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the maximum height of the view.
§

fn max_size<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the maximum width and maximum height of the view.
§

fn min_left<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the minimum left space of the view.
§

fn min_right<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the minimum right space of the view.
§

fn min_top<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the minimum top space of the view.
§

fn min_bottom<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the minimum bottom space of the view.
§

fn min_space<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the minimum space for all sides of the view.
§

fn max_left<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the maximum left space of the view.
§

fn max_right<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the maximum right space of the view.
§

fn max_top<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the maximum top space of the view.
§

fn max_bottom<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the maximum bottom space of the view.
§

fn max_space<U>(self, value: impl Res<U>) -> Self
where U: Into<Units>,

Sets the maximum space for all sides of the view.
§

impl<V> StyleModifiers for Handle<'_, V>
where V: View,

§

fn id(self, id: impl Into<String>) -> Self

Sets the ID name of the view. Read more
§

fn class(self, name: &str) -> Self

Adds a class name to the view. Read more
§

fn toggle_class(self, name: &str, applied: impl Res<bool>) -> Self

Sets whether a view should have the given class name.
§

fn checked<U>(self, state: impl Res<U>) -> Self
where U: Into<bool>,

Sets the checked state of the view.
§

fn focused<U>(self, state: impl Res<U>) -> Self
where U: Into<bool>,

Sets the focused state of the view. Read more
§

fn read_only<U>(self, state: impl Res<U>) -> Self
where U: Into<bool>,

§

fn read_write<U>(self, state: impl Res<U>) -> Self
where U: Into<bool>,

§

fn disabled<U>(self, value: impl Res<U>) -> Self
where U: Into<bool>,

Sets the view to be disabled. Read more
§

fn display<U>(self, value: impl Res<U>) -> Self
where U: Into<Display>,

Sets whether the view should be positioned and rendered. Read more
§

fn visibility<U>(self, value: impl Res<U>) -> Self
where U: Into<Visibility>,

Sets whether the view should be rendered. Read more
§

fn opacity<U>(self, value: impl Res<U>) -> Self
where U: Into<Opacity>,

Sets the opacity of the view. Read more
§

fn z_index<U>(self, value: impl Res<U>) -> Self
where U: Into<i32>,

Sets the z-index of the view. Read more
§

fn clip_path<U>(self, value: impl Res<U>) -> Self
where U: Into<ClipPath>,

Sets the clip path for the the view.
§

fn overflow<U>(self, value: impl Res<U>) -> Self
where U: Into<Overflow>,

§

fn overflowx<U>(self, value: impl Res<U>) -> Self
where U: Into<Overflow>,

Sets the overflow behavior of the view in the horizontal direction. Read more
§

fn overflowy<U>(self, value: impl Res<U>) -> Self
where U: Into<Overflow>,

Sets the overflow behavior of the view in the vertical direction. Read more
§

fn backdrop_filter<U>(self, value: impl Res<U>) -> Self
where U: Into<Filter>,

Sets the backdrop filter for the view.
§

fn shadow<U>(self, value: impl Res<U>) -> Self
where U: Into<Shadow>,

Add a shadow to the view.
§

fn shadows<U>(self, value: impl Res<U>) -> Self
where U: Into<Vec<Shadow>>,

§

fn background_gradient<U>(self, value: impl Res<U>) -> Self
where U: Into<Gradient>,

§

fn background_color<U>(self, value: impl Res<U>) -> Self
where U: Into<Color>,

Sets the background color of the view.
§

fn background_image<'i, U>(self, value: impl Res<U>) -> Self
where U: Into<BackgroundImage<'i>>,

§

fn border_width<U>(self, value: impl Res<U>) -> Self

Sets the border width of the view.
§

fn border_color<U>(self, value: impl Res<U>) -> Self
where U: Into<Color>,

Sets the border color of the view.
§

fn border_style<U>(self, value: impl Res<U>) -> Self

Sets the border color of the view.
§

fn corner_top_left_radius<U>(self, value: impl Res<U>) -> Self

Sets the corner radius for the top-left corner of the view.
§

fn corner_top_right_radius<U>(self, value: impl Res<U>) -> Self

Sets the corner radius for the top-right corner of the view.
§

fn corner_bottom_left_radius<U>(self, value: impl Res<U>) -> Self

Sets the corner radius for the bottom-left corner of the view.
§

fn corner_bottom_right_radius<U>(self, value: impl Res<U>) -> Self

Sets the corner radius for the bottom-right corner of the view.
§

fn corner_radius<U>(self, value: impl Res<U>) -> Self
where U: Debug + Into<CornerRadius>,

Sets the corner radius for all four corners of the view.
§

fn corner_top_left_shape<U>(self, value: impl Res<U>) -> Self
where U: Into<CornerShape>,

Sets the corner corner shape for the top-left corner of the view.
§

fn corner_top_right_shape<U>(self, value: impl Res<U>) -> Self
where U: Into<CornerShape>,

Sets the corner corner shape for the top-right corner of the view.
§

fn corner_bottom_left_shape<U>(self, value: impl Res<U>) -> Self
where U: Into<CornerShape>,

Sets the corner corner shape for the bottom-left corner of the view.
§

fn corner_bottom_right_shape<U>(self, value: impl Res<U>) -> Self
where U: Into<CornerShape>,

Sets the corner corner shape for the bottom-right corner of the view.
§

fn corner_shape<U>(self, value: impl Res<U>) -> Self
where U: Debug + Into<Rect<CornerShape>>,

Sets the corner shape for all four corners of the view.
§

fn corner_top_left_smoothing<U>(self, value: impl Res<U>) -> Self
where U: Into<f32>,

Sets the corner smoothing for the top-left corner of the view.
§

fn corner_top_right_smoothing<U>(self, value: impl Res<U>) -> Self
where U: Into<f32>,

Sets the corner smoothing for the top-right corner of the view.
§

fn corner_bottom_left_smoothing<U>(self, value: impl Res<U>) -> Self
where U: Into<f32>,

Sets the corner smoothing for the bottom-left corner of the view.
§

fn corner_bottom_right_smoothing<U>(self, value: impl Res<U>) -> Self
where U: Into<f32>,

Sets the corner smoothing for the bottom-right corner of the view.
§

fn corner_smoothing<U>(self, value: impl Res<U>) -> Self
where U: Debug + Into<Rect<f32>>,

Sets the corner smoothing for all four corners of the view.
§

fn outline_width<U>(self, value: impl Res<U>) -> Self

Sets the outline width of the view.
§

fn outline_color<U>(self, value: impl Res<U>) -> Self
where U: Into<Color>,

Sets the outline color of the view.
§

fn outline_offset<U>(self, value: impl Res<U>) -> Self

Sets the outline offset of the view.
§

fn cursor<U>(self, value: impl Res<U>) -> Self
where U: Into<CursorIcon>,

Sets the mouse cursor used when the view is hovered.
§

fn pointer_events<U>(self, value: impl Res<U>) -> Self
where U: Into<PointerEvents>,

Sets whether the view can be become the target of pointer events.
§

fn transform<U>(self, value: impl Res<U>) -> Self
where U: Into<Vec<Transform>>,

Sets the transform of the view with a list of transform functions.
§

fn transform_origin<U>(self, value: impl Res<U>) -> Self
where U: Into<Position>,

Sets the transform origin of the the view.
§

fn translate<U>(self, value: impl Res<U>) -> Self
where U: Into<Translate>,

Sets the translation offset of the view. Read more
§

fn rotate<U>(self, value: impl Res<U>) -> Self
where U: Into<Angle>,

Sets the angle of rotation for the view. Read more
§

fn scale<U>(self, value: impl Res<U>) -> Self
where U: Into<Scale>,

Sets the scale of the view. Read more
§

impl<V> TextModifiers for Handle<'_, V>

§

fn text<T>(self, value: impl Res<T>) -> Self

Sets the text content of the view.
§

fn font_family<U>(self, value: impl Res<U>) -> Self
where U: Into<Vec<FamilyOwned>>,

Sets the font that should be used by the view. Read more
§

fn font_weight<U>(self, value: impl Res<U>) -> Self
where U: Into<FontWeight>,

Sets the font weight that should be used by the view.
§

fn font_slant<U>(self, value: impl Res<U>) -> Self
where U: Into<FontSlant>,

Sets the font style that should be used by the view.
§

fn font_width<U>(self, value: impl Res<U>) -> Self
where U: Into<FontWidth>,

Sets the font stretch that should be used by the view if the font supports it.
§

fn font_variation_settings<U>(self, value: impl Res<U>) -> Self
where U: Into<Vec<FontVariation>>,

Sets the font variation settings that should be used by the view.
§

fn color<U>(self, value: impl Res<U>) -> Self
where U: Clone + Into<Color>,

Sets the text color of the view.
§

fn font_size<U>(self, value: impl Res<U>) -> Self
where U: Into<FontSize>,

Sets the font size of the view.
§

fn caret_color<U>(self, value: impl Res<U>) -> Self
where U: Into<Color>,

Sets the ext caret color of the view.
§

fn selection_color<U>(self, value: impl Res<U>) -> Self
where U: Into<Color>,

Sets the color used to highlight selected text within the view.
§

fn text_wrap<U>(self, value: impl Res<U>) -> Self
where U: Into<bool>,

Sets whether the text of the view should be allowed to wrap.
§

fn text_align<U>(self, value: impl Res<U>) -> Self
where U: Into<TextAlign>,

Sets the horizontal alignment of text within the view.
§

fn text_overflow<U>(self, value: impl Res<U>) -> Self
where U: Into<TextOverflow>,

Sets the text overflow.
§

fn line_clamp<U>(self, value: impl Res<U>) -> Self
where U: Into<LineClamp>,

Sets the max number of .
§

fn text_decoration_line<U>(self, value: impl Res<U>) -> Self

Sets the max number of .
§

impl ToggleButtonModifiers for Handle<'_, ToggleButton>

§

fn on_toggle( self, callback: impl Fn(&mut EventContext<'_>) + 'static, ) -> Handle<'_, ToggleButton>

source§

impl WindowModifiers for Handle<'_, Window>

source§

fn on_close( self, callback: impl Fn(&mut EventContext<'_>) + 'static, ) -> Handle<'_, Window>

source§

fn on_create( self, callback: impl Fn(&mut EventContext<'_>) + 'static, ) -> Handle<'_, Window>

source§

fn title<T>(self, title: impl Res<T>) -> Handle<'_, Window>
where T: ToString,

Sets the title of the window to the given value. Accepts a type, or lens to a type, which implements ToString. Read more
source§

fn inner_size<S>(self, size: impl Res<S>) -> Handle<'_, Window>
where S: Into<WindowSize>,

Sets the inner size of the window to the given value. Accepts a value, or lens, which can be converted to a [WindowSize]. Read more
source§

fn min_inner_size<S>(self, size: impl Res<Option<S>>) -> Handle<'_, Window>
where S: Into<WindowSize>,

Sets the minimum inner size of the window to the given value. Accepts an optional value, or lens, which can be converted to a [WindowSize]. Read more
source§

fn max_inner_size<S>(self, size: impl Res<Option<S>>) -> Handle<'_, Window>
where S: Into<WindowSize>,

Sets the maximum inner size of the window to the given value. Accepts an optional value, or lens, which can be converted to a [WindowSize]. Read more
source§

fn position<P>(self, position: impl Res<P>) -> Handle<'_, Window>
where P: Into<WindowPosition>,

Sets the position of the window to the given value. Accepts a value, or lens, which can be converted to a [Position]. Read more
source§

fn resizable(self, flag: impl Res<bool>) -> Handle<'_, Window>

Sets whether the window can be resized. Accepts a boolean value, or lens to a boolean value. Read more
source§

fn minimized(self, flag: impl Res<bool>) -> Handle<'_, Window>

Sets whether the window is minimized. Accepts a boolean value, or lens to a boolean value. Read more
source§

fn maximized(self, flag: impl Res<bool>) -> Handle<'_, Window>

Sets whether the window is maximized. Accepts a boolean value, or lens to a boolean value. Read more
source§

fn visible(self, flag: impl Res<bool>) -> Handle<'_, Window>

Sets whether the window is visible. Accepts a boolean value, or lens to a boolean value. Read more
source§

fn transparent(self, flag: bool) -> Handle<'_, Window>

Sets whether the window is transparent. Accepts a boolean value, or lens to a boolean value. Read more
source§

fn decorations(self, flag: bool) -> Handle<'_, Window>

Sets whether the window has decorations. Accepts a boolean value, or lens to a boolean value. Read more
source§

fn always_on_top(self, flag: bool) -> Handle<'_, Window>

Sets whether the window should be on top of other windows. Accepts a boolean value, or lens to a boolean value. Read more
source§

fn vsync(self, flag: bool) -> Handle<'_, Window>

Sets whether the window has vsync enabled. Read more
source§

fn icon(self, width: u32, height: u32, image: Vec<u8>) -> Handle<'_, Window>

Sets the icon used for the window. Read more
source§

fn enabled_window_buttons( self, window_buttons: WindowButtons, ) -> Handle<'_, Window>

Auto Trait Implementations§

§

impl<'a, V> Freeze for Handle<'a, V>

§

impl<'a, V> !RefUnwindSafe for Handle<'a, V>

§

impl<'a, V> !Send for Handle<'a, V>

§

impl<'a, V> !Sync for Handle<'a, V>

§

impl<'a, V> Unpin for Handle<'a, V>
where V: Unpin,

§

impl<'a, V> !UnwindSafe for Handle<'a, V>

Blanket Implementations§

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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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 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> Same for T

source§

type Output = T

Should always be Self
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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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