[][src]Struct pushrod::core::widget_store::WidgetStore

pub struct WidgetStore {
    pub widgets: Vec<WidgetContainer>,
}

This is the WidgetStore, which is used to store Widget objects for a Pushrod management object.

Fields

widgets: Vec<WidgetContainer>

A vector list of WidgetContainer objects.

Methods

impl WidgetStore[src]

Implementation of the WidgetStore.

pub fn new() -> Self[src]

Creates a new WidgetStore.

pub fn invalidate_all_widgets(&mut self)[src]

Invalidates all widgets in the window. This is used to force a complete refresh of the window's contents, usually based on a timer expiration, or a window resize. Use with care, as this is an expensive operation.

pub fn needs_repaint(&mut self) -> bool[src]

Indicates whether or not any Widgets in the WidgetStore have been invalidated and need to be repainted.

pub fn add_widget(&mut self, name: &str, widget: Box<dyn Widget>) -> i32[src]

Adds a UI Widget to this window. Widget objects that are added using this method will be part of the base widget (id = 0), and will be force-redrawn when the parent is invalidated.

After adding a widget, the ID of the widget is returned.

pub fn add_widget_to_parent(
    &mut self,
    name: &str,
    widget: Box<dyn Widget>,
    parent_id: i32
) -> i32
[src]

Adds a UI Widget to the parent of a window, specified by the parent_id. The parent_id must be an object that already exists in the stack.

After adding a widget, the ID of the widget is returned.

pub fn get_parent_of(&mut self, widget_id: i32) -> i32[src]

Retrieves the parent of the widget requested. Parent of 0 or -1 will always return 0.

pub fn get_children_of(&self, parent_id: i32) -> Vec<i32>[src]

Retrieves a list of all of the child IDs that list the parent_id as its parent. This can be used recursively to determine the widget ownership tree, or the redraw order in which repaint should take place.

pub fn get_widget_id_for_point(&mut self, point: Point) -> i32[src]

Retrieves a PushrodWidget ID for a specified Point. If no ID could be found, defaults to a -1.

pub fn get_name_for_widget_id(&mut self, widget_id: i32) -> &str[src]

Returns the name of the widget by its ID.

pub fn handle_event(
    &mut self,
    widget_id: i32,
    event: CallbackEvent
) -> Option<CallbackEvent>
[src]

Handles event messages, returning an event if provided by the Widget.

pub fn draw(&mut self, widget_id: i32, c: Context, g: &mut G2d)[src]

Recursive draw object: paints objects in order of appearance on the screen. This does not account for object depth, but it is implied that objects' parents are displayed in stacking order. Therefore, the parent is drawn first, then sibling, and other siblings. This draw function is used by the Pushrod main loop, and is meant to be called in a draw_2d closure.

pub fn get_widget_for_name(&mut self, name: &str) -> &RefCell<Box<dyn Widget>>[src]

Retrieves a widget by the name when the widget was added. To get the very top-level widget, refer to _WidgetStoreBase.

pub fn get_widget_for_id(&mut self, id: i32) -> &RefCell<Box<dyn Widget>>[src]

Retrieves a reference to the Boxed Widget object by its ID. To get the very top-level widget, specify ID 0.

Auto Trait Implementations

impl !Send for WidgetStore

impl !Sync for WidgetStore

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> SetParameter for T

default fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.

impl<T> Erased for T