pub struct TextWidget { /* private fields */ }Expand description
Text Widget.
Trait Implementations§
Source§impl Default for TextWidget
impl Default for TextWidget
Source§fn default() -> TextWidget
fn default() -> TextWidget
Returns the “default value” for a type. Read more
Source§impl Widget for TextWidget
Implementation for drawing a TextWidget, with the Widget trait objects applied.
impl Widget for TextWidget
Implementation for drawing a TextWidget, with the Widget trait objects applied.
Source§fn draw(
&mut self,
c: &mut Canvas<Window>,
t: &mut TextureCache,
) -> Option<&Texture>
fn draw( &mut self, c: &mut Canvas<Window>, t: &mut TextureCache, ) -> Option<&Texture>
This is the draw implementation of the TextWidget. It uses the following properties:
- PROPERTY_MAIN_COLOR: the
Colorof the body of theWidget - PROPERTY_BORDER_WIDTH: the width of the border to draw
- PROPERTY_BORDER_COLOR: the
Colorof the border. - PROPERTY_FONT_COLOR: the color of the font
- PROPERTY_FONT_NAME: full or relative path to the font file to use to render the text
- PROPERTY_FONT_SIZE: the size in points of the font
- PROPERTY_FONT_STYLE: the
FontStyleto apply to the font - PROPERTY_TEXT_JUSTIFICATION: The
TEXT_JUSTIFY_*constant to use to position the text inside theWidget - PROPERTY_TEXT:
Stringcontaining the text to display
Source§fn properties(&mut self) -> &mut WidgetProperties
fn properties(&mut self) -> &mut WidgetProperties
This provides access to the
WidgetProperties set for a Widget. These must be defined
in the structure of the Widget, as they allow for direct manipulation of the properties.Source§fn widget_name(&self) -> String
fn widget_name(&self) -> String
Returns the name of the type of
Widget. Must be implemented by Widgets, as this helps
with (de)serialization.Source§fn handle_event(&mut self, _e: PushrodEvent) -> Option<PushrodEvent>
fn handle_event(&mut self, _e: PushrodEvent) -> Option<PushrodEvent>
Handles a
PushrodEvent sent to the Widget that would also be sent to the application.
If any PushrodEvents trigger a custom Widget-based event, this function can intercept
the incoming event, and issue one of its own. If the function returns no events, a
None can be returned, otherwise a Some(PushrodEvent) should be returned. If this
function returns an event, that event will be sent on to the application as soon as it has
been generated.Source§fn build_layout(&mut self) -> Vec<Box<dyn Widget>>
fn build_layout(&mut self) -> Vec<Box<dyn Widget>>
This is called when
PROPERTY_NEEDS_LAYOUT is enabled in properties. When a layout is
required to be built, this function is called, returning the list of Widgets that are
to be added. If no Widgets are to be added, an empty list is valid to return here.
Otherwise, the list of Widgets that this parent Widget controls are returned as a
list here.Source§fn constructed_layout_ids(&mut self, _ids: Vec<u32>)
fn constructed_layout_ids(&mut self, _ids: Vec<u32>)
After a
build_layout call has been completed, the list of IDs that were added to the display
list are returned in the same order in from build_layout. The Widget that created
these IDs should then store them here in an array, so that they can be referenced when
interacted with.Source§fn invalidate(&mut self)
fn invalidate(&mut self)
Set the invalidation key for this
Widget, indicating that the TextureCache needs to
be redrawn.Source§fn invalidated(&mut self) -> bool
fn invalidated(&mut self) -> bool
Flag indicating whether or not the
draw method needs to be called for this Widget so
that its TextureCache is refreshed.Auto Trait Implementations§
impl Freeze for TextWidget
impl RefUnwindSafe for TextWidget
impl !Send for TextWidget
impl !Sync for TextWidget
impl Unpin for TextWidget
impl UnwindSafe for TextWidget
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more