pub struct GlyphSample { /* private fields */ }Expand description
A few icons drawn in one GlyphMode, whatever mode the application draws in.
No program can learn which font a terminal draws with, so the last word on Nerd Font glyphs
is the user’s eye: a setup screen puts a Nerd sample beside a Unicode one and asks which reads
as shapes. A missing Nerd Font shows as boxes or question marks. Place one after installing
the font (see nerd_font) to show whether the terminal picked it up.
use qframe::icons::{GlyphMode, GlyphSample};
let nerd = GlyphSample::new(GlyphMode::Nerd);
let unicode = GlyphSample::new(GlyphMode::Unicode).keys(["folder", "check"]);The glyphs come from the active icon set, so a theme’s icons show as they would be drawn.
They use the text colour on no background of their own.
Implementations§
Source§impl GlyphSample
impl GlyphSample
Sourcepub const KEYS: [&str; 4]
pub const KEYS: [&str; 4]
The icons shown unless GlyphSample::keys names others: four whose Nerd glyphs lie in
the private use area, so none of them looks right without a Nerd Font.
Sourcepub fn new(mode: GlyphMode) -> Self
pub fn new(mode: GlyphMode) -> Self
A sample of GlyphSample::KEYS in mode.
Sourcepub fn keys(self, keys: impl IntoIterator<Item = impl Into<String>>) -> Self
pub fn keys(self, keys: impl IntoIterator<Item = impl Into<String>>) -> Self
Shows these icon keys instead, in order. A key the icon set lacks is left out.
Trait Implementations§
Source§impl Clone for GlyphSample
impl Clone for GlyphSample
Source§fn clone(&self) -> GlyphSample
fn clone(&self) -> GlyphSample
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GlyphSample
impl Debug for GlyphSample
impl Eq for GlyphSample
Source§impl PartialEq for GlyphSample
impl PartialEq for GlyphSample
impl StructuralPartialEq for GlyphSample
Source§impl<Msg: 'static> Widget<Msg> for GlyphSample
impl<Msg: 'static> Widget<Msg> for GlyphSample
Source§fn measure(&self, cx: &mut MeasureCx<'_>, available: Size) -> Size
fn measure(&self, cx: &mut MeasureCx<'_>, available: Size) -> Size
available.Source§fn paint_overlay(&self, _cx: &mut PaintCx<'_>, _anchor: Rect)
fn paint_overlay(&self, _cx: &mut PaintCx<'_>, _anchor: Rect)
PaintCx::request_overlay. anchor is the area the widget was painted in.Source§fn event(&self, _cx: &mut EventCx<'_, Msg>, _event: &Event) -> bool
fn event(&self, _cx: &mut EventCx<'_, Msg>, _event: &Event) -> bool
true when the event was used; unused key and scroll events
bubble to the parent widget.Source§fn children_mut(&mut self) -> &mut [Node<Msg>]
fn children_mut(&mut self) -> &mut [Node<Msg>]
Auto Trait Implementations§
impl Freeze for GlyphSample
impl RefUnwindSafe for GlyphSample
impl Send for GlyphSample
impl Sync for GlyphSample
impl Unpin for GlyphSample
impl UnsafeUnpin for GlyphSample
impl UnwindSafe for GlyphSample
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more