Trait Context

Source
pub trait Context {
Show 33 methods // Required methods fn stylesheet(&self) -> &Stylesheet; fn state(&self) -> &NodeState; fn state_mut(&mut self) -> &mut NodeState; fn renderer(&self) -> &dyn Renderer; fn selectors(&self) -> &StyleSelectors; fn event_sink(&self) -> &EventSink; fn image_cache(&self) -> &ImageCache; fn image_cache_mut(&mut self) -> &mut ImageCache; // Provided methods fn get_style_attribute(&self, key: &str) -> Option<StyleAttribute> { ... } fn get_style_attribute_specificity( &self, key: &str, ) -> Option<(StyleAttribute, StyleSpecificity)> { ... } fn get_style<T: FromStyleAttribute + 'static>( &mut self, key: &str, ) -> Option<T> { ... } fn get_style_specificity<T: FromStyleAttribute + 'static>( &mut self, key: &str, ) -> Option<(T, StyleSpecificity)> { ... } fn style<T: FromStyleAttribute + Default + 'static>( &mut self, key: &str, ) -> T { ... } fn style_group<T: FromStyleAttribute + Default + 'static>( &mut self, primary_key: &str, secondary_key: &str, ) -> T { ... } fn get_style_range(&mut self, key: &str, range: Range<f32>) -> Option<f32> { ... } fn get_style_range_specificity( &mut self, key: &str, range: Range<f32>, ) -> Option<(f32, StyleSpecificity)> { ... } fn style_range(&mut self, key: &str, range: Range<f32>) -> f32 { ... } fn style_range_group( &mut self, primary_key: &str, secondary_key: &str, range: Range<f32>, ) -> f32 { ... } fn downcast_renderer<T: Renderer>(&self) -> Option<&T> { ... } fn load_image(&mut self, source: &ImageSource) -> ImageHandle { ... } fn active(&self) -> bool { ... } fn hovered(&self) -> bool { ... } fn focused(&self) -> bool { ... } fn focus(&mut self) { ... } fn unfocus(&mut self) { ... } fn activate(&mut self) { ... } fn deactivate(&mut self) { ... } fn local_rect(&self) -> Rect { ... } fn rect(&self) -> Rect { ... } fn size(&self) -> Vec2 { ... } fn request_redraw(&mut self) { ... } fn send_event(&self, event: impl Any + SendSync) { ... } fn delta_time(&self) -> f32 { ... }
}

Required Methods§

Source

fn stylesheet(&self) -> &Stylesheet

Source

fn state(&self) -> &NodeState

Source

fn state_mut(&mut self) -> &mut NodeState

Source

fn renderer(&self) -> &dyn Renderer

Source

fn selectors(&self) -> &StyleSelectors

Source

fn event_sink(&self) -> &EventSink

Source

fn image_cache(&self) -> &ImageCache

Source

fn image_cache_mut(&mut self) -> &mut ImageCache

Provided Methods§

Source

fn get_style_attribute(&self, key: &str) -> Option<StyleAttribute>

Source

fn get_style_attribute_specificity( &self, key: &str, ) -> Option<(StyleAttribute, StyleSpecificity)>

Source

fn get_style<T: FromStyleAttribute + 'static>(&mut self, key: &str) -> Option<T>

Source

fn get_style_specificity<T: FromStyleAttribute + 'static>( &mut self, key: &str, ) -> Option<(T, StyleSpecificity)>

Source

fn style<T: FromStyleAttribute + Default + 'static>(&mut self, key: &str) -> T

Get the value of a style attribute, if it has a transition, the value will be interpolated between the current value and the new value.

Source

fn style_group<T: FromStyleAttribute + Default + 'static>( &mut self, primary_key: &str, secondary_key: &str, ) -> T

Source

fn get_style_range(&mut self, key: &str, range: Range<f32>) -> Option<f32>

Source

fn get_style_range_specificity( &mut self, key: &str, range: Range<f32>, ) -> Option<(f32, StyleSpecificity)>

Source

fn style_range(&mut self, key: &str, range: Range<f32>) -> f32

Get the value of a style attribute, if it has a transition, the value will be interpolated between the current value and the new value.

This is a convenience method for getting a value in pixels, as opposed to style which returns a Unit.

Source

fn style_range_group( &mut self, primary_key: &str, secondary_key: &str, range: Range<f32>, ) -> f32

Source

fn downcast_renderer<T: Renderer>(&self) -> Option<&T>

Source

fn load_image(&mut self, source: &ImageSource) -> ImageHandle

Source

fn active(&self) -> bool

Source

fn hovered(&self) -> bool

Source

fn focused(&self) -> bool

Source

fn focus(&mut self)

Source

fn unfocus(&mut self)

Source

fn activate(&mut self)

Source

fn deactivate(&mut self)

Source

fn local_rect(&self) -> Rect

Source

fn rect(&self) -> Rect

Source

fn size(&self) -> Vec2

Source

fn request_redraw(&mut self)

Source

fn send_event(&self, event: impl Any + SendSync)

Source

fn delta_time(&self) -> 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§

Source§

impl<'a> Context for DrawContext<'a>

Source§

impl<'a> Context for EventContext<'a>

Source§

impl<'a> Context for LayoutContext<'a>