[][src]Trait kas::theme::SizeHandle

pub trait SizeHandle {
    fn outer_frame(&self) -> (Size, Size);
fn inner_margin(&self) -> Size;
fn outer_margin(&self) -> Size;
fn line_height(&self, class: TextClass) -> u32;
fn text_bound(
        &mut self,
        text: &str,
        class: TextClass,
        multi_line: bool,
        axis: AxisInfo
    ) -> SizeRules;
fn button_surround(&self) -> (Size, Size);
fn edit_surround(&self) -> (Size, Size);
fn checkbox(&self) -> Size;
fn scrollbar(&self) -> (u32, u32, u32); }

Handle passed to objects during draw and sizing operations

Required methods

fn outer_frame(&self) -> (Size, Size)

Size of a frame around child widget(s)

Returns (top_left, bottom_right) dimensions as two Sizes.

fn inner_margin(&self) -> Size

The margin around content within a widget

This area may be used to draw focus indicators.

fn outer_margin(&self) -> Size

The margin between UI elements, where desired

fn line_height(&self, class: TextClass) -> u32

The height of a line of text

fn text_bound(
    &mut self,
    text: &str,
    class: TextClass,
    multi_line: bool,
    axis: AxisInfo
) -> SizeRules

Get a text label size bound

Sizing requirements of DrawHandle::text.

Since only a subset of TextProperties fields are required, these are passed directly.

fn button_surround(&self) -> (Size, Size)

Size of the sides of a button.

Includes each side (as in outer_frame), minus the content area (to be added separately).

fn edit_surround(&self) -> (Size, Size)

Size of the sides of an edit box.

Includes each side (as in outer_frame), minus the content area (to be added separately).

fn checkbox(&self) -> Size

Size of the element drawn by DrawHandle::checkbox.

This element is not scalable (except by DPI).

fn scrollbar(&self) -> (u32, u32, u32)

Dimensions for a scrollbar

Returns three components:

  • thickness: scroll-bar width (for vertical scroll bars)
  • min_handle_len: minimum length for the handle
  • min_len: minimum length for the whole bar

Generally, one expects min_len is significantly greater than min_handle_len (so that some movement is always possible). It is required that min_len >= min_handle_len.

Loading content...

Implementors

Loading content...