Trait Widget

Source
pub trait Widget {
Show 25 methods // Required methods 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_position(&mut self, x: f32, y: f32); fn set_size(&mut self, width: f32, height: f32); fn position(&self) -> (f32, f32); fn size(&self) -> (f32, f32); fn set_position_animation(&mut self, animation: Vec2Animation); fn set_fade_animation(&mut self, animation: FadeAnimation); fn update_animations(&mut self, delta_time: f32); // Provided methods fn set_on_click<F>(&mut self, _callback: F) where F: FnMut() + 'static { ... } fn set_on_hover<F>(&mut self, _callback: F) where F: FnMut(bool) + 'static { ... } fn on_mouse_press(&mut self, _x: f32, _y: f32) -> bool { ... } fn on_mouse_release(&mut self, _x: f32, _y: f32) -> bool { ... } 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) { ... }
}

Required Methods§

Source

fn get_position(&self) -> (f32, f32)

Source

fn get_size(&self) -> (f32, f32)

Source

fn get_background_color(&self) -> Color

Source

fn get_text_color(&self) -> Color

Source

fn get_hover_background_color(&self) -> Color

Source

fn get_hover_text_color(&self) -> Color

Source

fn get_opacity(&self) -> f32

Source

fn get_is_hovered(&self) -> bool

Source

fn get_is_pressed(&self) -> bool

Source

fn draw(&self, renderer: &mut Renderer, screen_width: f32, screen_height: f32)

Source

fn set_position(&mut self, x: f32, y: f32)

Source

fn set_size(&mut self, width: f32, height: f32)

Source

fn position(&self) -> (f32, f32)

Source

fn size(&self) -> (f32, f32)

Source

fn set_position_animation(&mut self, animation: Vec2Animation)

Source

fn set_fade_animation(&mut self, animation: FadeAnimation)

Source

fn update_animations(&mut self, delta_time: f32)

Provided Methods§

Source

fn set_on_click<F>(&mut self, _callback: F)
where F: FnMut() + 'static,

Source

fn set_on_hover<F>(&mut self, _callback: F)
where F: FnMut(bool) + 'static,

Source

fn on_mouse_press(&mut self, _x: f32, _y: f32) -> bool

Source

fn on_mouse_release(&mut self, _x: f32, _y: f32) -> bool

Source

fn contains_point(&self, x: f32, y: f32) -> bool

Source

fn animate_position(&mut self, target_x: f32, target_y: f32, duration: f32)

Source

fn animate_fade(&mut self, start: f32, end: f32, duration: f32)

Source

fn resize_by_window_size(&mut self, scale_x: f32, scale_y: f32)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§