[][src]Struct imgui::Ui

pub struct Ui<'ui> { /* fields omitted */ }

Methods

impl<'ui> Ui<'ui>[src]

pub fn clipboard_text(&self) -> Option<ImString>[src]

Returns the current clipboard contents as text or None if clipboard cannot be accessed or it is empty

pub fn set_clipboard_text(&self, text: &ImStr)[src]

Sets the clipboard contents.

Does nothing if the clipboard cannot be accessed.

impl<'ui> Ui<'ui>[src]

pub fn current_font(&self) -> &Font[src]

Returns the current font

pub fn current_font_size(&self) -> f32[src]

Returns the current font size (= height in pixels) with font scale applied

pub fn font_tex_uv_white_pixel(&self) -> [f32; 2][src]

Returns the UV coordinate for a white pixel.

Useful for drawing custom shapes with the draw list API.

pub fn set_window_font_scale(&self, scale: f32)[src]

Set the font scale of the current window

impl<'ui> Ui<'ui>[src]

pub fn key_index(&self, key: Key) -> u32[src]

Returns the key index of the given key identifier.

Equivalent to indexing the Io struct key_map field: ui.io().key_map[key]

pub fn is_key_down(&self, key_index: u32) -> bool[src]

Returns true if the key is being held.

Equivalent to indexing the Io struct keys_down field: ui.io().keys_down[key_index]

pub fn is_key_pressed(&self, key_index: u32) -> bool[src]

Returns true if the key was pressed (went from !down to down).

Affected by key repeat settings (io.key_repeat_delay, io.key_repeat_rate)

pub fn is_key_released(&self, key_index: u32) -> bool[src]

Returns true if the key was released (went from down to !down)

pub fn key_pressed_amount(
    &self,
    key_index: u32,
    repeat_delay: f32,
    rate: f32
) -> u32
[src]

Returns a count of key presses using the given repeat rate/delay settings.

Usually returns 0 or 1, but might be >1 if rate is small enough that io.delta_time > rate.

pub fn set_keyboard_focus_here(&self, target_widget: FocusedWidget)[src]

Focus keyboard on a widget relative to current position

impl<'ui> Ui<'ui>[src]

pub fn is_mouse_down(&self, button: MouseButton) -> bool[src]

Returns true if the given mouse button is held down.

Equivalent to indexing the Io struct with the button, e.g. ui.io()[button].

pub fn is_any_mouse_down(&self) -> bool[src]

Returns true if any mouse button is held down

pub fn is_mouse_clicked(&self, button: MouseButton) -> bool[src]

Returns true if the given mouse button was clicked (went from !down to down)

pub fn is_mouse_double_clicked(&self, button: MouseButton) -> bool[src]

Returns true if the given mouse button was double-clicked

pub fn is_mouse_released(&self, button: MouseButton) -> bool[src]

Returns true if the given mouse button was released (went from down to !down)

pub fn is_mouse_dragging(&self, button: MouseButton) -> bool[src]

Returns true if the mouse is currently dragging with the given mouse button held down

pub fn is_mouse_dragging_with_threshold(
    &self,
    button: MouseButton,
    threshold: f32
) -> bool
[src]

Returns true if the mouse is currently dragging with the given mouse button held down.

If the given threshold is invalid or negative, the global distance threshold is used (io.mouse_drag_threshold).

pub fn is_mouse_hovering_rect(&self, r_min: [f32; 2], r_max: [f32; 2]) -> bool[src]

Returns true if the mouse is hovering over the given bounding rect.

Clipped by current clipping settings, but disregards other factors like focus, window ordering, modal popup blocking.

pub fn mouse_pos_on_opening_current_popup(&self) -> [f32; 2][src]

Returns the mouse position backed up at the time of opening a popup

pub fn mouse_drag_delta(&self, button: MouseButton) -> [f32; 2][src]

Returns the delta from the initial clicking position.

This is locked and returns [0.0, 0.0] until the mouse has moved past the global distance threshold (io.mouse_drag_threshold).

pub fn mouse_drag_delta_with_threshold(
    &self,
    button: MouseButton,
    threshold: f32
) -> [f32; 2]
[src]

Returns the delta from the initial clicking position.

This is locked and returns [0.0, 0.0] until the mouse has moved past the given threshold. If the given threshold is invalid or negative, the global distance threshold is used (io.mouse_drag_threshold).

pub fn reset_mouse_drag_delta(&self, button: MouseButton)[src]

