Skip to main content

RootWidget

Struct RootWidget 

Source
pub struct RootWidget { /* private fields */ }
Expand description

The window’s root Widget: a flat fill of its color.

The Engine creates one as Widget 0 for every window. It is the parent of every other Widget.

Implementations§

Source§

impl RootWidget

Source

pub fn new(size: Size) -> Self

Creates a root Widget covering a window, filled with white.

§Arguments
  • size - The size of the window in pixels.
§Returns

The new RootWidget.

Trait Implementations§

Source§

impl Widget for RootWidget

Source§

fn core(&self) -> &WidgetCore

Returns the root Widget’s shared state.

§Returns

The WidgetCore.

Source§

fn core_mut(&mut self) -> &mut WidgetCore

Returns the root Widget’s shared state for modification.

§Returns

The WidgetCore.

Source§

fn paint(&self, p: &mut dyn Painter)

Fills the window with the root Widget’s color.

§Arguments
  • p - The painter, targeting the root Widget.
Source§

fn handle_event(&mut self, event: &Event, ctx: &mut EventCtx) -> Propagation

Handles an event sent to this Widget. Read more
Source§

fn feed_controllers(&mut self, event: &Event, ctx: &mut EventCtx) -> Propagation

Feeds an event to the Widget’s controllers and calls Widget::on_controller_event for each result, in order. Read more
Source§

fn on_controller_event( &mut self, _event: &ControllerEvent, _ctx: &mut EventCtx, ) -> Propagation

Receives a high-level result from one of the Widget’s controllers. Read more
Source§

fn handles_capture(&self) -> bool

Returns true if this Widget wants input events in the capture phase. Read more
Source§

fn event_mask(&self) -> EventMask

Returns the classes of events this Widget wants to receive. Read more
Source§

fn get_id(&self) -> WidgetId

Returns the Widget’s ID. Read more
Source§

fn get_parent(&self) -> WidgetId

Returns the ID of the Widget’s parent. Read more
Source§

fn get_origin(&self) -> Point

Returns the Widget’s origin. Read more
Source§

fn get_size(&self) -> Size

Returns the Widget’s size. Read more
Source§

fn get_color(&self) -> Color

Returns the Widget’s main (background) color. Read more
Source§

fn set_origin(&mut self, point: Point)

Moves the Widget, and invalidates it. Read more
Source§

fn set_size(&mut self, size: Size)

Resizes the Widget, and invalidates it. Its texture is resized on the next repaint. Read more
Source§

fn set_color(&mut self, color: Color)

Sets the Widget’s main (background) color, and invalidates it. Read more
Source§

fn is_hidden(&self) -> bool

Returns whether the Widget is hidden. Read more
Source§

fn set_hidden(&mut self, state: bool)

Hides or shows the Widget and all of its children, and invalidates it. Read more
Source§

fn behavior(&self) -> Behavior

Returns what the Widget can do. Read more
Source§

fn set_behavior(&mut self, behavior: Behavior)

Replaces the Widget’s behavior flags, and invalidates it. Read more
Source§

fn state(&self) -> VisualState

Returns how the Widget currently looks. Read more
Source§

fn set_state(&mut self, state: VisualState)

Replaces the Widget’s visual state flags, and invalidates it only if the change can alter how it looks. Read more
Source§

fn appearance(&self) -> &Appearance

Returns the Widget’s per-state appearance. Read more
Source§

fn appearance_mut(&mut self) -> &mut Appearance

Returns the Widget’s per-state appearance for modification, and invalidates the Widget. Read more
Source§

fn set_style(&mut self, state: VisualState, style: StateStyle)

Sets the style for one visual state, and invalidates the Widget only if the effective style for its current state changed. Read more
Source§

fn style(&self) -> StateStyle

Returns the effective style for the Widget’s current state. Read more
Source§

fn is_enabled(&self) -> bool

Returns whether the Widget is enabled. Read more
Source§

fn set_enabled(&mut self, enabled: bool)

Enables or disables the Widget, and invalidates it if that changed it. Read more
Source§

fn is_focusable(&self) -> bool

Returns whether the Widget can take keyboard focus. Read more
Source§

fn accepts_text_input(&self) -> bool

Returns whether the Widget is a text editor. Read more
Source§

fn is_invalidated(&self) -> bool

Returns whether the Widget needs to be repainted. Read more
Source§

fn set_invalidated(&mut self, state: bool)

Sets whether the Widget needs to be repainted. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.