Struct egui::widgets::Label [−][src]
#[must_use = "You should put this widget in an ui with `ui.add(widget);`"]pub struct Label { /* fields omitted */ }
Static text.
ui.label("Equivalent"); ui.add(egui::Label::new("Equivalent")); ui.add(egui::Label::new("With Options").text_color(egui::Color32::RED));
Implementations
impl Label
[src]
impl Label
[src]pub fn new(text: impl ToString) -> Self
[src]
pub fn text(&self) -> &str
[src]
pub fn wrap(self, wrap: bool) -> Self
[src]
pub fn wrap(self, wrap: bool) -> Self
[src]If true
, the text will wrap at the max_width
.
By default Self::wrap
will be true in vertical layouts
and horizontal layouts with wrapping,
and false on non-wrapping horizontal layouts.
Note that any \n
in the text label will always produce a new line.
pub fn multiline(self, multiline: bool) -> Self
[src]
Use Label::wrap instead
pub fn text_style(self, text_style: TextStyle) -> Self
[src]
pub fn text_style(self, text_style: TextStyle) -> Self
[src]The default is Style::body_text_style
(generally TextStyle::Body
).
pub fn heading(self) -> Self
[src]
pub fn monospace(self) -> Self
[src]
pub fn strikethrough(self) -> Self
[src]
pub fn strikethrough(self) -> Self
[src]draw a line through the text, crossing it out
pub fn small_raised(self) -> Self
[src]
pub fn small_raised(self) -> Self
[src]For e.g. exponents
pub fn raised(self) -> Self
[src]
pub fn raised(self) -> Self
[src]Align text to top. Only applicable together with Self::small()
.
pub fn background_color(self, background_color: impl Into<Color32>) -> Self
[src]
pub fn background_color(self, background_color: impl Into<Color32>) -> Self
[src]Fill-color behind the text
pub fn text_color(self, text_color: impl Into<Color32>) -> Self
[src]
pub fn sense(self, sense: Sense) -> Self
[src]
pub fn sense(self, sense: Sense) -> Self
[src]Make the label respond to clicks and/or drags.
By default, a label is inert and does not respond to click or drags. By calling this you can turn the label into a button of sorts. This will also give the label the hover-effect of a button, but without the frame.
if ui.add(Label::new("click me").sense(Sense::click())).clicked() { /* … */ }
impl Label
[src]
impl Label
[src]pub fn layout(&self, ui: &Ui) -> Arc<Galley>
[src]
pub fn layout_width(&self, ui: &Ui, max_width: f32) -> Arc<Galley>
[src]
pub fn font_height(&self, fonts: &Fonts, style: &Style) -> f32
[src]
pub fn paint_galley(&self, ui: &mut Ui, pos: Pos2, galley: Arc<Galley>)
[src]
pub fn text_style_or_default(&self, style: &Style) -> TextStyle
[src]
pub fn text_style_or_default(&self, style: &Style) -> TextStyle
[src]Read the text style, or get the default for the current style