Resets the current delta from initial clicking position.

pub fn mouse_cursor(&self) -> Option<MouseCursor>[src]

Get the currently desired mouse cursor type.

Returns None if no cursor should be displayed

pub fn set_mouse_cursor(&self, cursor_type: Option<MouseCursor>)[src]

Set the desired mouse cursor type.

Passing None hides the mouse cursor.

impl<'ui> Ui<'ui>[src]

pub fn separator(&self)[src]

Renders a separator (generally horizontal).

This becomes a vertical separator inside a menu bar or in horizontal layout mode.

pub fn same_line(&self, pos_x: f32)[src]

Call between widgets or groups to layout them horizontally.

X position is given in window coordinates.

pub fn same_line_with_spacing(&self, pos_x: f32, spacing_w: f32)[src]

Call between widgets or groups to layout them horizontally.

X position is given in window coordinates.

pub fn new_line(&self)[src]

Undo a same_line call or force a new line when in horizontal layout mode

pub fn spacing(&self)[src]

Adds vertical spacing

pub fn dummy(&self, size: [f32; 2])[src]

Fill a space of size in pixels with nothing on the current window.

Can be used to move the cursor on the window.

pub fn indent(&self)[src]

Move content position to the right by Style::indent_spacing

pub fn indent_by(&self, width: f32)[src]

Move content position to the right by width

pub fn unindent(&self)[src]

Move content position to the left by Style::indent_spacing

pub fn unindent_by(&self, width: f32)[src]

Move content position to the left by width

impl<'ui> Ui<'ui>[src]

pub fn imgui(&self) -> &Context[src]

Deprecated since 0.1.0:

This function is potentially unsafe and will be removed

pub fn want_capture_mouse(&self) -> bool[src]

Deprecated since 0.1.0:

Access Io::want_capture_mouse directly instead

pub fn want_capture_keyboard(&self) -> bool[src]

Deprecated since 0.1.0:

Access Io::want_capture_keyboard directly instead

pub fn framerate(&self) -> f32[src]

Deprecated since 0.1.0:

Access Io::framerate directly instead

pub fn metrics_render_vertices(&self) -> i32[src]

Deprecated since 0.1.0:

Access Io::metrics_render_vertices directly instead

pub fn metrics_render_indices(&self) -> i32[src]

Deprecated since 0.1.0:

Access Io::metrics_render_indices directly instead

pub fn metrics_active_windows(&self) -> i32[src]

Deprecated since 0.1.0:

Access Io::metrics_active_windows directly instead

impl<'ui> Ui<'ui>[src]

pub fn with_color_var<T, F>(
    &self,
    style_color: StyleColor,
    color: [f32; 4],
    f: F
) -> T where
    F: FnOnce() -> T, 
[src]

Deprecated since 0.1.0:

use Ui::push_style_color instead

pub fn with_color_vars<'a, T, F, I>(&self, style_colors: I, f: F) -> T where
    F: FnOnce() -> T,
    I: IntoIterator<Item = &'a (StyleColor, [f32; 4])>, 
[src]

Deprecated since 0.1.0:

use Ui::push_style_colors instead

pub fn with_style_var<T, F>(&self, style_var: StyleVar, f: F) -> T where
    F: FnOnce() -> T, 
[src]

Deprecated since 0.1.0:

use Ui::push_style_var instead

pub fn with_style_vars<'a, T, F, I>(&self, style_vars: I, f: F) -> T where
    F: FnOnce() -> T,
    I: IntoIterator<Item = &'a StyleVar>, 
[src]

Deprecated since 0.1.0:

use Ui::push_style_vars instead

pub fn with_item_width<T, F>(&self, item_width: f32, f: F) -> T where
    F: FnOnce() -> T, 
[src]

Deprecated since 0.1.0:

use Ui::push_item_width instead

pub fn with_text_wrap_pos<T, F>(&self, wrap_pos_x: f32, f: F) -> T where
    F: FnOnce() -> T, 
[src]

Deprecated since 0.1.0:

use Ui::push_text_wrap_pos instead

impl<'ui> Ui<'ui>[src]

#[must_use] pub fn push_font(&self, id: FontId) -> FontStackToken[src]

Switches to the given font by pushing it to the font stack.

Panics

Panics if the font atlas does not contain the given font

Examples

// At initialization time
let my_custom_font = ctx.fonts().add_font(&font_data_sources);
// During UI construction
let _token = ui.push_font(my_custom_font);
ui.text("I use the custom font!");

