Enum me3_framework::overlay::WidgetText
source · [−]Expand description
This is how you specify text for a widget.
A lot of widgets use impl Into<WidgetText>
as an argument,
allowing you to pass in String
, RichText
, LayoutJob
, and more.
Often a WidgetText
is just a simple String
,
but it can be a RichText
(text with color, style, etc),
a LayoutJob
(for when you want full control of how the text looks)
or text that has already been layed out in a Galley
.
Variants
RichText(RichText)
LayoutJob(LayoutJob)
Use this LayoutJob
when laying out the text.
Only LayoutJob::text
and LayoutJob::sections
are guaranteed to be respected.
TextWrapping::max_width
, LayoutJob::halign
, LayoutJob::justify
and LayoutJob::first_row_min_height
will likely be determined by the crate::Layout
of the Ui
the widget is placed in.
If you want all parts of the LayoutJob
respected, then convert it to a
Galley
and use Self::Galley
instead.
Galley(Arc<Galley>)
Use exactly this galley when painting the text.
Implementations
sourceimpl WidgetText
impl WidgetText
pub fn is_empty(&self) -> bool
pub fn text(&self) -> &str
sourcepub fn text_style(self, text_style: TextStyle) -> WidgetText
pub fn text_style(self, text_style: TextStyle) -> WidgetText
sourcepub fn fallback_text_style(self, text_style: TextStyle) -> WidgetText
pub fn fallback_text_style(self, text_style: TextStyle) -> WidgetText
sourcepub fn color(self, color: impl Into<Color32>) -> WidgetText
pub fn color(self, color: impl Into<Color32>) -> WidgetText
sourcepub fn heading(self) -> WidgetText
pub fn heading(self) -> WidgetText
Prefer using RichText
directly!
sourcepub fn monospace(self) -> WidgetText
pub fn monospace(self) -> WidgetText
Prefer using RichText
directly!
sourcepub fn code(self) -> WidgetText
pub fn code(self) -> WidgetText
Prefer using RichText
directly!
sourcepub fn strong(self) -> WidgetText
pub fn strong(self) -> WidgetText
Prefer using RichText
directly!
sourcepub fn weak(self) -> WidgetText
pub fn weak(self) -> WidgetText
Prefer using RichText
directly!
sourcepub fn underline(self) -> WidgetText
pub fn underline(self) -> WidgetText
Prefer using RichText
directly!
sourcepub fn strikethrough(self) -> WidgetText
pub fn strikethrough(self) -> WidgetText
Prefer using RichText
directly!
sourcepub fn italics(self) -> WidgetText
pub fn italics(self) -> WidgetText
Prefer using RichText
directly!
sourcepub fn small(self) -> WidgetText
pub fn small(self) -> WidgetText
Prefer using RichText
directly!
sourcepub fn small_raised(self) -> WidgetText
pub fn small_raised(self) -> WidgetText
Prefer using RichText
directly!
sourcepub fn raised(self) -> WidgetText
pub fn raised(self) -> WidgetText
Prefer using RichText
directly!
sourcepub fn background_color(self, background_color: impl Into<Color32>) -> WidgetText
pub fn background_color(self, background_color: impl Into<Color32>) -> WidgetText
Prefer using RichText
directly!
pub fn into_text_job(
self,
style: &Style,
fallback_font: FontSelection,
default_valign: Align
) -> WidgetTextJob
sourcepub fn into_galley(
self,
ui: &Ui,
wrap: Option<bool>,
available_width: f32,
fallback_font: impl Into<FontSelection>
) -> WidgetTextGalley
pub fn into_galley(
self,
ui: &Ui,
wrap: Option<bool>,
available_width: f32,
fallback_font: impl Into<FontSelection>
) -> WidgetTextGalley
Layout with wrap mode based on the containing Ui
.
wrap: override for Ui::wrap_text
.
Trait Implementations
sourceimpl Clone for WidgetText
impl Clone for WidgetText
sourcefn clone(&self) -> WidgetText
fn clone(&self) -> WidgetText
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more