Struct WidgetContainer

Source
pub struct WidgetContainer {
    pub widget: RefCell<Box<dyn Widget>>,
    pub origin: Vec<i32>,
    /* private fields */
}
Expand description

This is a container that stores information about a Widget that will be drawn on the screen. It stores the Widget object, the actual point of origin inside the Window (as a Vec<i32> of X and Y points), the parent ID of this Widget, if it is being added as a child.

Fields§

§widget: RefCell<Box<dyn Widget>>§origin: Vec<i32>

Implementations§

Source§

impl WidgetContainer

This is the WidgetContainer object that stores a Widget and its accompanying information: its name, point of origin, and parent ID.

Source

pub fn new( widget: Box<dyn Widget>, widget_name: String, origin: Vec<i32>, widget_id: i32, parent_id: i32, ) -> Self

Creates a new WidgetContainer storage object.

Source

pub fn get_widget_name(&self) -> String

Retrieves the name of this Widget.

Source

pub fn get_widget_id(&self) -> i32

Retrieves the numeric ID of this Widget.

Source

pub fn get_parent_id(&self) -> i32

Retrieves the numeric ID of the parent that this Widget refers to. A 0 indicates no parent is assigned.

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

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.