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

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<dyn Widget>>>; fn draw(&self, _renderer: &mut dyn 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,
        _caught: &mut bool
    ) -> bool { ... }
fn add(&self, widget: Arc<dyn Widget>) { ... }
fn update(&self) { ... }
fn arrange(&self) { ... } }

Represents the base of all widgets.

Required methods

fn rect(&self) -> &Cell<Rect>

Borrow the render rect of the widget.

fn local_position(&self) -> &Cell<Point>

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

fn vertical_placement(&self) -> &Cell<VerticalPlacement>

Borrow the vertical placement of the widget.

fn horizontal_placement(&self) -> &Cell<HorizontalPlacement>

Borrow the horizontal placement of the widget.

fn margin(&self) -> &Cell<Thickness>

Borrow the margin of the widget.

fn name(&self) -> &str

Return the name of the widget.

fn children(&self) -> &RefCell<Vec<Arc<dyn Widget>>>

Borrow the children of the widget.

Loading content...

Provided methods

fn draw(&self, _renderer: &mut dyn Renderer, _focused: bool, _theme: &Theme)

Used to draw the widget by render code.

fn preview_event(
    &self,
    _event: Event,
    _focused: bool,
    _redraw: &mut bool,
    _handled: bool
) -> bool

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

fn event(
    &self,
    _event: Event,
    _focused: bool,
    _redraw: &mut bool,
    _caught: &mut bool
) -> bool

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

fn add(&self, widget: Arc<dyn Widget>)

Add a child to the widget.

fn update(&self)

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

fn arrange(&self)

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

Loading content...

Implementors

impl Widget for Grid[src]

impl Widget for StackLayout[src]

impl Widget for Image[src]

impl Widget for Rectangle[src]

impl Widget for TextWidget[src]

impl Widget for Action[src]

impl Widget for Button[src]

impl Widget for ComboBox[src]

impl Widget for Entry[src]

impl Widget for Label[src]

impl Widget for List[src]

impl Widget for Menu[src]

impl Widget for ProgressBar[src]

impl Widget for Separator[src]

impl Widget for TextBox[src]

Loading content...