Skip to main content

WidgetQuery

Trait WidgetQuery 

Source
pub trait WidgetQuery<'w, 's> {
    type WidgetView<'a>
       where Self: 'a;

    // Required methods
    fn find_by_id<'a>(
        &'a mut self,
        target_id: &str,
    ) -> Option<Self::WidgetView<'a>>;
    fn find_by_entity<'a>(
        &'a mut self,
        entity: Entity,
    ) -> Option<Self::WidgetView<'a>>;
    fn find_by_class(&self, target_class: &str) -> Vec<Entity>;
    fn get_components<'a>(
        &'a mut self,
        entity: Entity,
    ) -> Option<Self::WidgetView<'a>>;

    // Provided methods
    fn get_by_id<F>(&mut self, id: &str, f: F)
       where F: for<'a> FnOnce(&mut Self::WidgetView<'a>) { ... }
    fn get_by_entity<F>(&mut self, entity: Entity, f: F)
       where F: for<'a> FnOnce(&mut Self::WidgetView<'a>) { ... }
    fn get_by_class<F>(&mut self, class: &str, f: F)
       where F: for<'a> FnMut(&mut Self::WidgetView<'a>) { ... }
}
Expand description

Trait used for widgets system param.

Required Associated Types§

Source

type WidgetView<'a> where Self: 'a

The specific view struct this query returns (Ex, ButtonWidget, TextWidget).

Required Methods§

Source

fn find_by_id<'a>(&'a mut self, target_id: &str) -> Option<Self::WidgetView<'a>>

Method to find widget by ID.

Source

fn find_by_entity<'a>( &'a mut self, entity: Entity, ) -> Option<Self::WidgetView<'a>>

Method to find widget by Entity.

Source

fn find_by_class(&self, target_class: &str) -> Vec<Entity>

Method to find entities that match with provided classes.

Source

fn get_components<'a>( &'a mut self, entity: Entity, ) -> Option<Self::WidgetView<'a>>

Get related components of an entity.

Provided Methods§

Source

fn get_by_id<F>(&mut self, id: &str, f: F)
where F: for<'a> FnOnce(&mut Self::WidgetView<'a>),

Get the widget and executes a closure on a widget found by its ID.

Source

fn get_by_entity<F>(&mut self, entity: Entity, f: F)
where F: for<'a> FnOnce(&mut Self::WidgetView<'a>),

Get the widget and executes a closure on a widget found by its Entity.

Source

fn get_by_class<F>(&mut self, class: &str, f: F)
where F: for<'a> FnMut(&mut Self::WidgetView<'a>),

Executes a closure on every widget that matches the specified class.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'w, 's> WidgetQuery<'w, 's> for ButtonQuery<'w, 's>

Source§

type WidgetView<'a> = ButtonWidget<'a> where Self: 'a

Source§

impl<'w, 's> WidgetQuery<'w, 's> for CheckboxQuery<'w, 's>

Source§

type WidgetView<'a> = CheckboxWidget<'a, 'w, 's> where Self: 'a

Source§

impl<'w, 's> WidgetQuery<'w, 's> for CircularQuery<'w, 's>

Source§

type WidgetView<'a> = CircularWidget<'a, 'w, 's> where Self: 'a

Source§

impl<'w, 's> WidgetQuery<'w, 's> for ColumnQuery<'w, 's>

Source§

type WidgetView<'a> = ColumnWidget<'a, 'w, 's> where Self: 'a

Source§

impl<'w, 's> WidgetQuery<'w, 's> for DropdownQuery<'w, 's>

Source§

type WidgetView<'a> = DropdownWidget<'a> where Self: 'a

Source§

impl<'w, 's> WidgetQuery<'w, 's> for ImageQuery<'w, 's>

Source§

type WidgetView<'a> = ImageWidget<'a, 'w, 's> where Self: 'a

Source§

impl<'w, 's> WidgetQuery<'w, 's> for LinkQuery<'w, 's>

Source§

type WidgetView<'a> = LinkWidget<'a> where Self: 'a

Source§

impl<'w, 's> WidgetQuery<'w, 's> for ModalQuery<'w, 's>

Source§

type WidgetView<'a> = ModalWidget<'a> where Self: 'a

Source§

impl<'w, 's> WidgetQuery<'w, 's> for ProgressBarQuery<'w, 's>

Source§

type WidgetView<'a> = ProgressBarWidget<'a, 'w, 's> where Self: 'a

Source§

impl<'w, 's> WidgetQuery<'w, 's> for RadioGroupQuery<'w, 's>

Source§

type WidgetView<'a> = RadioGroupWidget<'a, 'w, 's> where Self: 'a

Source§

impl<'w, 's> WidgetQuery<'w, 's> for RadioQuery<'w, 's>

Source§

type WidgetView<'a> = RadioWidget<'a, 'w, 's> where Self: 'a

Source§

impl<'w, 's> WidgetQuery<'w, 's> for RootQuery<'w, 's>

Source§

type WidgetView<'a> = RootWidget<'a, 'w, 's> where Self: 'a

Source§

impl<'w, 's> WidgetQuery<'w, 's> for RowQuery<'w, 's>

Source§

type WidgetView<'a> = RowWidget<'a, 'w, 's> where Self: 'a

Source§

impl<'w, 's> WidgetQuery<'w, 's> for ScrollQuery<'w, 's>

Source§

type WidgetView<'a> = ScrollWidget<'a, 'w, 's> where Self: 'a

Source§

impl<'w, 's> WidgetQuery<'w, 's> for SelectQuery<'w, 's>

Source§

type WidgetView<'a> = SelectWidget<'a, 'w, 's> where Self: 'a

Source§

impl<'w, 's> WidgetQuery<'w, 's> for SliderQuery<'w, 's>

Source§

type WidgetView<'a> = SliderWidget<'a, 'w, 's> where Self: 'a

Source§

impl<'w, 's> WidgetQuery<'w, 's> for TextQuery<'w, 's>

Source§

type WidgetView<'a> = TextWidget<'a> where Self: 'a

Source§

impl<'w, 's> WidgetQuery<'w, 's> for TextInputQuery<'w, 's>

Source§

type WidgetView<'a> = TextInputWidget<'a, 'w, 's> where Self: 'a