pub struct Label<State = ()> { /* private fields */ }
Expand description
A View
that displays text.
let label = Label::new("This is some text");
let label = Label::new(format!("What is 2 + 2? Correct, {}!", 2 + 2));
Implementations§
source§impl<State> Label<State>
impl<State> Label<State>
sourcepub fn new(text: impl Into<StateOrRaw<String>>) -> Self
pub fn new(text: impl Into<StateOrRaw<String>>) -> Self
Creates a new Label
with the associated string.
sourcepub fn with_color(self, color: impl Into<StateOrRaw<Color>>) -> Self
pub fn with_color(self, color: impl Into<StateOrRaw<Color>>) -> Self
Returns Self
with the given color
.
sourcepub fn with_background_color(self, color: impl Into<StateOrRaw<Color>>) -> Self
pub fn with_background_color(self, color: impl Into<StateOrRaw<Color>>) -> Self
Returns Self
with the given background color
.
sourcepub fn set_color(&mut self, color: impl Into<StateOrRaw<Color>>)
pub fn set_color(&mut self, color: impl Into<StateOrRaw<Color>>)
Sets the color of the Label
. Use Label::with_color()
to avoid
making a mut
variable.
sourcepub fn set_background_color(&mut self, color: impl Into<StateOrRaw<Color>>)
pub fn set_background_color(&mut self, color: impl Into<StateOrRaw<Color>>)
Sets the background color of the Label
. Use
Label::with_background_color()
to avoid making a mut
variable.
Trait Implementations§
source§impl<Delegate, State> From<Label<State>> for Box<dyn View<Delegate, State>>where
Delegate: AppDelegate<State> + 'static,
State: 'static,
impl<Delegate, State> From<Label<State>> for Box<dyn View<Delegate, State>>where
Delegate: AppDelegate<State> + 'static,
State: 'static,
source§impl<Delegate, State: 'static> View<Delegate, State> for Label<State>where
Delegate: AppDelegate<State>,
impl<Delegate, State: 'static> View<Delegate, State> for Label<State>where
Delegate: AppDelegate<State>,
source§fn build_native(&mut self, tree: &mut ViewTree<State>, parent: HWND) -> WinView
fn build_native(&mut self, tree: &mut ViewTree<State>, parent: HWND) -> WinView
Internal API: creates a native view (for Win32).
Auto Trait Implementations§
impl<State = ()> !RefUnwindSafe for Label<State>
impl<State = ()> !Send for Label<State>
impl<State = ()> !Sync for Label<State>
impl<State> Unpin for Label<State>
impl<State = ()> !UnwindSafe for Label<State>
Blanket Implementations§
source§impl<T> BaseViewExt for Twhere
T: BaseView,
impl<T> BaseViewExt for Twhere
T: BaseView,
source§fn set_tooltip(&mut self, tooltip: impl Into<StateOrRaw<String>>)
fn set_tooltip(&mut self, tooltip: impl Into<StateOrRaw<String>>)
Set the tooltip of the view, which is text that is commonly displayed
when hovering over a component (such as a button). This is used to
provide the user with more context, or to let them know what the action
will do.
source§fn with_tooltip(self, tooltip: impl Into<StateOrRaw<String>>) -> T
fn with_tooltip(self, tooltip: impl Into<StateOrRaw<String>>) -> T
Set the tooltip of the view, which is text that is commonly displayed
when hovering over a component (such as a button). This is used to
provide the user with more context, or to let them know what the action
will do.
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