pub struct Button { /* private fields */ }Implementations§
Source§impl Button
impl Button
pub fn new(text: &str, renderer: &Renderer) -> Self
pub fn set_text(&mut self, text: &str, renderer: &Renderer)
pub fn set_font_size(&mut self, size: f32, renderer: &Renderer)
pub fn set_background_color(&mut self, color: Color)
pub fn set_text_color(&mut self, color: Color)
pub fn set_border_color(&mut self, color: Color)
pub fn set_border_width(&mut self, width: f32)
pub fn set_padding(&mut self, padding: f32, renderer: &Renderer)
pub fn set_on_click<F>(&mut self, callback: F)where
F: FnMut() + 'static,
pub fn set_pressed_background_color(&mut self, color: Color)
pub fn set_pressed_border_color(&mut self, color: Color)
pub fn set_pressed_text_color(&mut self, color: Color)
pub fn set_hover_background_color(&mut self, color: Color)
pub fn set_hover_border_color(&mut self, color: Color)
pub fn set_hover_text_color(&mut self, color: Color)
pub fn set_on_hover<F>(&mut self, callback: F)
pub fn update_hover(&mut self, x: f32, y: f32)
pub fn has_fade_animation(&self) -> bool
Trait Implementations§
Source§impl Widget for Button
impl Widget for Button
fn get_position(&self) -> (f32, f32)
fn get_size(&self) -> (f32, f32)
fn get_background_color(&self) -> Color
fn get_text_color(&self) -> Color
fn get_hover_background_color(&self) -> Color
fn get_hover_text_color(&self) -> Color
fn get_opacity(&self) -> f32
fn get_is_hovered(&self) -> bool
fn get_is_pressed(&self) -> bool
fn draw(&self, renderer: &mut Renderer, screen_width: f32, screen_height: f32)
fn set_size(&mut self, width: f32, height: f32)
fn position(&self) -> (f32, f32)
fn size(&self) -> (f32, f32)
fn set_position(&mut self, x: f32, y: f32)
fn on_mouse_press(&mut self, _x: f32, _y: f32) -> bool
fn on_mouse_release(&mut self, x: f32, y: f32) -> bool
fn set_on_click<F>(&mut self, callback: F)where
F: FnMut() + 'static,
fn set_on_hover<F>(&mut self, callback: F)
fn set_position_animation(&mut self, animation: Vec2Animation)
fn set_fade_animation(&mut self, animation: FadeAnimation)
fn update_animations(&mut self, delta_time: f32)
fn contains_point(&self, x: f32, y: f32) -> bool
fn animate_position(&mut self, target_x: f32, target_y: f32, duration: f32)
fn animate_fade(&mut self, start: f32, end: f32, duration: f32)
fn resize_by_window_size(&mut self, scale_x: f32, scale_y: f32)
Auto Trait Implementations§
impl Freeze for Button
impl !RefUnwindSafe for Button
impl !Send for Button
impl !Sync for Button
impl Unpin for Button
impl UnsafeUnpin for Button
impl !UnwindSafe for Button
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.