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
image_map: Map<Texture2d>
Methods
impl Ui
[src]
const DEFAULT_PENDING_INPUT_LIMIT: usize
DEFAULT_PENDING_INPUT_LIMIT: usize = 1024
The default maximum number of Input
s that a Ui
will store in its pending Input
queue
before Input
s start being ignored.
const DEFAULT_FONT_PATH: &'static str
DEFAULT_FONT_PATH: &'static str = "fonts/NotoSans/NotoSans-Regular.ttf"
The path to the default font for the Ui
.
fn generate_widget_id(&mut self) -> Id
[src]
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.
fn widget_id_generator(&mut self) -> Generator
[src]
Produces the type that may be used to generate new unique widget::Id
s.
fn handle_input(&mut self, input: Input)
[src]
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.
fn handle_pending_input(&mut self)
[src]
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.
fn set_widgets(&mut self) -> UiCell
[src]
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.
fn fonts_mut(&mut self) -> &mut Map
[src]
Mutable access to the Ui
's font map.
This allows for adding and removing fonts to the UI.
fn theme_mut(&mut self) -> &mut Theme
[src]
Mutable access to the Ui
's Theme
.
This allows for making changes to the active theme.
fn clear_with(&mut self, color: Color)
[src]
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
).
fn draw_to_frame(&self, app: &App, frame: &Frame) -> Result<(), DrawError>
[src]
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.
Methods from Deref<Target = Ui>
fn widget_input(&self, widget: NodeIndex<u32>) -> Widget
[src]
Returns a input::Widget
for the given widget
fn rect_of(&self, id: NodeIndex<u32>) -> Option<Rect>
[src]
The Rect for the widget at the given index.
Returns None
if there is no widget for the given index.
fn w_of(&self, id: NodeIndex<u32>) -> Option<f64>
[src]
The absolute width of the widget at the given index.
Returns None
if there is no widget for the given index.
fn h_of(&self, id: NodeIndex<u32>) -> Option<f64>
[src]
The absolute height of the widget at the given index.
Returns None
if there is no widget for the given index.
fn wh_of(&self, id: NodeIndex<u32>) -> Option<[f64; 2]>
[src]
The absolute dimensions for the widget at the given index.
Returns None
if there is no widget for the given index.
fn xy_of(&self, id: NodeIndex<u32>) -> Option<[f64; 2]>
[src]
The coordinates for the widget at the given index.
Returns None
if there is no widget for the given index.
fn kid_area_of(&self, id: NodeIndex<u32>) -> Option<Rect>
[src]
The kid_area
of the widget at the given index.
Returns None
if there is no widget for the given index.
fn maybe_prev_widget(&self) -> Option<NodeIndex<u32>>
[src]
An index to the previously updated widget if there is one.
fn widget_graph(&self) -> &Graph
[src]
Borrow the Ui's widget_graph
.
fn updated_widgets(
&self
) -> &HashSet<NodeIndex<u32>, BuildHasherDefault<FnvHasher>>
[src]
&self
) -> &HashSet<NodeIndex<u32>, BuildHasherDefault<FnvHasher>>
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.
fn prev_updated_widgets(
&self
) -> &HashSet<NodeIndex<u32>, BuildHasherDefault<FnvHasher>>
[src]
&self
) -> &HashSet<NodeIndex<u32>, BuildHasherDefault<FnvHasher>>
Borrow the Ui's set of updated widgets.
This set indicates which widgets have were instantiated during the previous call to
Ui::set_widgets
.
fn global_input(&self) -> &Global
[src]
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.
fn calc_xy(
&self,
maybe_id: Option<NodeIndex<u32>>,
x_position: Position,
y_position: Position,
dim: [f64; 2],
place_on_kid_area: bool
) -> [f64; 2]
[src]
&self,
maybe_id: Option<NodeIndex<u32>>,
x_position: Position,
y_position: Position,
dim: [f64; 2],
place_on_kid_area: bool
) -> [f64; 2]
Get the centred xy coords for some given Dimension
s, 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.
fn needs_redraw(&self)
[src]
Tells the Ui
that it needs to be 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.
fn draw(&self) -> Primitives
[src]
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.
fn kids_bounding_box(&self, id: NodeIndex<u32>) -> Option<Rect>
[src]
The Rect that bounds the kids of the widget with the given index.
fn visible_area(&self, id: NodeIndex<u32>) -> Option<Rect>
[src]
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.
fn mouse_cursor(&self) -> MouseCursor
[src]
Get mouse cursor state.