pub struct Icons { /* private fields */ }Expand description
UI glyph cache, plus the Material file icons when that feature is on.
Implementations§
Source§impl Icons
impl Icons
Sourcepub fn register(&mut self, name: &str, svg: impl Into<Vec<u8>>)
pub fn register(&mut self, name: &str, svg: impl Into<Vec<u8>>)
Add or replace a glyph. Draw it in white so tinting works.
Sourcepub fn lucide_names() -> Vec<String>
Available on crate feature lucide-icons only.
pub fn lucide_names() -> Vec<String>
lucide-icons only.The names of the bundled Lucide icons, sorted.
Lucide names are resolved after the UI glyphs, so save keeps the workbench
glyph and lucide-save forces Lucide. trash-2 (a name only Lucide has) also
resolves. Both are drawn through the same white-tint pipeline.
Sourcepub fn lucide_search(query: &str) -> Vec<String>
Available on crate feature lucide-icons only.
pub fn lucide_search(query: &str) -> Vec<String>
lucide-icons only.Lucide icons matching query, best match first. Exact substring matches rank
before subsequence matches; an empty query returns every name.
Sourcepub fn texture(&mut self, ctx: &Context, name: &str) -> Option<TextureHandle>
pub fn texture(&mut self, ctx: &Context, name: &str) -> Option<TextureHandle>
The texture of a glyph, rasterized on first use.
Resolution order: registered custom SVG, bundled UI glyph, Lucide icon. Prefix a
name with lucide- to skip the UI set when both have it.
Sourcepub fn texture_sized(
&mut self,
ctx: &Context,
name: &str,
size: f32,
) -> Option<TextureHandle>
pub fn texture_sized( &mut self, ctx: &Context, name: &str, size: f32, ) -> Option<TextureHandle>
The texture of a glyph that stays crisp at size points on the current display.
Rasterized at exactly the painted size in device pixels (icon_pixels), so
it is drawn one texel per pixel at every zoom. A larger bitmap shrunk by the GPU
(no mipmaps) skips texels and reads pixelated below 100%, and a smaller one
stretched reads blurry at fractional scales.
Sourcepub fn paint(
&mut self,
ui: &Ui,
name: &str,
center: Pos2,
size: f32,
color: Color32,
) -> bool
pub fn paint( &mut self, ui: &Ui, name: &str, center: Pos2, size: f32, color: Color32, ) -> bool
Paint a glyph centered in rect at size, tinted with color.
Sourcepub fn put(
&mut self,
ui: &mut Ui,
name: &str,
center: Pos2,
size: f32,
color: Color32,
) -> bool
pub fn put( &mut self, ui: &mut Ui, name: &str, center: Pos2, size: f32, color: Color32, ) -> bool
Place a glyph as a widget at center with ui.put, like the workbench’s title-bar and
tab-strip buttons. Unlike Self::paint, this moves the layout cursor to the
glyph’s edge, so the next button in the row starts there and overlaps the previous
cell. That gives the workbench its compact button pitch (see metrics).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Icons
impl !UnwindSafe for Icons
impl Forget for Icons
impl Freeze for Iconswhere
*const u8 is !null: Freeze,
PhantomData<(String, Vec<u8>)>: Freeze,
PhantomData<(String, TextureHandle)>: Freeze,
impl Move for Icons
impl Send for Icons
impl Sync for Icons
impl Unpin for Icons
impl UnsafeUnpin for Iconswhere
*const u8 is !null: UnsafeUnpin,
PhantomData<(String, Vec<u8>)>: UnsafeUnpin,
PhantomData<(String, TextureHandle)>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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