#[must_use] pub fn push_style_color(
    &self,
    style_color: StyleColor,
    color: [f32; 4]
) -> ColorStackToken
[src]

Changes a style color by pushing a change to the color stack.

Examples

const RED: [f32; 4] = [1.0, 0.0, 0.0, 1.0];
let _token = ui.push_style_color(StyleColor::Text, RED);
ui.text("I'm red!");

#[must_use] pub fn push_style_colors<'a, I>(&self, style_colors: I) -> ColorStackToken where
    I: IntoIterator<Item = &'a (StyleColor, [f32; 4])>, 
[src]

Changes style colors by pushing several changes to the color stack.

Examples

const RED: [f32; 4] = [1.0, 0.0, 0.0, 1.0];
const GREEN: [f32; 4] = [0.0, 1.0, 0.0, 1.0];
let _token = ui.push_style_colors(&[
    (StyleColor::Text, RED),
    (StyleColor::TextDisabled, GREEN),
]);
ui.text("I'm red!");
ui.text_disabled("I'm green!");

#[must_use] pub fn push_style_var(&self, style_var: StyleVar) -> StyleStackToken[src]

Changes a style variable by pushing a change to the style stack.

Examples

let _token = ui.push_style_var(StyleVar::Alpha(0.2));
ui.text("I'm transparent!");

#[must_use] pub fn push_style_vars<'a, I>(&self, style_vars: I) -> StyleStackToken where
    I: IntoIterator<Item = &'a StyleVar>, 
[src]

Changes style variables by pushing several changes to the style stack.

Examples

let _token = ui.push_style_vars(&[
    StyleVar::Alpha(0.2),
    StyleVar::ItemSpacing([50.0, 50.0])
]);
ui.text("We're transparent...");
ui.text("...with large spacing as well");

impl<'ui> Ui<'ui>[src]

#[must_use] pub fn push_item_width(&self, item_width: f32) -> ItemWidthStackToken[src]

Changes the item width by pushing a change to the item width stack.

  • > 0.0: width is item_width pixels
  • = 0.0: default to ~2/3 of window width
  • < 0.0: item_width pixels relative to the right of window (-1.0 always aligns width to the right side)

#[must_use] pub fn push_text_wrap_pos(&self, wrap_pos_x: f32) -> TextWrapPosStackToken[src]

Changes the text wrapping position by pushing a change to the text wrapping position stack.

  • > 0.0: wrap at wrap_pos_x position in window local space
  • = 0.0: wrap to end of window (or column)
  • < 0.0: no wrapping

#[must_use] pub fn push_item_flag(&self, item_flag: ItemFlag) -> ItemFlagsStackToken[src]

Changes an item flag by pushing a change to the item flag stack

impl<'ui> Ui<'ui>[src]

pub fn button(&self, label: &ImStr, size: [f32; 2]) -> bool[src]

Renders a clickable button.

Returns true if this button was clicked.

pub fn small_button(&self, label: &ImStr) -> bool[src]

Renders a small clickable button that is easy to embed in text.

Returns true if this button was clicked.

pub fn invisible_button(&self, id: &ImStr, size: [f32; 2]) -> bool[src]

Renders a button behaviour without the visual look.

Returns true if this button was clicked.

pub fn arrow_button(&self, id: &ImStr, direction: Direction) -> bool[src]

Renders a square button with an arrow shape.

Returns true if this button was clicked.

pub fn checkbox(&self, label: &ImStr, value: &mut bool) -> bool[src]

Renders a simple checkbox.

Returns true if this checkbox was clicked.

pub fn checkbox_flags<T>(&self, label: &ImStr, flags: &mut T, mask: T) -> bool where
    T: Copy + PartialEq + BitOrAssign + BitAndAssign + BitAnd<Output = T> + Not<Output = T>, 
[src]

Renders a checkbox suitable for toggling bit flags using a mask.

Returns true if this checkbox was clicked.

pub fn radio_button_bool(&self, label: &ImStr, active: bool) -> bool[src]

Renders a simple radio button.

Returns true if this radio button was clicked.

pub fn radio_button<T>(
    &self,
    label: &ImStr,
    value: &mut T,
    button_value: T
) -> bool where
    T: Copy + PartialEq
[src]

Renders a radio button suitable for choosing an arbitrary value.

Returns true if this radio button was clicked.

