Widget

Trait Widget 

Source
pub trait Widget: Sized + 'static {
    type Ret: AsEntity;
    type Data: Node;

    // Required method
    fn on_build(&mut self, state: &mut State, entity: Entity) -> Self::Ret;

    // Provided methods
    fn widget_name(&self) -> String { ... }
    fn build<F>(
        self,
        state: &mut State,
        parent: impl AsEntity,
        builder: F,
    ) -> Self::Ret
       where F: FnMut(Builder<'_, Self>) -> Builder<'_, Self>,
             Self: Sized + 'static { ... }
    fn bind<L, F>(self, lens: L, converter: F) -> Wrapper<L, Self>
       where L: Lens,
             F: 'static + Fn(&<L as Lens>::Target) -> Self::Data { ... }
    fn bind2<L>(self, lens: L) -> LensWrap<L, Self>
       where L: Lens { ... }
    fn on_update(
        &mut self,
        state: &mut State,
        entity: Entity,
        data: &Self::Data,
    ) { ... }
    fn on_event(&mut self, state: &mut State, entity: Entity, event: &mut Event) { ... }
    fn on_style(
        &mut self,
        state: &mut State,
        entity: Entity,
        property: (String, PropType),
    ) { ... }
    fn on_draw(
        &mut self,
        state: &mut State,
        entity: Entity,
        canvas: &mut Canvas<OpenGl>,
    ) { ... }
}

Required Associated Types§

Required Methods§

Source

fn on_build(&mut self, state: &mut State, entity: Entity) -> Self::Ret

Provided Methods§

Source

fn widget_name(&self) -> String

Source

fn build<F>( self, state: &mut State, parent: impl AsEntity, builder: F, ) -> Self::Ret
where F: FnMut(Builder<'_, Self>) -> Builder<'_, Self>, Self: Sized + 'static,

Adds the widget into state and returns the associated type Ret - an entity id or a tuple of entity ids

Source

fn bind<L, F>(self, lens: L, converter: F) -> Wrapper<L, Self>
where L: Lens, F: 'static + Fn(&<L as Lens>::Target) -> Self::Data,

Source

fn bind2<L>(self, lens: L) -> LensWrap<L, Self>
where L: Lens,

Source

fn on_update(&mut self, state: &mut State, entity: Entity, data: &Self::Data)

Source

fn on_event(&mut self, state: &mut State, entity: Entity, event: &mut Event)

Source

fn on_style( &mut self, state: &mut State, entity: Entity, property: (String, PropType), )

Source

fn on_draw( &mut self, state: &mut State, entity: Entity, canvas: &mut Canvas<OpenGl>, )

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 Widget for ArcTrack

Source§

impl Widget for Button

Source§

impl Widget for CheckButton

Source§

impl Widget for Checkbox

Source§

impl Widget for ColorGradient

Source§

impl Widget for ColorPicker

Source§

impl Widget for Column

Source§

impl Widget for ContextMenu

Source§

impl Widget for Dimension

Source§

impl Widget for DropdownItem

Source§

impl Widget for Element

Source§

impl Widget for HueSlider

Source§

impl Widget for Label

Source§

impl Widget for LengthBox

Source§

impl Widget for List

Source§

impl Widget for Menu

Source§

impl Widget for MenuBar

Source§

impl Widget for MovableTab

Source§

impl Widget for Panel

Source§

impl Widget for Popup

Source§

impl Widget for PopupWindow

Source§

impl Widget for Radio

Source§

impl Widget for ResizableColumn

Source§

impl Widget for Row

Source§

impl Widget for ScrollContainer

Source§

impl Widget for ScrollContainerH

Source§

impl Widget for Scrollbar

Source§

impl Widget for Slider

Source§

impl Widget for Stack

Source§

impl Widget for Switch

Source§

impl Widget for Tab

Source§

impl Widget for TabBar2

Source§

impl Widget for TabBar

Source§

impl Widget for TabContainer

Source§

impl Widget for TabView

Source§

impl Widget for Textbox

Source§

impl Widget for WindowWidget

Source§

impl<D> Widget for Store<D>
where D: Model + Node,

Source§

impl<L, W> Widget for LensWrap<L, W>
where L: 'static + Lens, W: Widget<Data = <L as Lens>::Target>,

Source§

type Ret = <W as Widget>::Ret

Source§

type Data = <L as Lens>::Source

Source§

impl<L, W> Widget for Wrapper<L, W>
where L: 'static + Lens, W: Widget,

Source§

type Ret = <W as Widget>::Ret

Source§

type Data = <L as Lens>::Source

Source§

impl<T> Widget for Dropdown<T>
where T: 'static + Clone,

Source§

impl<T> Widget for Knob<T>
where T: NormalizedMap,

Source§

impl<T> Widget for Spinbox<T>

Source§

impl<T> Widget for VectorEdit<T>
where T: 'static + Default + Debug + Display + Copy + PartialEq + FromStr,

Source§

impl<T, W> Widget for ListView<T, W>
where T: Debug + Node, W: Widget,

Source§

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

Source§

type Ret = <W as Widget>::Ret

Source§

type Data = <W as Widget>::Data