Skip to main content

IndicatorStyle

Trait IndicatorStyle 

Source
pub trait IndicatorStyle: Copy {
    type Shape: ContainsPoint + Transform + Clone;
    type State: Default + Copy;

    // Required methods
    fn padding(&self, state: &Self::State, height: i32) -> Insets;
    fn shape(
        &self,
        state: &Self::State,
        bounds: Rectangle,
        fill_width: u32,
    ) -> Self::Shape;
    fn draw<T, D>(
        &self,
        state: &Self::State,
        input_state: InputState,
        theme: &T,
        display: &mut D,
    ) -> Result<Self::Shape, D::Error>
       where T: Theme,
             D: DrawTarget<Color = T::Color>;

    // Provided methods
    fn on_target_changed(&self, _state: &mut Self::State) { ... }
    fn update(&self, _state: &mut Self::State, _input_state: InputState) -> bool { ... }
}

Required Associated Types§

Required Methods§

Source

fn padding(&self, state: &Self::State, height: i32) -> Insets

Source

fn shape( &self, state: &Self::State, bounds: Rectangle, fill_width: u32, ) -> Self::Shape

Source

fn draw<T, D>( &self, state: &Self::State, input_state: InputState, theme: &T, display: &mut D, ) -> Result<Self::Shape, D::Error>
where T: Theme, D: DrawTarget<Color = T::Color>,

Provided Methods§

Source

fn on_target_changed(&self, _state: &mut Self::State)

Source

fn update(&self, _state: &mut Self::State, _input_state: InputState) -> bool

Advances the animation by a single frame.

Returns whether the appearance of the indicator changed, i.e. whether the menu needs to be redrawn. Styles that animate should only report the frames on which what they render actually differs from the previous frame.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§