[][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 handle_resize(&mut self, width: u32, height: u32)[src]

Handles the resizing of the texture buffer after the window resize has taken place. The behavior should be processed before drawing is rendered, so the sequence of events should be event -> handle_resize -> invalidate -> draw. This is mainly handled by the pushrod::core::main loop, but it can be handled programmatically if required.

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, 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,
    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 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 keypress_for_id(&mut self, id: i32, key: &Key, state: &ButtonState)[src]

Callback to key_pressed for a Widget by ID with its corresponding key, and button state (pressed or released)

pub fn mouse_entered_for_id(&mut self, id: i32)[src]

Callback to mouse_entered for a Widget by ID.

pub fn mouse_exited_for_id(&mut self, id: i32)[src]

Callback to mouse_exited for a Widget by ID.

pub fn mouse_scrolled_for_id(&mut self, id: i32, point: Point)[src]

Callback to mouse_scrolled for a Widget by ID, with the mouse scroll Point.

pub fn mouse_moved_for_id(&mut self, id: i32, point: Point)[src]

Callback to mouse_moved for a Widget by ID, with the mouse position at Point. The mouse point is relative to the Widget itself, not its position on the screen.

pub fn window_resized_for_id(&mut self, id: i32, size: Size)[src]

Callback to window_resized for a Widget by ID, with the new Size of the window.

pub fn handle_focus(&mut self, focus: bool)[src]

Callback to focused for a Widget by ID.

pub fn button_down(&mut self, id: i32, button: Button)[src]

Callback to button_down for a Widget by ID, with the button code.

pub fn button_up_inside(&mut self, id: i32, button: Button)[src]

Callback to button_up_inside for a Widget by ID, with the button code.

pub fn button_up_outside(&mut self, id: i32, button: Button)[src]

Callback to button_up_outside for a Widget by ID, with the button code.

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

Retrieves a reference to the Boxed Widget object by its ID.

Auto Trait Implementations

impl !Send for WidgetStore

impl !Sync for WidgetStore

Blanket Implementations

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

impl<T> From for 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> 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> Any for T where
    T: 'static + ?Sized
[src]

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