[][src]Struct pushrod::widget::box_widget::BoxWidget

pub struct BoxWidget { /* fields omitted */ }

This is the BoxWidget, which contains a top-level widget for display, overriding the draw method to draw the base widget and the border for this box.

Methods

impl BoxWidget[src]

Implementation of the constructor for the BaseWidget. Creates a new base widget that can be positioned anywhere on the screen.

pub fn new() -> Self[src]

pub fn set_border_color(&mut self, color: Color)[src]

Sets the border color for this widget.

pub fn get_border_color(&mut self) -> Color[src]

Retrieves the border color of this widget. Defaults to black color [0.0, 0.0, 0.0, 1.0] if not set.

pub fn set_border_thickness(&mut self, thickness: u8)[src]

Sets the thickness of the border for this widget.

pub fn get_border_thickness(&mut self) -> u8[src]

Retrieves the border thickness of this widget. Defaults to 1 if not set.

pub fn set_border(&mut self, color: Color, thickness: u8)[src]

Helper function that sets both the color of the border and the thickness at the same time.

Trait Implementations

impl Widget for BoxWidget[src]

Implementation of the BoxWidget object with the Widget traits implemented. This implementation is similar to the BaseWidget, but incorporates a drawable box inside the widget. Base widget is the BaseWidget.

This is basically just a box with a fill color. Use this to draw other things like buttons, text widgets, and so on, if you need anything with a drawable border.

Example usage:

   let mut box_widget = BoxWidget::new();

   box_widget.set_origin(100, 100);
   box_widget.set_size(200, 200);
   box_widget.set_color([0.5, 0.5, 0.5, 1.0]);
   box_widget.set_border_color([0.0, 0.0, 0.0, 1.0]);
   box_widget.set_border_thickness(3);

   // (OR)

   box_widget.set_border([0.0, 0.0, 0.0, 1.0], 3);

fn set_origin(&mut self, x: i32, y: i32)[src]

Sets the Point of origin for this widget and the base widget, given the X and Y coordinates. Invalidates the widget afterward.

fn set_size(&mut self, w: i32, h: i32)[src]

Sets the Size for this widget and the base widget, given width and height. Invalidates the widget afterward.

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

Sets the color for this widget. Invalidates the widget afterward.

fn get_color(&mut self) -> Color[src]

Retrieves the color of this widget. Defaults to white color [1.0; 4] if not set.

fn draw(&mut self, c: Context, g: &mut G2d)[src]

Draws the contents of the widget in this order:

  • Base widget first
  • Box graphic for the specified width

fn invalidate(&mut self)[src]

Indicates that a widget needs to be redrawn/refreshed.

fn clear_invalidate(&mut self)[src]

Clears the invalidation flag.

fn is_invalidated(&mut self) -> bool[src]

Checks to see whether or not the widget needs to be redrawn/refreshed.

fn get_origin(&mut self) -> Point[src]

Retrieves the Point of origin for this object. Defaults to origin (0, 0) if not set. Read more

fn get_size(&mut self) -> Size[src]

Retrieves the Size bounds for this widget. Defaults to size (0, 0) if not set. Read more

fn set_autoclip(&mut self, clip: bool)[src]

fn get_autoclip(&mut self) -> bool[src]

Auto Trait Implementations

impl Send for BoxWidget

impl Sync for BoxWidget

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<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> Any for T where
    T: 'static + ?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

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

The type returned in the event of a conversion error.

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