Trait kas::draw::DrawHandleExt[][src]

pub trait DrawHandleExt: DrawHandle {
    fn with_clip_region(
        &mut self,
        rect: Rect,
        offset: Offset,
        f: &mut dyn FnMut(&mut dyn DrawHandle)
    ) { ... }
fn with_overlay(
        &mut self,
        rect: Rect,
        f: &mut dyn FnMut(&mut dyn DrawHandle)
    ) { ... }
fn text_selected<T, R>(
        &mut self,
        pos: Coord,
        text: T,
        range: R,
        class: TextClass,
        state: InputState
    )
    where
        R: RangeBounds<usize>,
        T: AsRef<TextDisplay>
, { ... } }
Expand description

Extension trait over DrawHandle

Importing this trait allows use of additional methods (which cannot be defined directly on DrawHandle).

Provided methods

Draw to a new pass with clipping and offset (e.g. for scrolling)

Adds a new draw pass of type PassType::Clip, with draw operations clipped to rect and translated by `offset.

Draw to a new pass as an overlay (e.g. for pop-up menus)

Adds a new draw pass of type PassType::Overlay, with draw operations clipped to rect.

The theme is permitted to enlarge the rect for the purpose of drawing a frame or shadow around this overlay, thus the DrawHandle::get_clip_rect may be larger than expected.

Draw some text using the standard font, with a subset selected

Other than visually highlighting the selection, this method behaves identically to DrawHandle::text. It is likely to be replaced in the future by a higher-level API.

Implementors