ControlBehavior

Trait ControlBehavior 

Source
pub trait ControlBehavior {
    // Required methods
    fn setup(&mut self);
    fn handle_event(
        &mut self,
        drawing_context: &mut dyn DrawingContext,
        event_context: &mut dyn EventContext,
        event: ControlEvent,
    );
    fn measure(&mut self, drawing_context: &mut dyn DrawingContext, size: Size);
    fn set_rect(&mut self, drawing_context: &mut dyn DrawingContext, rect: Rect);
    fn get_rect(&self) -> Rect;
    fn hit_test(&self, point: Point) -> Option<Rc<RefCell<dyn ControlObject>>>;
    fn to_primitives(
        &self,
        drawing_context: &mut dyn DrawingContext,
    ) -> (Vec<Primitive>, Vec<Primitive>);
}

Required Methods§

Source

fn setup(&mut self)

Source

fn handle_event( &mut self, drawing_context: &mut dyn DrawingContext, event_context: &mut dyn EventContext, event: ControlEvent, )

Source

fn measure(&mut self, drawing_context: &mut dyn DrawingContext, size: Size)

Source

fn set_rect(&mut self, drawing_context: &mut dyn DrawingContext, rect: Rect)

Source

fn get_rect(&self) -> Rect

Source

fn hit_test(&self, point: Point) -> Option<Rc<RefCell<dyn ControlObject>>>

Source

fn to_primitives( &self, drawing_context: &mut dyn DrawingContext, ) -> (Vec<Primitive>, Vec<Primitive>)

Returns primitives. First vector contains primitives for normal layer (most controls). Second vector contains primitives for overlay layer (used by popup / menu etc.).

Implementors§

Source§

impl<D: 'static> ControlBehavior for StyledControl<D>