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§
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)>
sourcefn style<T: FromStyleAttribute + Default + 'static>(&mut self, key: &str) -> T
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.
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)>
sourcefn style_range(&mut self, key: &str, range: Range<f32>) -> f32
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
.