Trait orbtk::widgets::Widget [] [src]

pub trait Widget: Any {
    fn rect(&self) -> &Cell<Rect>;
fn local_position(&self) -> &Cell<Point>;
fn vertical_placement(&self) -> &Cell<VerticalPlacement>;
fn horizontal_placement(&self) -> &Cell<HorizontalPlacement>;
fn margin(&self) -> &Cell<Thickness>;
fn name(&self) -> &str;
fn children(&self) -> &RefCell<Vec<Arc<Widget>>>; fn draw(&self, _renderer: &mut Renderer, _focused: bool, _theme: &Theme) { ... }
fn preview_event(
        &self,
        _event: Event,
        _focused: bool,
        _redraw: &mut bool,
        _handled: bool
    ) -> bool { ... }
fn event(&self, _event: Event, _focused: bool, _redraw: &mut bool) -> bool { ... }
fn add(&self, widget: Arc<Widget>) { ... }
fn update(&self) { ... }
fn arrange(&self) { ... } }

Represents the base of all widgets.

Required Methods

Borrow the render rect of the widget.

Borrow the local position of the widget. The local position describes position of the widget relative to it's parent.

Borrow the vertical placement of the widget.

Borrow the horizontal placement of the widget.

Borrow the margin of the widget.

Return the name of the widget.

Borrow the children of the widget.

Provided Methods

Used to draw the widget by render code.

Handle the incoming events by tunneling from parent to child. Must have overwritten to create a custom tunneling event handling.

Handle the incoming events by bubbling from child to parent. Must have overwritten to create a custom bubbling event handling.

Add a child to the widget.

Used to update the state of the widget. Could be used to update the selector.

Arrange the children of the widget. Could be override to create a custom layout.

Implementors