pub struct IconButton<'a> { /* private fields */ }Expand description
Icon button with theme-aware styling
A square button containing a single icon. Supports hover, pressed, selected and disabled states with proper theme colors; a selected button is filled with the accent.
§Example
use egui_charts::icons::icons;
use egui_charts::ui_kit::buttons::{ButtonSize, IconButton};
let response = IconButton::new(&icons::TREND_LINE)
.size(ButtonSize::MD)
.tooltip("Trend Line (Alt+T)")
.selected(is_active)
.show(ui);
if response.clicked() {
// select the trend line tool
}Implementations§
Source§impl<'a> IconButton<'a>
impl<'a> IconButton<'a>
Sourcepub fn size(self, size: ButtonSize) -> Self
pub fn size(self, size: ButtonSize) -> Self
Set the button size
Sourcepub fn selected(self, selected: bool) -> Self
pub fn selected(self, selected: bool) -> Self
Set whether the button is in selected/active state
Sourcepub fn icon_scale(self, scale: f32) -> Self
pub fn icon_scale(self, scale: f32) -> Self
Set the icon size as a fraction of the button size (0.1-1.0).
By default the icon is 16, 20 or 24 px for small, medium and larger buttons.
Auto Trait Implementations§
impl<'a> Freeze for IconButton<'a>
impl<'a> RefUnwindSafe for IconButton<'a>
impl<'a> Send for IconButton<'a>
impl<'a> Sync for IconButton<'a>
impl<'a> Unpin for IconButton<'a>
impl<'a> UnsafeUnpin for IconButton<'a>
impl<'a> UnwindSafe for IconButton<'a>
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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