pub fn bullet(&self)[src]

Renders a small circle and keeps the cursor on the same line

impl<'ui> Ui<'ui>[src]

pub fn text<T: AsRef<str>>(&self, text: T)[src]

Renders simple text

pub fn text_colored<T: AsRef<str>>(&self, color: [f32; 4], text: T)[src]

Renders simple text using the given text color

pub fn text_disabled<T: AsRef<str>>(&self, text: T)[src]

Renders simple text using StyleColor::TextDisabled color

pub fn text_wrapped(&self, text: &ImStr)[src]

Renders text wrapped to the end of window (or column)

pub fn label_text(&self, label: &ImStr, text: &ImStr)[src]

Render a text + label combination aligned the same way as value+label widgets

pub fn bullet_text(&self, text: &ImStr)[src]

Renders text with a little bullet aligned to the typical tree node

impl<'ui> Ui<'ui>[src]

pub fn io(&self) -> &Io[src]

pub fn fonts(&self) -> FontAtlasRef[src]

pub fn clone_style(&self) -> Style[src]

pub fn style_color(&self, style_color: StyleColor) -> [f32; 4][src]

pub fn time(&self) -> f64[src]

pub fn frame_count(&self) -> i32[src]

pub fn render(self) -> &'ui DrawData[src]

impl<'ui> Ui<'ui>[src]

pub fn show_demo_window(&self, opened: &mut bool)[src]

Renders a demo window (previously called a test window), which demonstrates most Dear Imgui features.

pub fn show_about_window(&self, opened: &mut bool)[src]

Renders an about window.

Displays the Dear ImGui version/credits, and build/system information.

pub fn show_metrics_window(&self, opened: &mut bool)[src]

Renders a metrics/debug window.

Displays Dear ImGui internals: draw commands (with individual draw calls and vertices), window list, basic internal state, etc.

pub fn show_style_editor(&self, style: &mut Style)[src]

Renders a style editor block (not a window) for the given Style structure

pub fn show_default_style_editor(&self)[src]

Renders a style editor block (not a window) for the currently active style

pub fn show_user_guide(&self)[src]

Renders a basic help/info block (not a window)

impl<'ui> Ui<'ui>[src]

pub fn window<'p>(&self, name: &'p ImStr) -> Window<'ui, 'p>[src]

pub fn get_window_size(&self) -> [f32; 2][src]

Get current window's size in pixels

pub fn get_window_pos(&self) -> [f32; 2][src]

Get current window's position in pixels

pub fn get_window_content_region_min(&self) -> [f32; 2][src]

pub fn get_window_content_region_max(&self) -> [f32; 2][src]

impl<'ui> Ui<'ui>[src]

pub fn columns<'p>(&self, count: i32, id: &'p ImStr, border: bool)[src]

pub fn next_column(&self)[src]

pub fn get_column_index(&self) -> i32[src]

pub fn get_column_offset(&self, column_index: i32) -> f32[src]

pub fn set_column_offset(&self, column_index: i32, offset_x: f32)[src]

pub fn get_column_width(&self, column_index: i32) -> f32[src]

pub fn get_columns_count(&self) -> i32[src]

pub fn get_cursor_screen_pos(&self) -> [f32; 2][src]

Get cursor position on the screen, in screen coordinates. This sets the point on which the next widget will be drawn.

This is especially useful for drawing, as the drawing API uses screen coordiantes.

pub fn set_cursor_screen_pos(&self, pos: [f32; 2])[src]

Set cursor position on the screen, in screen coordinates. This sets the point on which the next widget will be drawn.

pub fn get_cursor_pos(&self) -> [f32; 2][src]

Get cursor position on the screen, in window coordinates.

pub fn set_cursor_pos(&self, pos: [f32; 2])[src]

Set cursor position on the screen, in window coordinates. This sets the point on which the next widget will be drawn.

pub fn get_content_region_max(&self) -> [f32; 2][src]

pub fn get_content_region_avail(&self) -> [f32; 2][src]

Get available space left between the cursor and the edges of the current window.

impl<'ui> Ui<'ui>[src]

pub fn push_id<'a, I: Into<ImId<'a>>>(&self, id: I)[src]

Pushes an identifier to the ID stack.

pub fn pop_id(&self)[src]

Pops an identifier from the ID stack.

Aborts

The current process is aborted if the ID stack is empty.

pub fn with_id<'a, F, I>(&self, id: I, f: F) where
    F: FnOnce(),
    I: Into<ImId<'a>>, 
