Struct nannou::ui::Ui[][src]

pub struct Ui {
    pub image_map: Map<Texture2d>,
    // some fields omitted
}

A handle to the Ui for a specific window.

Fields

Methods

impl Ui
[src]

DEFAULT_PENDING_INPUT_LIMIT: usize = 1024

The default maximum number of Inputs that a Ui will store in its pending Input queue before Inputs start being ignored.

DEFAULT_FONT_PATH: &'static str = "fonts/NotoSans/NotoSans-Regular.ttf"

The path to the default font for the Ui.

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

When using this method, be sure to store the returned widget::Id somewhere so that it can be re-used on next update.

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

Produces the type that may be used to generate new unique widget::Ids.

Handle a raw UI input event and update the Ui state accordingly.

This method drives the Ui forward and interprets input into higher-level events (like clicks and drags) for widgets.

Note: By default, this will be called automatically by the nannou App, so most of the time you should not need to call this (otherwise received inputs may double up). This method is particularly useful in the case that automatic input handling has been disabled, as this can be used to manually submit inputs.

Processes all pending input.

This is automatically called at the beginning of the set_widgets method, so the user should never need to call this manually, however the method is exposed for flexibility just in case.

This has no effect if automatic input handling is disabled.

Returns a context upon which UI widgets can be instantiated.

The UiCell simply acts as a wrapper around the Ui for the period over which widgets are instantiated. Once the UiCell is dropped, it does some cleanup and sorting that is required after widget instantiation.

Mutable access to the Ui's font map.

This allows for adding and removing fonts to the UI.

Mutable access to the Ui's Theme.

This allows for making changes to the active theme.

The first of the Primitives yielded by Ui::draw will always be a Rectangle the size of the window in which the Ui is instantiated.

This method sets the colour with which this Rectangle is drawn (the default being color::TRANSPARENT).

Draws the current state of the Ui to the given Frame.

The Ui will automatically draw to its associated window within the given Frame.

If you require more control over where the Ui is drawn within the Frame, the draw method offers more flexibility.

This has no effect if the window originally associated with the Ui no longer exists.

Draws the current state of the Ui to the given Frame but only if the Ui has changed since last time either draw_to_frame or draw_to_frame_if_changed was called.

The Ui will automatically draw to its associated window within the given Frame.

If you require more control over where the Ui is drawn within the Frame, the draw method offers more flexibility.

This has no effect if the window originally associated with the Ui no longer exists.

Returns true if the call resulted in re-drawing the Ui due to changes.

Methods from Deref<Target = Ui>

Returns a input::Widget for the given widget

The Rect for the widget at the given index.

Returns None if there is no widget for the given index.

The absolute width of the widget at the given index.

Returns None if there is no widget for the given index.

The absolute height of the widget at the given index.

Returns None if there is no widget for the given index.

The absolute dimensions for the widget at the given index.

Returns None if there is no widget for the given index.

The coordinates for the widget at the given index.

Returns None if there is no widget for the given index.

The kid_area of the widget at the given index.

Returns None if there is no widget for the given index.

An index to the previously updated widget if there is one.

Borrow the Ui's widget_graph.

Borrow the Ui's set of updated widgets.

This set indicates which widgets have been instantiated since the beginning of the most recent Ui::set_widgets call.

Borrow the Ui's set of updated widgets.

This set indicates which widgets have were instantiated during the previous call to Ui::set_widgets.

Get an immutable reference to global input. Handles aggregation of events and providing them to Widgets

Can be used to access the current input state, e.g. which widgets are currently capturing inputs.

Get the centred xy coords for some given Dimensions, Position and alignment.

If getting the xy for a specific widget, its widget::Id should be specified so that we can also consider the scroll offset of the scrollable parent widgets.

The place_on_kid_area argument specifies whether or not Place Position variants should target a Widget's kid_area, or simply the Widget's total area.

Tells the Ui that it needs to re-draw everything. It does this by setting the redraw count to num_redraw_frames. See the docs for set_num_redraw_frames, SAFE_REDRAW_COUNT or draw_if_changed for more info on how/why the redraw count is used.

Draw the Ui in it's current state.

NOTE: If you don't need to redraw your conrod GUI every frame, it is recommended to use the Ui::draw_if_changed method instead.

Same as the Ui::draw method, but only draws if the redraw_count is greater than 0.

The redraw_count is set to SAFE_REDRAW_COUNT whenever a Widget indicates that it needs to be re-drawn.

It can also be triggered manually by the user using the Ui::needs_redraw method.

This method is generally preferred over Ui::draw as it requires far less CPU usage, only redrawing to the screen if necessary.

Note that when Ui::needs_redraw is triggered, it sets the redraw_count to 3 by default. This ensures that conrod is drawn to each buffer in the case that there is buffer swapping happening. Let us know if you need finer control over this and we'll expose a way for you to set the redraw count manually.

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

The Rect that represents the maximum fully visible area for the widget with the given index, including consideration of cropped scroll area.

Otherwise, return None if the widget is not visible.

Get mouse cursor state.

Trait Implementations

impl Deref for Ui
[src]

The resulting type after dereferencing.

Dereferences the value.

Auto Trait Implementations

impl !Send for Ui

impl !Sync for Ui