Struct imgui::Ui[][src]

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

Methods

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

Deprecated since 0.0.19

: please use show_demo_window instead

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

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

Get current window's size in pixels

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

Pushes a value to the item width stack.

Pops a value from the item width stack.

Aborts

The current process is aborted if the item width stack is empty.

Runs a function after temporarily pushing a value to the item width stack.

Fill a space of size in pixels with nothing on the current window. Can be used to move the cursor on the window.

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.

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

Get cursor position on the screen, in window coordinates.

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

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

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

Pushes an identifier to the ID stack.

Pops an identifier from the ID stack.

Aborts

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

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

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

Make a invisible event. Can be used to conveniently catch events when mouse hovers or click the area covered by this invisible button.

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

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

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

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

Constructs a new color editor builder.

Constructs a new color picker builder.

Constructs a new color button builder.

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]

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

impl<'ui> Ui<'ui>
[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!"));
        });
    }
}

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]

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

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

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

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

Creates a radio button for selecting an integer value. Returns true if pressed.

Example

ui.radio_button(im_str!("Item 1"), &mut selected_radio_value, 1);
ui.radio_button(im_str!("Item 2"), &mut selected_radio_value, 2);
ui.radio_button(im_str!("Item 3"), &mut selected_radio_value, 3);

Creates a radio button that shows as selected if the given value is true. Returns true if pressed.

Example

if ui.radio_button_bool(im_str!("Cats"), radio_button_test == "cats") {
    radio_button_test = "cats".to_string();
}
if ui.radio_button_bool(im_str!("Dogs"), radio_button_test == "dogs") {
    radio_button_test = "dogs".to_string();
}

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

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

impl<'ui> Ui<'ui>
[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]

Get height of a line of previously drawn text item

Get previously drawn item's size

impl<'ui> Ui<'ui>
[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]

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]

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

Example

ui.with_style_var(StyleVar::Alpha(0.2), || {
    ui.text(im_str!("AB"));
});

Runs a function after temporarily pushing an array of values into the stack. Supporting multiple is also easy since you can freely mix and match them in a safe manner.

Example

ui.with_style_vars(&styles, || {
    ui.text(im_str!("A"));
    ui.text(im_str!("B"));
    ui.text(im_str!("C"));
    ui.text(im_str!("D"));
});

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

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

Example

ui.with_color_var(ImGuiCol::Text, (1.0, 0.0, 0.0, 1.0), || {
    ui.text_wrapped(im_str!("AB"));
});

Runs a function after temporarily pushing an array of values to the color stack.

Example

let red = (1.0, 0.0, 0.0, 1.0);
let green = (0.0, 1.0, 0.0, 1.0);
ui.with_color_vars(&vars, || {
    ui.text_wrapped(im_str!("AB"));
});

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

Runs a function after temporarily pushing an array of values to the style and color stack.

impl<'ui> Ui<'ui>
[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();
}

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

Returns true if the last item is being active.

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]

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();
}

Auto Trait Implementations

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

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