[src]

Runs a function after temporarily pushing a value to the ID stack.

impl<'ui> Ui<'ui>[src]

pub fn input_text<'p>(
    &self,
    label: &'p ImStr,
    buf: &'p mut ImString
) -> InputText<'ui, 'p>
[src]

pub fn input_text_multiline<'p>(
    &self,
    label: &'p ImStr,
    buf: &'p mut ImString,
    size: [f32; 2]
) -> InputTextMultiline<'ui, 'p>
[src]

pub fn input_float<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut f32
) -> InputFloat<'ui, 'p>
[src]

pub fn input_float2<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut [f32; 2]
) -> InputFloat2<'ui, 'p>
[src]

pub fn input_float3<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut [f32; 3]
) -> InputFloat3<'ui, 'p>
[src]

pub fn input_float4<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut [f32; 4]
) -> InputFloat4<'ui, 'p>
[src]

pub fn input_int<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut i32
) -> InputInt<'ui, 'p>
[src]

pub fn input_int2<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut [i32; 2]
) -> InputInt2<'ui, 'p>
[src]

pub fn input_int3<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut [i32; 3]
) -> InputInt3<'ui, 'p>
[src]

pub fn input_int4<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut [i32; 4]
) -> InputInt4<'ui, 'p>
[src]

impl<'ui> Ui<'ui>[src]

pub fn drag_float<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut f32
) -> DragFloat<'ui, 'p>
[src]

pub fn drag_float2<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut [f32; 2]
) -> DragFloat2<'ui, 'p>
[src]

pub fn drag_float3<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut [f32; 3]
) -> DragFloat3<'ui, 'p>
[src]

pub fn drag_float4<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut [f32; 4]
) -> DragFloat4<'ui, 'p>
[src]

pub fn drag_float_range2<'p>(
    &self,
    label: &'p ImStr,
    current_min: &'p mut f32,
    current_max: &'p mut f32
) -> DragFloatRange2<'ui, 'p>
[src]

pub fn drag_int<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut i32
) -> DragInt<'ui, 'p>
[src]

pub fn drag_int2<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut [i32; 2]
) -> DragInt2<'ui, 'p>
[src]

pub fn drag_int3<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut [i32; 3]
) -> DragInt3<'ui, 'p>
[src]

pub fn drag_int4<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut [i32; 4]
) -> DragInt4<'ui, 'p>
[src]

pub fn drag_int_range2<'p>(
    &self,
    label: &'p ImStr,
    current_min: &'p mut i32,
    current_max: &'p mut i32
) -> DragIntRange2<'ui, 'p>
[src]

impl<'ui> Ui<'ui>[src]

pub fn slider_float<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut f32,
    min: f32,
    max: f32
) -> SliderFloat<'ui, 'p>
[src]

pub fn slider_float2<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut [f32; 2],
    min: f32,
    max: f32
) -> SliderFloat2<'ui, 'p>
[src]

pub fn slider_float3<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut [f32; 3],
    min: f32,
    max: f32
) -> SliderFloat3<'ui, 'p>
[src]

pub fn slider_float4<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut [f32; 4],
    min: f32,
    max: f32
) -> SliderFloat4<'ui, 'p>
[src]

pub fn slider_int<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut i32,
    min: i32,
    max: i32
) -> SliderInt<'ui, 'p>
[src]

pub fn slider_int2<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut [i32; 2],
    min: i32,
    max: i32
) -> SliderInt2<'ui, 'p>
[src]

pub fn slider_int3<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut [i32; 3],
    min: i32,
    max: i32
) -> SliderInt3<'ui, 'p>
[src]

pub fn slider_int4<'p>(
    &self,
    label: &'p ImStr,
    value: &'p mut [i32; 4],
    min: i32,
    max: i32
) -> SliderInt4<'ui, 'p>
[src]

impl<'ui> Ui<'ui>[src]

pub fn color_edit<'p, V: Into<EditableColor<'p>>>(
    &self,
    label: &'p ImStr,
    value: V
) -> ColorEdit<'ui, 'p>
[src]

Constructs a new color editor builder.

pub fn color_picker<'p, V: Into<EditableColor<'p>>>(
    &self,
    label: &'p ImStr,
    value: V
) -> ColorPicker<'ui, 'p>
[src]

Constructs a new color picker builder.

