[−][src]Struct imgui::Ui
A temporary reference for building the user interface for one frame
Implementations
impl<'ui> Ui<'ui>
[src]
pub fn clipboard_text(&self) -> Option<ImString>
[src]
Returns the current clipboard contents as text, or None if the clipboard is empty or cannot be accessed
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 columns(&self, count: i32, id: &ImStr, border: bool)
[src]
pub fn next_column(&self)
[src]
Switches to the next column.
If the current row is finished, switches to first column of the next row
pub fn current_column_index(&self) -> i32
[src]
Returns the index of the current column
pub fn current_column_width(&self) -> f32
[src]
Returns the width of the current column (in pixels)
pub fn column_width(&self, column_index: i32) -> f32
[src]
Returns the width of the given column (in pixels)
pub fn set_current_column_width(&self, width: f32)
[src]
Sets the width of the current column (in pixels)
pub fn set_column_width(&self, column_index: i32, width: f32)
[src]
Sets the width of the given column (in pixels)
pub fn current_column_offset(&self) -> f32
[src]
Returns the offset of the current column (in pixels from the left side of the content region)
pub fn column_offset(&self, column_index: i32) -> f32
[src]
Returns the offset of the given column (in pixels from the left side of the content region)
pub fn set_current_column_offset(&self, offset_x: f32)
[src]
Sets the offset of the current column (in pixels from the left side of the content region)
pub fn set_column_offset(&self, column_index: i32, offset_x: f32)
[src]
Sets the offset of the given column (in pixels from the left side of the content region)
pub fn column_count(&self) -> i32
[src]
Returns the current amount of columns
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]
Sets 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]
&self,
key_index: u32,
repeat_delay: f32,
rate: f32
) -> u32
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]
Focuses 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]
&self,
button: MouseButton,
threshold: f32
) -> bool
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]
&self,
button: MouseButton,
threshold: f32
) -> [f32; 2]
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]
Returns 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]
Sets 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]
Fills 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]
Moves content position to the right by Style::indent_spacing
pub fn indent_by(&self, width: f32)
[src]
Moves content position to the right by width
pub fn unindent(&self)
[src]
Moves content position to the left by Style::indent_spacing
pub fn unindent_by(&self, width: f32)
[src]
Moves content position to the left by width
#[must_use]pub fn begin_group(&self) -> GroupToken
[src]
Groups items together as a single item.
May be useful to handle the same mouse event on a group of items, for example.
Returns a GroupToken
that must be ended by calling .end()
pub fn group<R, F: FnOnce() -> R>(&self, f: F) -> R
[src]
Creates a layout group and runs a closure to construct the contents.
May be useful to handle the same mouse event on a group of items, for example.
pub fn cursor_pos(&self) -> [f32; 2]
[src]
Returns the cursor position (in window coordinates)
pub fn set_cursor_pos(&self, pos: [f32; 2])
[src]
Sets the cursor position (in window coordinates).
This sets the point on which the next widget will be drawn.
pub fn cursor_start_pos(&self) -> [f32; 2]
[src]
Returns the initial cursor position (in window coordinates)
pub fn cursor_screen_pos(&self) -> [f32; 2]
[src]
Returns the cursor position (in absolute screen coordinates).
This is especially useful for drawing, as the drawing API uses screen coordinates.
pub fn set_cursor_screen_pos(&self, pos: [f32; 2])
[src]
Sets the cursor position (in absolute screen coordinates)
pub fn align_text_to_frame_padding(&self)
[src]
Vertically aligns text baseline so that it will align properly to regularly frame items.
Call this if you have text on a line before a framed item.
pub fn text_line_height(&self) -> f32
[src]
pub fn text_line_height_with_spacing(&self) -> f32
[src]
pub fn frame_height(&self) -> f32
[src]
pub fn frame_height_with_spacing(&self) -> f32
[src]
impl<'ui> Ui<'ui>
[src]
pub fn window<'p>(&self, name: &'p ImStr) -> Window<'p>
[src]
use imgui::Window::new(...) instead
pub fn get_window_size(&self) -> [f32; 2]
[src]
use Ui::window_size instead
pub fn get_window_pos(&self) -> [f32; 2]
[src]
use Ui::window_pos instead
pub fn get_content_region_max(&self) -> [f32; 2]
[src]
use Ui::content_region_max instead
pub fn get_content_region_avail(&self) -> [f32; 2]
[src]
use Ui::content_region_avail instead
pub fn get_window_content_region_min(&self) -> [f32; 2]
[src]
use Ui::window_content_region_min instead
pub fn get_window_content_region_max(&self) -> [f32; 2]
[src]
use Ui::window_content_region_max instead
pub fn is_root_window_focused(&self) -> bool
[src]
use Ui::is_window_focused(WindowFlags::RootWindow) instead
pub fn is_child_window_focused(&self) -> bool
[src]
use Ui::is_window_focused(WindowFlags::ChildWindows) instead
impl<'ui> Ui<'ui>
[src]
pub fn progress_bar<'p>(&self, fraction: f32) -> ProgressBar<'p>
[src]
use imgui::ProgressBar::new(...) instead
impl<'ui> Ui<'ui>
[src]
pub fn color_edit<'p, V: Into<EditableColor<'p>>>(
&self,
label: &'p ImStr,
value: V
) -> ColorEdit<'p>
[src]
&self,
label: &'p ImStr,
value: V
) -> ColorEdit<'p>
use imgui::ColorEdit::new(...) instead
pub fn color_picker<'p, V: Into<EditableColor<'p>>>(
&self,
label: &'p ImStr,
value: V
) -> ColorPicker<'p>
[src]
&self,
label: &'p ImStr,
value: V
) -> ColorPicker<'p>
use imgui::ColorPicker::new(...) instead
pub fn color_button<'p>(
&self,
desc_id: &'p ImStr,
color: [f32; 4]
) -> ColorButton<'p>
[src]
&self,
desc_id: &'p ImStr,
color: [f32; 4]
) -> ColorButton<'p>
use imgui::ColorButton::new(...) instead
impl<'ui> Ui<'ui>
[src]
pub fn get_cursor_screen_pos(&self) -> [f32; 2]
[src]
use Ui::cursor_screen_pos instead
pub fn get_cursor_pos(&self) -> [f32; 2]
[src]
use Ui::cursor_pos instead
pub fn get_text_line_height_with_spacing(&self) -> f32
[src]
use Ui::text_line_height_with_spacing instead
impl<'ui> Ui<'ui>
[src]
pub fn get_column_index(&self) -> i32
[src]
use Ui::current_column_index instead
pub fn get_column_offset(&self, column_index: i32) -> f32
[src]
use Ui::column_offset instead
pub fn get_column_width(&self, column_index: i32) -> f32
[src]
use Ui::column_width instead
pub fn get_columns_count(&self) -> i32
[src]
use Ui::column_count instead
impl<'ui> Ui<'ui>
[src]
pub fn with_id<'a, F, I>(&self, id: I, f: F) where
F: FnOnce(),
I: Into<Id<'a>>,
[src]
F: FnOnce(),
I: Into<Id<'a>>,
use Ui::push_id instead
impl<'ui> Ui<'ui>
[src]
pub fn get_item_rect_size(&self) -> [f32; 2]
[src]
use Ui::item_rect_size instead
impl<'ui> Ui<'ui>
[src]
pub fn image(&self, texture: TextureId, size: [f32; 2]) -> Image
[src]
use imgui::Image::new(...) instead
pub fn image_button(&self, texture: TextureId, size: [f32; 2]) -> ImageButton
[src]
use imgui::ImageButton::new(...) instead
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]
&self,
label: &'p ImStr,
current_item: &mut i32,
items: &'p [&'p StringType],
height_in_items: i32
) -> bool
use imgui::ComboBox::new(...), and either build_simple(), build_simple_string(), or custom rendering (e.g. selectables) instead
impl<'ui> Ui<'ui>
[src]
pub fn selectable(
&self,
label: &ImStr,
selected: bool,
flags: SelectableFlags,
size: [f32; 2]
) -> bool
[src]
&self,
label: &ImStr,
selected: bool,
flags: SelectableFlags,
size: [f32; 2]
) -> bool
use imgui::Selectable::new(...) instead
impl<'ui> Ui<'ui>
[src]
pub fn menu_item<'a>(&self, label: &'a ImStr) -> MenuItem<'a>
[src]
use imgui::MenuItem::new(...) 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.
Returns a FontStackToken
that must be popped by calling .pop()
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 font = ui.push_font(my_custom_font); ui.text("I use the custom font!"); font.pop(&ui);
#[must_use]pub fn push_style_color(
&self,
style_color: StyleColor,
color: [f32; 4]
) -> ColorStackToken
[src]
&self,
style_color: StyleColor,
color: [f32; 4]
) -> ColorStackToken
Changes a style color by pushing a change to the color stack.
Returns a ColorStackToken
that must be popped by calling .pop()
Examples
const RED: [f32; 4] = [1.0, 0.0, 0.0, 1.0]; let color = ui.push_style_color(StyleColor::Text, RED); ui.text("I'm red!"); color.pop(&ui);
#[must_use]pub fn push_style_colors<'a, I>(&self, style_colors: I) -> ColorStackToken where
I: IntoIterator<Item = &'a (StyleColor, [f32; 4])>,
[src]
I: IntoIterator<Item = &'a (StyleColor, [f32; 4])>,
Changes style colors by pushing several changes to the color stack.
Returns a ColorStackToken
that must be popped by calling .pop()
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 colors = ui.push_style_colors(&[ (StyleColor::Text, RED), (StyleColor::TextDisabled, GREEN), ]); ui.text("I'm red!"); ui.text_disabled("I'm green!"); colors.pop(&ui);
#[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.
Returns a StyleStackToken
that must be popped by calling .pop()
Examples
let style = ui.push_style_var(StyleVar::Alpha(0.2)); ui.text("I'm transparent!"); style.pop(&ui);
#[must_use]pub fn push_style_vars<'a, I>(&self, style_vars: I) -> StyleStackToken where
I: IntoIterator<Item = &'a StyleVar>,
[src]
I: IntoIterator<Item = &'a StyleVar>,
Changes style variables by pushing several changes to the style stack.
Returns a StyleStackToken
that must be popped by calling .pop()
Examples
let styles = 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"); styles.pop(&ui);
impl<'ui> Ui<'ui>
[src]
pub fn push_item_width(&self, item_width: f32) -> ItemWidthStackToken
[src]
Changes the item width by pushing a change to the item width stack.
Returns an ItemWidthStackToken
that may be popped by calling .pop()
> 0.0
: width isitem_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)
pub fn set_next_item_width(&self, item_width: f32)
[src]
Sets the width of the next item.
> 0.0
: width isitem_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)
pub fn calc_item_width(&self) -> f32
[src]
Returns the width of the item given the pushed settings and the current cursor position.
This is NOT necessarily the width of last item.
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.
Returns a TextWrapPosStackToken
that may be popped by calling .pop()
> 0.0
: wrap atwrap_pos_x
position in window local space= 0.0
: wrap to end of window (or column)< 0.0
: no wrapping
pub fn push_item_flag(&self, item_flag: ItemFlag) -> ItemFlagsStackToken
[src]
Changes an item flag by pushing a change to the item flag stack.
Returns a ItemFlagsStackToken
that may be popped by calling .pop()
impl<'ui> Ui<'ui>
[src]
#[must_use]pub fn push_id<'a, I: Into<Id<'a>>>(&self, id: I) -> IdStackToken
[src]
Pushes an identifier to the ID stack.
Returns an IdStackToken
that must be popped by calling .pop()
impl<'ui> Ui<'ui>
[src]
pub fn is_item_hovered(&self) -> bool
[src]
Returns true
if the last item is hovered
pub fn is_item_hovered_with_flags(&self, flags: ItemHoveredFlags) -> bool
[src]
Returns true
if the last item is hovered based on the given flags
pub fn is_item_active(&self) -> bool
[src]
Returns true
if the last item is active
pub fn is_item_focused(&self) -> bool
[src]
Returns true
if the last item is focused for keyboard/gamepad navigation
pub fn is_item_clicked(&self, button: MouseButton) -> bool
[src]
Returns true
if the last item is being clicked
pub fn is_item_visible(&self) -> bool
[src]
Returns true
if the last item is visible
pub fn is_item_edited(&self) -> bool
[src]
Returns true
if the last item modified its underlying value this frame or was pressed
pub fn is_item_activated(&self) -> bool
[src]
Returns true
if the last item was just made active
pub fn is_item_deactivated(&self) -> bool
[src]
Returns true
if the last item was just made inactive
pub fn is_item_deactivated_after_edit(&self) -> bool
[src]
Returns true
if the last item was just made inactive and made a value change when it was
active
pub fn is_any_item_hovered(&self) -> bool
[src]
Returns true
if any item is hovered
pub fn is_any_item_active(&self) -> bool
[src]
Returns true
if any item is active
pub fn is_any_item_focused(&self) -> bool
[src]
Returns true
if any item is focused
pub fn item_rect_min(&self) -> [f32; 2]
[src]
Returns the upper-left bounding rectangle of the last item (in screen coordinates)
pub fn item_rect_max(&self) -> [f32; 2]
[src]
Returns the lower-right bounding rectangle of the last item (in screen coordinates)
pub fn item_rect_size(&self) -> [f32; 2]
[src]
Returns the size of the last item
pub fn set_item_allow_overlap(&self)
[src]
Allows the 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 set_item_default_focus(&self)
[src]
Makes the last item the default focused item of the window
impl<'ui> Ui<'ui>
[src]
pub fn is_cursor_rect_visible(&self, size: [f32; 2]) -> bool
[src]
Returns true
if the rectangle (of given size, starting from cursor position) is visible
pub fn is_rect_visible(&self, rect_min: [f32; 2], rect_max: [f32; 2]) -> bool
[src]
Returns true
if the rectangle (in screen coordinates) is visible
pub fn time(&self) -> f64
[src]
Returns the global imgui-rs time.
Incremented by Io::delta_time every frame.
pub fn frame_count(&self) -> i32
[src]
Returns the global imgui-rs frame count.
Incremented by 1 every frame.
pub fn style_color(&self, style_color: StyleColor) -> [f32; 4]
[src]
Returns a single style color from the user interface style.
Use this function if you need to access the colors, but don't want to clone the entire style object.
impl<'ui> Ui<'ui>
[src]
pub fn set_color_edit_options(&self, flags: ColorEditFlags)
[src]
Initializes current color editor/picker 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]
#[must_use]pub fn begin_main_menu_bar(&self) -> Option<MainMenuBarToken>
[src]
Creates and starts appending to a full-screen menu bar.
Returns Some(MainMenuBarToken)
if the menu bar is visible. After content has been
rendered, the token must be ended by calling .end()
.
Returns None
if the menu bar is not visible and no content should be rendered.
pub fn main_menu_bar<F: FnOnce()>(&self, f: F)
[src]
Creates a full-screen main menu bar and runs a closure to construct the contents.
Note: the closure is not called if the menu bar is not visible.
#[must_use]pub fn begin_menu_bar(&self) -> Option<MenuBarToken>
[src]
Creates and starts appending to the menu bar of the current window.
Returns Some(MenuBarToken)
if the menu bar is visible. After content has been
rendered, the token must be ended by calling .end()
.
Returns None
if the menu bar is not visible and no content should be rendered.
pub fn menu_bar<F: FnOnce()>(&self, f: F)
[src]
Creates a menu bar in the current window and runs a closure to construct the contents.
Note: the closure is not called if the menu bar is not visible.
#[must_use]pub fn begin_menu(&self, label: &ImStr, enabled: bool) -> Option<MenuToken>
[src]
Creates and starts appending to a sub-menu entry.
Returns Some(MenuToken)
if the menu is visible. After content has been
rendered, the token must be ended by calling .end()
.
Returns None
if the menu is not visible and no content should be rendered.
pub fn menu<F: FnOnce()>(&self, label: &ImStr, enabled: bool, f: F)
[src]
Creates a menu and runs a closure to construct the contents.
Note: the closure is not called if the menu is not visible.
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]
T: Copy + PartialEq + BitOrAssign + BitAndAssign + BitAnd<Output = T> + Not<Output = T>,
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]
&self,
label: &ImStr,
value: &mut T,
button_value: T
) -> bool where
T: Copy + PartialEq,
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 content_region_max(&self) -> [f32; 2]
[src]
Returns the current content boundaries (in window coordinates)
pub fn content_region_avail(&self) -> [f32; 2]
[src]
Equal to ui.content_region_max()
- ui.cursor_pos()
pub fn window_content_region_min(&self) -> [f32; 2]
[src]
Content boundaries min (in window coordinates).
Roughly equal to [0.0, 0.0] - scroll.
pub fn window_content_region_max(&self) -> [f32; 2]
[src]
Content boundaries max (in window coordinates).
Roughly equal to [0.0, 0.0] + size - scroll.
pub fn window_content_region_width(&self) -> f32
[src]
impl<'ui> Ui<'ui>
[src]
pub fn scroll_x(&self) -> f32
[src]
Returns the horizontal scrolling position.
Value is between 0.0 and self.scroll_max_x().
pub fn scroll_y(&self) -> f32
[src]
Returns the vertical scrolling position.
Value is between 0.0 and self.scroll_max_y().
pub fn scroll_max_x(&self) -> f32
[src]
Returns the maximum horizontal scrolling position.
Roughly equal to content size X - window size X.
pub fn scroll_max_y(&self) -> f32
[src]
Returns the maximum vertical scrolling position.
Roughly equal to content size Y - window size Y.
pub fn set_scroll_x(&self, scroll_x: f32)
[src]
Sets the horizontal scrolling position
pub fn set_scroll_y(&self, scroll_y: f32)
[src]
Sets the vertical scroll position
pub fn set_scroll_here_x(&self)
[src]
Adjusts the horizontal scroll position to make the current cursor position visible
pub fn set_scroll_here_x_with_ratio(&self, center_x_ratio: f32)
[src]
Adjusts the horizontal scroll position to make the current cursor position visible.
center_x_ratio:
0.0
: left0.5
: center1.0
: right
pub fn set_scroll_here_y(&self)
[src]
Adjusts the vertical scroll position to make the current cursor position visible
pub fn set_scroll_here_y_with_ratio(&self, center_y_ratio: f32)
[src]
Adjusts the vertical scroll position to make the current cursor position visible.
center_y_ratio:
0.0
: top0.5
: center1.0
: bottom
pub fn set_scroll_from_pos_x(&self, local_x: f32)
[src]
Adjusts the horizontal scroll position to make the given position visible
pub fn set_scroll_from_pos_x_with_ratio(
&self,
local_x: f32,
center_x_ratio: f32
)
[src]
&self,
local_x: f32,
center_x_ratio: f32
)
Adjusts the horizontal scroll position to make the given position visible.
center_x_ratio:
0.0
: left0.5
: center1.0
: right
pub fn set_scroll_from_pos_y(&self, local_y: f32)
[src]
Adjusts the vertical scroll position to make the given position visible
pub fn set_scroll_from_pos_y_with_ratio(
&self,
local_y: f32,
center_y_ratio: f32
)
[src]
&self,
local_y: f32,
center_y_ratio: f32
)
Adjusts the vertical scroll position to make the given position visible.
center_y_ratio:
0.0
: top0.5
: center1.0
: bottom
impl<'ui> Ui<'ui>
[src]
pub fn is_window_appearing(&self) -> bool
[src]
Returns true if the current window appeared during this frame
pub fn is_window_collapsed(&self) -> bool
[src]
Returns true if the current window is in collapsed state (= only the title bar is visible)
pub fn is_window_focused(&self) -> bool
[src]
Returns true if the current window is focused
pub fn is_window_focused_with_flags(&self, flags: WindowFocusedFlags) -> bool
[src]
Returns true if the current window is focused based on the given flags
pub fn is_window_hovered(&self) -> bool
[src]
Returns true if the current window is hovered
pub fn is_window_hovered_with_flags(&self, flags: WindowHoveredFlags) -> bool
[src]
Returns true if the current window is hovered based on the given flags
pub fn window_pos(&self) -> [f32; 2]
[src]
Returns the position of the current window (in screen space)
pub fn window_size(&self) -> [f32; 2]
[src]
Returns the size of the current window
impl<'ui> Ui<'ui>
[src]
pub fn io(&self) -> &Io
[src]
Returns an immutable reference to the inputs/outputs object
pub fn fonts(&self) -> FontAtlasRef<'_>
[src]
Returns an immutable reference to the font atlas
pub fn clone_style(&self) -> Style
[src]
Returns a clone of the user interface style
pub fn render(self) -> &'ui DrawData
[src]
Renders the frame and returns a reference to the resulting draw data
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]
#[must_use]pub fn input_text<'p>(
&self,
label: &'p ImStr,
buf: &'p mut ImString
) -> InputText<'ui, 'p>
[src]
&self,
label: &'p ImStr,
buf: &'p mut ImString
) -> InputText<'ui, 'p>
#[must_use]pub fn input_text_multiline<'p>(
&self,
label: &'p ImStr,
buf: &'p mut ImString,
size: [f32; 2]
) -> InputTextMultiline<'ui, 'p>
[src]
&self,
label: &'p ImStr,
buf: &'p mut ImString,
size: [f32; 2]
) -> InputTextMultiline<'ui, 'p>
#[must_use]pub fn input_float<'p>(
&self,
label: &'p ImStr,
value: &'p mut f32
) -> InputFloat<'ui, 'p>
[src]
&self,
label: &'p ImStr,
value: &'p mut f32
) -> InputFloat<'ui, 'p>
#[must_use]pub fn input_float2<'p>(
&self,
label: &'p ImStr,
value: &'p mut [f32; 2]
) -> InputFloat2<'ui, 'p>
[src]
&self,
label: &'p ImStr,
value: &'p mut [f32; 2]
) -> InputFloat2<'ui, 'p>
#[must_use]pub fn input_float3<'p>(
&self,
label: &'p ImStr,
value: &'p mut [f32; 3]
) -> InputFloat3<'ui, 'p>
[src]
&self,
label: &'p ImStr,
value: &'p mut [f32; 3]
) -> InputFloat3<'ui, 'p>
#[must_use]pub fn input_float4<'p>(
&self,
label: &'p ImStr,
value: &'p mut [f32; 4]
) -> InputFloat4<'ui, 'p>
[src]
&self,
label: &'p ImStr,
value: &'p mut [f32; 4]
) -> InputFloat4<'ui, 'p>
#[must_use]pub fn input_int<'p>(
&self,
label: &'p ImStr,
value: &'p mut i32
) -> InputInt<'ui, 'p>
[src]
&self,
label: &'p ImStr,
value: &'p mut i32
) -> InputInt<'ui, 'p>
#[must_use]pub fn input_int2<'p>(
&self,
label: &'p ImStr,
value: &'p mut [i32; 2]
) -> InputInt2<'ui, 'p>
[src]
&self,
label: &'p ImStr,
value: &'p mut [i32; 2]
) -> InputInt2<'ui, 'p>
#[must_use]pub fn input_int3<'p>(
&self,
label: &'p ImStr,
value: &'p mut [i32; 3]
) -> InputInt3<'ui, 'p>
[src]
&self,
label: &'p ImStr,
value: &'p mut [i32; 3]
) -> InputInt3<'ui, 'p>
#[must_use]pub fn input_int4<'p>(
&self,
label: &'p ImStr,
value: &'p mut [i32; 4]
) -> InputInt4<'ui, 'p>
[src]
&self,
label: &'p ImStr,
value: &'p mut [i32; 4]
) -> InputInt4<'ui, 'p>
impl<'ui> Ui<'ui>
[src]
#[must_use]pub fn drag_float<'p>(
&self,
label: &'p ImStr,
value: &'p mut f32
) -> DragFloat<'ui, 'p>
[src]
&self,
label: &'p ImStr,
value: &'p mut f32
) -> DragFloat<'ui, 'p>
#[must_use]pub fn drag_float2<'p>(
&self,
label: &'p ImStr,
value: &'p mut [f32; 2]
) -> DragFloat2<'ui, 'p>
[src]
&self,
label: &'p ImStr,
value: &'p mut [f32; 2]
) -> DragFloat2<'ui, 'p>
#[must_use]pub fn drag_float3<'p>(
&self,
label: &'p ImStr,
value: &'p mut [f32; 3]
) -> DragFloat3<'ui, 'p>
[src]
&self,
label: &'p ImStr,
value: &'p mut [f32; 3]
) -> DragFloat3<'ui, 'p>
#[must_use]pub fn drag_float4<'p>(
&self,
label: &'p ImStr,
value: &'p mut [f32; 4]
) -> DragFloat4<'ui, 'p>
[src]
&self,
label: &'p ImStr,
value: &'p mut [f32; 4]
) -> DragFloat4<'ui, 'p>
#[must_use]pub fn drag_float_range2<'p>(
&self,
label: &'p ImStr,
current_min: &'p mut f32,
current_max: &'p mut f32
) -> DragFloatRange2<'ui, 'p>
[src]
&self,
label: &'p ImStr,
current_min: &'p mut f32,
current_max: &'p mut f32
) -> DragFloatRange2<'ui, 'p>
#[must_use]pub fn drag_int<'p>(
&self,
label: &'p ImStr,
value: &'p mut i32
) -> DragInt<'ui, 'p>
[src]
&self,
label: &'p ImStr,
value: &'p mut i32
) -> DragInt<'ui, 'p>
#[must_use]pub fn drag_int2<'p>(
&self,
label: &'p ImStr,
value: &'p mut [i32; 2]
) -> DragInt2<'ui, 'p>
[src]
&self,
label: &'p ImStr,
value: &'p mut [i32; 2]
) -> DragInt2<'ui, 'p>
#[must_use]pub fn drag_int3<'p>(
&self,
label: &'p ImStr,
value: &'p mut [i32; 3]
) -> DragInt3<'ui, 'p>
[src]
&self,
label: &'p ImStr,
value: &'p mut [i32; 3]
) -> DragInt3<'ui, 'p>
#[must_use]pub fn drag_int4<'p>(
&self,
label: &'p ImStr,
value: &'p mut [i32; 4]
) -> DragInt4<'ui, 'p>
[src]
&self,
label: &'p ImStr,
value: &'p mut [i32; 4]
) -> DragInt4<'ui, 'p>
#[must_use]pub fn drag_int_range2<'p>(
&self,
label: &'p ImStr,
current_min: &'p mut i32,
current_max: &'p mut i32
) -> DragIntRange2<'ui, 'p>
[src]
&self,
label: &'p ImStr,
current_min: &'p mut i32,
current_max: &'p mut i32
) -> DragIntRange2<'ui, 'p>
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]
&self,
label: &'p ImStr
) -> CollapsingHeader<'ui, 'p>
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 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]
F: FnOnce(),
#[must_use]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 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]
&self,
label: &'p ImStr,
current_item: &mut i32,
items: &'p [&'p StringType],
height_in_items: i32
) -> bool
impl<'ui> Ui<'ui>
[src]
#[must_use]pub fn plot_lines<'p>(
&self,
label: &'p ImStr,
values: &'p [f32]
) -> PlotLines<'ui, 'p>
[src]
&self,
label: &'p ImStr,
values: &'p [f32]
) -> PlotLines<'ui, 'p>
impl<'ui> Ui<'ui>
[src]
#[must_use]pub fn plot_histogram<'p>(
&self,
label: &'p ImStr,
values: &'p [f32]
) -> PlotHistogram<'ui, 'p>
[src]
&self,
label: &'p ImStr,
values: &'p [f32]
) -> PlotHistogram<'ui, 'p>
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]
&self,
text: &ImStr,
hide_text_after_double_hash: bool,
wrap_width: f32
) -> [f32; 2]
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]
#[must_use]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
Auto Trait Implementations
impl<'ui> !RefUnwindSafe for Ui<'ui>
impl<'ui> !Send for Ui<'ui>
impl<'ui> !Sync for Ui<'ui>
impl<'ui> Unpin for Ui<'ui>
impl<'ui> !UnwindSafe for Ui<'ui>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,