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
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<Widget>>>
Borrow the children of the widget.
Provided Methods
fn draw(&self, _renderer: &mut 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
&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) -> 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<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.
Implementors
impl Widget for Grid
impl Widget for StackLayout
impl Widget for Image
impl Widget for Rectangle
impl Widget for TextWidget
impl Widget for Button
impl Widget for ComboBox
impl Widget for Label
impl Widget for Menu
impl Widget for Action
impl Widget for Separator
impl Widget for ProgressBar
impl Widget for TextBox
impl Widget for Entry
impl Widget for List