pub fn color_button<'p>(
    &self,
    desc_id: &'p ImStr,
    color: [f32; 4]
) -> ColorButton<'ui, 'p>
[src]

Constructs a new color button builder.

pub fn set_color_edit_options(&self, flags: ImGuiColorEditFlags)[src]

Initialize current options (generally on application startup) if you want to select a default format, picker type, etc. Users will be able to change many settings, unless you use .options(false) in your widget builders.

impl<'ui> Ui<'ui>[src]

pub fn tree_node<'p>(&self, id: &'p ImStr) -> TreeNode<'ui, 'p>[src]

pub fn collapsing_header<'p>(
    &self,
    label: &'p ImStr
) -> CollapsingHeader<'ui, 'p>
[src]

impl<'ui> Ui<'ui>[src]

pub fn selectable(
    &self,
    label: &ImStr,
    selected: bool,
    flags: ImGuiSelectableFlags,
    size: [f32; 2]
) -> bool
[src]

impl<'ui> Ui<'ui>[src]

pub fn tooltip<F: FnOnce()>(&self, f: F)[src]

Construct a tooltip window that can have any kind of content.

Typically used with Ui::is_item_hovered() or some other conditional check.

Examples

fn user_interface(ui: &Ui) {
    ui.text("Hover over me");
    if ui.is_item_hovered() {
        ui.tooltip(|| {
            ui.text_colored([1.0, 0.0, 0.0, 1.0], im_str!("I'm red!"));
        });
    }
}

pub fn tooltip_text<T: AsRef<str>>(&self, text: T)[src]

Construct a tooltip window with simple text content.

Typically used with Ui::is_item_hovered() or some other conditional check.

Examples

fn user_interface(ui: &Ui) {
    ui.text("Hover over me");
    if ui.is_item_hovered() {
        ui.tooltip_text("I'm a tooltip!");
    }
}

impl<'ui> Ui<'ui>[src]

pub fn main_menu_bar<F>(&self, f: F) where
    F: FnOnce(), 
[src]

pub fn menu_bar<F>(&self, f: F) where
    F: FnOnce(), 
[src]

pub fn menu<'p>(&self, label: &'p ImStr) -> Menu<'ui, 'p>[src]

pub fn menu_item<'p>(&self, label: &'p ImStr) -> MenuItem<'ui, 'p>[src]

impl<'ui> Ui<'ui>[src]

pub fn open_popup<'p>(&self, str_id: &'p ImStr)[src]

pub fn popup<'p, F>(&self, str_id: &'p ImStr, f: F) where
    F: FnOnce(), 
[src]

pub fn popup_modal<'p>(&self, str_id: &'p ImStr) -> PopupModal<'ui, 'p>[src]

Create a modal pop-up.

Example

if ui.button(im_str!("Show modal"), [0.0, 0.0]) {
    ui.open_popup(im_str!("modal"));
}
ui.popup_modal(im_str!("modal")).build(|| {
    ui.text("Content of my modal");
    if ui.button(im_str!("OK"), [0.0, 0.0]) {
        ui.close_current_popup();
    }
});

pub fn close_current_popup(&self)[src]

Close a popup. Should be called within the closure given as argument to Ui::popup or Ui::popup_modal.

impl<'ui> Ui<'ui>[src]

pub fn combo<'p, StringType: AsRef<ImStr> + ?Sized>(
    &self,
    label: &'p ImStr,
    current_item: &mut i32,
    items: &'p [&'p StringType],
    height_in_items: i32
) -> bool
[src]

impl<'ui> Ui<'ui>[src]

pub fn list_box<'p, StringType: AsRef<ImStr> + ?Sized>(
    &self,
    label: &'p ImStr,
    current_item: &mut i32,
    items: &'p [&'p StringType],
    height_in_items: i32
) -> bool
[src]

impl<'ui> Ui<'ui>[src]

pub fn plot_lines<'p>(
    &self,
    label: &'p ImStr,
    values: &'p [f32]
) -> PlotLines<'ui, 'p>
[src]

impl<'ui> Ui<'ui>[src]

pub fn plot_histogram<'p>(
    &self,
    label: &'p ImStr,
    values: &'p [f32]
) -> PlotHistogram<'ui, 'p>
[src]

impl<'ui> Ui<'ui>[src]

pub fn image(&self, texture: TextureId, size: [f32; 2]) -> Image[src]

impl<'ui> Ui<'ui>[src]

