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

pub trait DrawHandleExt: DrawHandle {
    pub fn size_handle<F: Fn(&mut dyn SizeHandle) -> T, T>(&mut self, f: F) -> T { ... }
pub fn text<T: FormattableText>(
        &mut self,
        pos: Coord,
        text: &Text<T>,
        class: TextClass
    ) { ... }
pub fn text_selected<T: AsRef<TextDisplay>, R: RangeBounds<usize>>(
        &mut self,
        pos: Coord,
        bounds: Vec2,
        offset: Coord,
        text: T,
        range: R,
        class: TextClass
    ) { ... } }

Extension trait over DrawHandle

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

Provided methods

pub fn size_handle<F: Fn(&mut dyn SizeHandle) -> T, T>(&mut self, f: F) -> T[src]

Access a SizeHandle

The given closure is called with a reference to a SizeHandle, and the closure's result is returned.

This method will panic if the implementation fails to call the closure.

pub fn text<T: FormattableText>(
    &mut self,
    pos: Coord,
    text: &Text<T>,
    class: TextClass
)
[src]

Draw some text using the standard font

The text is drawn within the rect from pos to text.env().bounds.

The dimensions required for this text may be queried with SizeHandle::text_bound.

pub fn text_selected<T: AsRef<TextDisplay>, R: RangeBounds<usize>>(
    &mut self,
    pos: Coord,
    bounds: Vec2,
    offset: Coord,
    text: T,
    range: R,
    class: TextClass
)
[src]

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

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

Loading content...

Implementors

impl<D: DrawHandle + ?Sized> DrawHandleExt for D[src]

Loading content...