[][src]Struct pushrod::core::window::PushrodWindow

pub struct PushrodWindow {
    pub window: PistonWindow,
    pub widgets: Vec<WidgetContainer>,
    pub texture: Texture,
    pub fbo: GLuint,
    // some fields omitted
}

This structure contains a window and its corresponding onscreen widgets. These objects are stored in the Pushrod main loop.

Fields

window: PistonWindow

A piston_window::PistonWindow object.

widgets: Vec<WidgetContainer>

A vector list of Boxed PushrodWidget trait objects.

texture: Texture

The texture against which objects may be drawn.

fbo: GLuint

Framebuffer Object ID, stored for drawing on the texture.

Methods

impl PushrodWindow[src]

Implementation for a new PushrodWindow. When a new PushrodWindow is added to the managed window stack in the Pushrod main loop, this object is created to store its components.

pub fn new(window: PistonWindow) -> Self[src]

Constructor, takes a managed PistonWindow from the piston_window crate. Adds a top-level widget to the list that is a white container widget. This is the base for all other widgets tht will be added to the window.

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 prepare_buffers(&mut self)[src]

Prepares the initial buffers for drawing. Do not call more than once.

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 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 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 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

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 = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

impl<T> SetParameter for T

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