[−][src]Struct pushrod::widget::radio_button_widget::RadioButtonWidget
Draws a radio button with only one object that can be selected at any one time within a group.
Generates a WidgetSelected
event when an object has been selected within the group. Also
generates an internal UnselectRadioButtons
event, which should not be handled - this is only
used by RadioButtonWidget
objects.
Methods
impl RadioButtonWidget
[src]
pub fn new(
font_name: String,
text: String,
font_size: u32,
justify: TextJustify,
selected: bool
) -> Self
[src]
font_name: String,
text: String,
font_size: u32,
justify: TextJustify,
selected: bool
) -> Self
Constructor. Requires the name of the font, the text to display, the image name to display, the size of the font,
the font justification when rendered, and a selected pre-set state. Images are
loaded from the assets/
directory.
pub fn on_click<F>(&mut self, callback: F) where
F: FnMut(&mut RadioButtonWidget) + 'static,
[src]
F: FnMut(&mut RadioButtonWidget) + 'static,
Sets a callback closure that can be called when a click is registered for this widget.
pub fn click(&mut self)
[src]
Calls the click on_click
callback, if set. Otherwise, ignored. Sends a reference
of the current Widget
object as a parameter, so this object can be modified when
a click is registered, if necessary.
Trait Implementations
impl Drawable for RadioButtonWidget
[src]
fn draw(&mut self, c: Context, g: &mut GlGraphics, clip: &DrawState)
[src]
fn draw_with_offset(
&mut self,
c: Context,
g: &mut GlGraphics,
clip: &DrawState,
point_offset: Point
)
[src]
&mut self,
c: Context,
g: &mut GlGraphics,
clip: &DrawState,
point_offset: Point
)
Draws an object at an offset on the screen. This is a convenience method that is used by other Widget
s that contain multiple widgets. Draw with offset always uses 0x0 as the starting drawing coordinates, as this is what will be drawn within the bounds of the Widget
. (See CheckboxWidget
and ImageButtonWidget
for good examples of this use.) Read more
impl InjectableSystemEvents for RadioButtonWidget
[src]
fn inject_system_event(&mut self) -> Option<CallbackEvent>
[src]
Part of the main loop that queries the Widget
for any system-level events that should be injected into the PushrodCallbackEvents
trait, and not handled by the top-level run loop. This sends out messages that are bypassed from being used by the Run Loop, so be very careful. Use this for sending things like custom messages (such as a Widget
move or Widget
resize message, which is irrelevant to the run loop.) Read more
impl InjectableCustomEvents for RadioButtonWidget
[src]
fn inject_custom_event(&mut self, widget_id: i32) -> Option<CallbackEvent>
[src]
impl Widget for RadioButtonWidget
[src]
fn config(&mut self) -> &mut Configurable
[src]
fn set_config(&mut self, config: u8, config_value: Config)
[src]
fn handle_event(
&mut self,
injected: bool,
event: CallbackEvent,
_widget_store: Option<&Vec<WidgetContainer>>
) -> Option<CallbackEvent>
[src]
&mut self,
injected: bool,
event: CallbackEvent,
_widget_store: Option<&Vec<WidgetContainer>>
) -> Option<CallbackEvent>
fn handles_events(&mut self) -> bool
[src]
fn injects_custom_events(&mut self) -> bool
[src]
fn set_widget_id(&mut self, widget_id: i32)
[src]
fn get_widget_id(&mut self) -> i32
[src]
fn get_injectable_custom_events(&mut self) -> &mut dyn InjectableCustomEvents
[src]
fn get_injectable_system_events(&mut self) -> &mut dyn InjectableSystemEvents
[src]
fn get_drawable(&mut self) -> &mut dyn Drawable
[src]
fn invalidate(&mut self)
[src]
Indicates that a Widget
object needs to be repainted.
fn clear_invalidate(&mut self)
[src]
Clears the invalidation flag. Set this when the draw
function completes. Otherwise, this Widget
object may be continuously repainted. Read more
fn is_invalidated(&mut self) -> bool
[src]
Indicates whether or not a Widget
needs to be repainted.
fn get_config(&mut self, config: u8) -> Option<&Config>
[src]
Master config getter - use convenience methods.
fn set_point(&mut self, config: u8, x: i32, y: i32)
[src]
Sets a point value for a configuration key.
fn set_size(&mut self, config: u8, w: i32, h: i32)
[src]
Sets a size value for a configuration key.
fn set_color(&mut self, config: u8, color: Color)
[src]
Sets a color for a configuration key.
fn set_numeric(&mut self, config: u8, value: u64)
[src]
Sets a numeric value for a configuration key.
fn set_text(&mut self, config: u8, text: String)
[src]
Sets a text value for a configuration key.
fn set_toggle(&mut self, config: u8, flag: bool)
[src]
Sets a toggle value for a configuration key.
fn is_drawable(&mut self) -> bool
[src]
Describes whether or not the Widget
returns a Drawable
trait. This function is called each time a frame is refreshed, so if there is no Drawable
available, this function could serve as a way to indicate a frame tick. Only override this to set it to false
if your Widget
does not draw anything on the screen. Read more
fn injects_system_events(&mut self) -> bool
[src]
Indicates to the run loop whether or not a Widget
injects system-level events.
Auto Trait Implementations
impl !Send for RadioButtonWidget
impl Unpin for RadioButtonWidget
impl !Sync for RadioButtonWidget
impl !UnwindSafe for RadioButtonWidget
impl !RefUnwindSafe for RadioButtonWidget
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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
.