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

pub struct WidgetConfig {
    pub config: HashMap<u8, Config>,
    // 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

config: HashMap<u8, Config>

The HashMap store for configuration objects.

Methods

impl WidgetConfig[src]

This is the implementation of the WidgetConfig.

pub fn new(points: Points, size: Size) -> 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_invalidated(&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.

pub fn set_point(&mut self, config: u8, x: i32, y: i32)[src]

Sets a point for a configuration key.

pub fn set_size(&mut self, config: u8, w: u32, h: u32)[src]

Sets a size for a configuration key.

pub fn set_color(&mut self, config: u8, color: Color)[src]

Sets a color for a configuration key.

pub fn set_numeric(&mut self, config: u8, value: i32)[src]

Sets a numeric value for a configuration key.

pub fn set_text(&mut self, config: u8, text: String)[src]

Sets a text value for a configuration key.

pub fn set_toggle(&mut self, config: u8, flag: bool)[src]

Sets a toggle for a configuration key.

pub fn set_compass(&mut self, config: u8, value: CompassPosition)[src]

Sets a compass position for a configuration key.

pub fn set_padding(&mut self, config: u8, value: PaddingConstraint)[src]

Applies a PaddingConstraint.

pub fn get_point(&self, k: u8) -> Points[src]

Retrieves a Points for a configuration key. Returns Points::default if not set.

pub fn get_size(&self, k: u8) -> Size[src]

Retrieves a Size for a configuration key. Returns a Size::default if not set.

pub fn get_color(&self, k: u8) -> Color[src]

Retrieves a Color for a configuration key. Returns white if not set.

pub fn get_numeric(&self, k: u8) -> i32[src]

Retrieves a numeric value for a configuration key. Returns 0 if not set.

pub fn get_text(&self, k: u8) -> String[src]

Retrieves text for a configuration key. Returns a blank string if not set.

pub fn get_toggle(&self, k: u8) -> bool[src]

Retrieves a boolean toggle for a configuration key. Returns false if not set.

pub fn get_compass(&self, k: u8) -> CompassPosition[src]

Retrieves a CompassPosition toggle for a configuration key. Returns CompassPosition::W if not set.

pub fn get_padding(&self, k: u8) -> PaddingConstraint[src]

Retrieves a PaddingConstraint toggle for a configuration key. Returns empty PaddingConstraint if not set.

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.