pub struct TextBlock { /* private fields */ }Expand description
Multi-line text component Breaks at each ‘\n’ Support text alignment
Implementations§
Source§impl TextBlock
impl TextBlock
pub const LINE_BREAK: char = '\n'
pub const WORD_BREAK: char = ' '
pub fn new(text: String) -> Self
Sourcepub fn set_text_alignment(&mut self, alignment: HorizontalAlignment)
pub fn set_text_alignment(&mut self, alignment: HorizontalAlignment)
Sets the alignment of the inner text
Sourcepub fn set_line_wrapping(&mut self, wrapping: bool)
pub fn set_line_wrapping(&mut self, wrapping: bool)
Sets the line wrapping of the text
pub fn set_focus_color(&mut self, color: Option<Color>)
Trait Implementations§
Source§impl HasWindowUID for TextBlock
impl HasWindowUID for TextBlock
Source§impl Widget for TextBlock
impl Widget for TextBlock
fn set_visibility(&mut self, visibility: bool)
fn set_width(&mut self, width: Size)
fn set_height(&mut self, height: Size)
fn set_margin(&mut self, margin: Thickness)
fn set_border(&mut self, border: BorderStyle)
fn set_alignment( &mut self, horizontal: HorizontalAlignment, vertical: VerticalAlignment, )
Source§fn set_enabled_state(&mut self, is_enabled: bool)
fn set_enabled_state(&mut self, is_enabled: bool)
Changing the IsEnabled state usually changes the highlight color
fn set_width_constraint(&mut self, width: SizeConstraint)
fn set_height_constraint(&mut self, height: SizeConstraint)
Source§impl WidgetColors for TextBlock
impl WidgetColors for TextBlock
fn set_disabled_color(&mut self, color: Option<Color>)
fn set_base_fg_color(&mut self, color: Option<Color>)
fn set_base_bg_color(&mut self, color: Option<Color>)
Source§impl Window for TextBlock
impl Window for TextBlock
Source§fn handle_event(&mut self, event: &mut WindowEvent)
fn handle_event(&mut self, event: &mut WindowEvent)
Source§fn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
Source§fn children(&mut self, builder: SubWindowBuilder) -> SubWindows
fn children(&mut self, builder: SubWindowBuilder) -> SubWindows
Returns all children windows (and layouting Rects)
Note: When changing the children make sure to also adjust the focus
Source§impl WindowLayout for TextBlock
impl WindowLayout for TextBlock
Source§fn desired_size(&self, available_size: TPoint) -> TPoint
fn desired_size(&self, available_size: TPoint) -> TPoint
Parents call this to get the desired size of the child
This must not exceed
available_size on any axis
When the result’s product is equal to 0, this window wont be drawnfn border(&self) -> BorderStyle
Source§fn alignment(&self) -> (HorizontalAlignment, VerticalAlignment)
fn alignment(&self) -> (HorizontalAlignment, VerticalAlignment)
fn is_visible(&self) -> bool
fn margin(&self) -> Thickness
Source§fn desired_size_pre_hook(&mut self, available_size: TPoint)
fn desired_size_pre_hook(&mut self, available_size: TPoint)
This is similar to desired_size but will not return anything and can mutably change self
This is executed before WindowLayout::desired_size
Only implement if actually necessary
Auto Trait Implementations§
impl Freeze for TextBlock
impl RefUnwindSafe for TextBlock
impl Send for TextBlock
impl Sync for TextBlock
impl Unpin for TextBlock
impl UnsafeUnpin for TextBlock
impl UnwindSafe for TextBlock
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
Source§impl<T> Downcast for T
impl<T> Downcast for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> WindowHelper for Twhere
T: Window,
impl<T> WindowHelper for Twhere
T: Window,
Source§fn provoke_changed_property(&self, property: WindowProperty)
fn provoke_changed_property(&self, property: WindowProperty)
Helper method for WindowEventQueue::provoke_changed_property