[−][src]Struct pushrod::widget::box_widget::BoxWidget
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.
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(Point { x: 100, y: 100 }); box_widget.set_size(pushrod::core::point::Size { w: 200, h: 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);
fn get_config(&mut self) -> &RefCell<HashMap<ConfigKey, WidgetConfig>>
[src]
fn set_origin(&mut self, point: Point)
[src]
Sets the Point
of origin for this widget and the base widget. Invalidates the widget afterward.
fn set_size(&mut self, size: Size)
[src]
Sets the Size
for this widget and the base widget. 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 mouse_entered(&mut self, widget_id: i32)
[src]
fn mouse_exited(&mut self, widget_id: i32)
[src]
fn mouse_scrolled(&mut self, widget_id: i32, point: Point)
[src]
fn draw(&mut self, context: Context, graphics: &mut GlGraphics)
[src]
Draws the contents of the widget in this order:
- Base widget first
- Box graphic for the specified width
fn set_config(&mut self, key: u8, value: WidgetConfig)
[src]
Sets a configuration object by its key.
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
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.