[][src]Struct pushrod::render::widget_config::WidgetConfig

pub struct WidgetConfig {
    pub origin: Vec<i32>,
    pub size: Vec<u32>,
    pub colors: HashMap<u8, Color>,
    pub border_width: u8,
    // some fields omitted
}

This is the store for the WidgetConfig, which each Widget object needs. This stores information about the Widget. It currently contains the point of origin, size, a HashMap of different Colors, a border width, and an invalidation flag.

Fields

origin: Vec<i32>

This Vec contains two points of origin: the physical X and Y coordinates in the Canvas.

size: Vec<u32>

This Vec contains the width and height of the object.

colors: HashMap<u8, Color>

This HashMap contains a key/value pair containing colors for the Widget.

border_width: u8

This is the border width in pixels.

Implementations

impl WidgetConfig[src]

This is the implementation of the WidgetConfig.

pub fn new(x: i32, y: i32, w: u32, h: u32) -> Self[src]

Constructor - takes the X, Y, W, and H coordinates of the Widget, physically in the main Canvas.

pub fn to_x(&self, x: i32) -> i32[src]

Converts an X point to the physical X point on the Canvas plus the point of origin. Returns i32 containing the modified X coordinate. This is a convenience method for the Widget to draw based on a 0x0 point of origin.

pub fn to_y(&self, y: i32) -> i32[src]

Converts a Y point to the physical Y point on the Canvas plus the point of origin. Returns i32 containing the modified Y coordinate. This is a convenience method for the Widget to draw based on a 0x0 point of origin.

pub fn set_invalidate(&mut self, flag: bool)[src]

Sets the invalidation state of the Widget, telling the Engine that the Widget contents has changed, and must be redrawn. Setting the flag to true indicates that the Widget needs to be redrawn on the screen, false indicates that it its state has not changed, and its image can be pulled from a buffer if necessary, skipping the draw call.

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

Returns the invalidation state. Returns a bool containing the state.

pub fn enable(&mut self)[src]

Enables the Widget for interaction.

pub fn disable(&mut self)[src]

Disables the Widget, preventing interaction.

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

Indicates whether or not this Widget is enabled or disabled - true if enabled, false otherwise.

pub fn hide(&mut self)[src]

Prevents the Widget from being drawn on the screen, or being interacted with. No events are received by this Widget when hidden.

pub fn show(&mut self)[src]

Displays the Widget on the screen.

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

Indicates whether or not this Widget has been hidden from view - true if this Widget is hidden, false otherwise.

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.