pub fn image_button(&self, texture: TextureId, size: [f32; 2]) -> ImageButton[src]

impl<'ui> Ui<'ui>[src]

pub fn calc_text_size(
    &self,
    text: &ImStr,
    hide_text_after_double_hash: bool,
    wrap_width: f32
) -> [f32; 2]
[src]

Calculate the size required for a given text string.

hide_text_after_double_hash allows the user to insert comments into their text, using a double hash-tag prefix. This is a feature of imgui.

wrap_width allows you to request a width at which to wrap the text to a newline for the calculation.

impl<'ui> Ui<'ui>[src]

pub fn get_text_line_height_with_spacing(&self) -> f32[src]

Get height of a line of previously drawn text item

pub fn get_item_rect_size(&self) -> [f32; 2][src]

Get previously drawn item's size

impl<'ui> Ui<'ui>[src]

pub fn progress_bar<'p>(&self, fraction: f32) -> ProgressBar<'ui, 'p>[src]

Creates a progress bar. Fraction is the progress level with 0.0 = 0% and 1.0 = 100%.

Example

ui.progress_bar(0.6)
    .size([100.0, 12.0])
    .overlay_text(im_str!("Progress!"))
    .build();

impl<'ui> Ui<'ui>[src]

pub fn child_frame<'p>(
    &self,
    name: &'p ImStr,
    size: [f32; 2]
) -> ChildFrame<'ui, 'p>
[src]

Creates a child frame. Size is size of child_frame within parent window.

Example

ui.window(im_str!("ChatWindow"))
    .title_bar(true)
    .scrollable(false)
    .build(|| {
        ui.separator();

        ui.child_frame(im_str!("child frame"), [400.0, 100.0])
            .show_borders(true)
            .always_show_vertical_scroll_bar(true)
            .build(|| {
                ui.text_colored([1.0, 0.0, 0.0, 1.0], im_str!("hello mate!"));
            });
});

impl<'ui> Ui<'ui>[src]

pub fn is_item_hovered(&self) -> bool[src]

Returns true if the last item is being hovered by the mouse.

Examples

fn user_interface(ui: &Ui) {
    ui.text("Hover over me");
    let is_hover_over_me_text_hovered = ui.is_item_hovered();
}

pub fn is_item_hovered_with_flags(&self, flags: ImGuiHoveredFlags) -> bool[src]

pub fn is_window_hovered(&self) -> bool[src]

Return true if the current window is being hovered by the mouse.

pub fn is_window_hovered_with_flags(&self, flags: ImGuiHoveredFlags) -> bool[src]

pub fn is_window_focused(&self) -> bool[src]

Return true if the current window is currently focused.

pub fn is_root_window_focused(&self) -> bool[src]

Return true if the current root window is currently focused.

pub fn is_child_window_focused(&self) -> bool[src]

Return true if the current child window is currently focused.

pub fn is_item_active(&self) -> bool[src]

Returns true if the last item is being active.

pub fn set_item_allow_overlap(&self)[src]

Allow last item to be overlapped by a subsequent item. Both may be activated during the same frame before the later one takes priority.

pub fn group<F: FnOnce()>(&self, f: F)[src]

Group items together as a single item.

May be useful to handle the same mouse event on a group of items, for example.

impl<'ui> Ui<'ui>[src]

pub fn get_window_draw_list(&'ui self) -> WindowDrawList<'ui>[src]

Get access to drawing API

Examples

fn custom_draw(ui: &Ui) {
    let draw_list = ui.get_window_draw_list();
    // Draw a line
    const WHITE: [f32; 3] = [1.0, 1.0, 1.0];
    draw_list.add_line([100.0, 100.0], [200.0, 200.0], WHITE).build();
    // Continue drawing ...
}

This function will panic if several instances of WindowDrawList coexist. Before a new instance is got, a previous instance should be dropped.

fn custom_draw(ui: &Ui) {
    let draw_list = ui.get_window_draw_list();
    // Draw something...

    // This second call will panic!
    let draw_list = ui.get_window_draw_list();
}

Trait Implementations

impl<'a> Drop for Ui<'a>[src]

Auto Trait Implementations

impl<'ui> !Send for Ui<'ui>

impl<'ui> Unpin for Ui<'ui>

impl<'ui> !Sync for Ui<'ui>

impl<'ui> !UnwindSafe for Ui<'ui>

impl<'ui> !RefUnwindSafe for Ui<'ui>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]