pub struct Ui {
pub frame: u64,
/* private fields */
}
Fields
frame: u64
Returns the number of frames that have elapsed since the program started.
Implementations
sourceimpl Ui
impl Ui
pub fn input_field(&mut self, id: Id, label: &str, data: &mut String)
Use input_text instead
pub fn input_text(&mut self, id: Id, label: &str, data: &mut String)
pub fn input_password(&mut self, id: Id, label: &str, data: &mut String)
sourceimpl Ui
impl Ui
pub fn new(ctx: &mut Context, screen_width: f32, screen_height: f32) -> Ui
pub fn set_default_skin(&mut self, _skin: Skin)
pub fn style_builder(&self) -> StyleBuilder
pub fn default_skin(&self) -> Skin
sourcepub fn last_item_clicked(&mut self) -> bool
pub fn last_item_clicked(&mut self) -> bool
Returns true if the last widget which had .ui
called on it is being clicked.
sourcepub fn last_item_hovered(&mut self) -> bool
pub fn last_item_hovered(&mut self) -> bool
Returns true if the mouse is over the last widget which had .ui
called on it.
sourcepub fn scroll_here(&mut self)
pub fn scroll_here(&mut self)
Scrolls the middle of the active GUI window to its GUI cursor
Note that this does not work on the first frame of the GUI application.
If you want your widget to start with its scrollbar in a particular location,
consider if ui.frame == 1 { ui.scroll_here() }
.
sourcepub fn scroll_here_ratio(&mut self, ratio: f32)
pub fn scroll_here_ratio(&mut self, ratio: f32)
Scrolls the active GUI window to its GUI cursor.
1.0 puts the bottom of the window at the GUI cursor, 0.0 puts the top of the window there.
0.5 as the ratio puts the middle of the window at the GUI cursor,
and is equivalent to Ui::scroll_here
.
sourcepub fn scroll(&mut self) -> Vec2
pub fn scroll(&mut self) -> Vec2
How far the active gui window has been scrolled down on the y axis.
Note that for these purposes, a Group widget is still considered a Window because it can have its own scrollbar.
sourcepub fn scroll_max(&mut self) -> Vec2
pub fn scroll_max(&mut self) -> Vec2
The farthest down a scrollbar may go given the constraints of its window.
Note that for these purposes, a Group widget is still considered a Window because it can have its own scrollbar.
pub fn is_mouse_captured(&self) -> bool
pub fn is_mouse_over(&self, mouse_position: Vec2) -> bool
pub fn active_window_focused(&self) -> bool
pub fn is_dragging(&self) -> bool
pub fn close_current_window(&mut self)
pub fn new_frame(&mut self, delta: f32)
pub fn render(&mut self, draw_list: &mut Vec<DrawList>)
pub fn focus_window(&mut self, id: Id)
pub fn set_input_focus(&mut self, id: Id)
pub fn clear_input_focus(&mut self)
pub fn move_window(&mut self, id: Id, position: Vec2)
pub fn same_line(&mut self, x: f32)
pub fn canvas(&mut self) -> DrawCanvas<'_>
sourcepub fn get_bool(&mut self, id: Id) -> &mut bool
pub fn get_bool(&mut self, id: Id) -> &mut bool
small hack to keep some internal state used like this:
if ui.last_item_clicked() {
*ui.get_bool(hash!("color picker opened")) ^= true;
}
if *ui.get_bool(hash!("color picker opened")) {
}
pub fn get_any<T: Any + Default>(&mut self, id: Id) -> &mut T
pub fn push_skin(&mut self, skin: &Skin)
pub fn pop_skin(&mut self)
Trait Implementations
sourceimpl InputHandler for Ui
impl InputHandler for Ui
fn mouse_down(&mut self, position: (f32, f32))
fn mouse_up(&mut self, _: (f32, f32))
fn mouse_wheel(&mut self, x: f32, y: f32)
fn mouse_move(&mut self, position: (f32, f32))
fn char_event(&mut self, character: char, shift: bool, ctrl: bool)
fn key_down(&mut self, key: KeyCode, shift: bool, ctrl: bool)
Auto Trait Implementations
impl !RefUnwindSafe for Ui
impl !Send for Ui
impl !Sync for Ui
impl Unpin for Ui
impl !UnwindSafe for Ui
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more