Struct conrod::UiCell [] [src]

pub struct UiCell<'a, C: 'a> {
    // some fields omitted
}

A wrapper around a Ui that only exposes the functionality necessary for the Widget::update method.

Its primary role is to allow for widget designers to compose their own unique Widgets from other Widgets by calling the Widget::set method within their own Widget's update method.

It also provides methods for accessing the Ui's Theme, GlyphCache and UserInput via immutable reference.

BTW - if you have a better name for this type, please post an issue or PR! "Cell" was the best I could come up with as it's kind of like a jail cell for the Ui - restricting a user's access to it.

Methods

impl<'a, C> UiCell<'a, C>
[src]

fn theme(&self) -> &Theme

A reference to the Theme that is currently active within the Ui.

fn glyph_cache(&self) -> &GlyphCache<C>

A reference to the Ui's GlyphCache.

fn input(&self) -> UserInput

A struct representing the user input that has occurred since the last update.

fn input_for<I: Into<Index>>(&self, idx: I) -> UserInput

A struct representing the user input that has occurred since the last update for the Widget with the given index..

fn capture_mouse(&mut self) -> bool

Have the widget capture the mouse input. The mouse state will be hidden from other widgets while captured.

Returns true if the mouse was successfully captured.

Returns false if it was already captured by some other widget.

fn uncapture_mouse(&mut self) -> bool

Uncapture the mouse input.

Returns true if the mouse was successfully uncaptured.

Returns false if the mouse wasn't captured by our widget in the first place.

fn capture_keyboard(&mut self) -> bool

Have the widget capture the keyboard input. The keyboard state will be hidden from other widgets while captured.

Returns true if the keyboard was successfully captured.

Returns false if it was already captured by some other widget.

fn uncapture_keyboard(&mut self) -> bool

Uncapture the keyboard input.

Returns true if the keyboard was successfully uncaptured.

Returns false if the keyboard wasn't captured by our widget in the first place.

fn new_unique_node_index(&mut self) -> NodeIndex

Generate a new, unique NodeIndex into a Placeholder node within the Ui's widget graph. This should only be called once for each unique widget needed to avoid unnecessary bloat within the Ui's widget graph.

When using this method in your Widget's update method, be sure to store the returned NodeIndex somewhere within your Widget::State so that it can be re-used on next update.

Panics if adding another node would exceed the maximum capacity for node indices.

fn kids_bounding_box<I: Into<Index>>(&self, idx: I) -> Option<Rect>

The Rect that bounds the kids of the widget with the given index.

Returns None if the widget has no children or if there's is no widget for the given index.

Trait Implementations

impl<'a, C> AsRef<Ui<C>> for UiCell<'a, C>
[src]

fn as_ref(&self) -> &Ui<C>

Performs the conversion.