[][src]Struct megaui::Ui

pub struct Ui {
    pub frame: u64,
    pub font_atlas: Rc<FontAtlas>,
    // some fields omitted
}

Fields

frame: u64

Returns the number of frames that have elapsed since the program started.

font_atlas: Rc<FontAtlas>

Implementations

impl Ui[src]

pub fn new() -> Ui[src]

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

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

Returns true if the last widget which had .ui called on it is being clicked.

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

Returns true if the mouse is over the last widget which had .ui called on it.

pub fn scroll_here(&mut self)[src]

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

pub fn scroll_here_ratio(&mut self, ratio: f32)[src]

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.

pub fn scroll(&mut self) -> Vector2[src]

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.

pub fn scroll_max(&mut self) -> Vector2[src]

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 set_clipboard_object<T: ClipboardObject + 'static>(
    &mut self,
    clipboard: T
)
[src]

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

pub fn is_mouse_over(&self, mouse_position: Vector2) -> bool[src]

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

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

pub fn close_current_window(&mut self)[src]

pub fn is_focused(&self, id: Id) -> bool[src]

pub fn new_frame(&mut self, delta: f32)[src]

pub fn render(&mut self, draw_list: &mut Vec<DrawList>)[src]

pub fn focus_window(&mut self, id: Id)[src]

pub fn move_window(&mut self, id: Id, position: Vector2)[src]

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

pub fn canvas(&mut self) -> DrawCanvas<'_>[src]

pub fn get_bool(&mut self, id: Id) -> &mut bool[src]

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[src]

impl Ui[src]

pub fn button<P: Into<Option<Vector2>>>(
    &mut self,
    position: P,
    label: &str
) -> bool
[src]

impl Ui[src]

pub fn checkbox(&mut self, id: Id, label: &str, data: &mut bool)[src]

impl Ui[src]

pub fn combo_box<'a>(
    &mut self,
    id: Id,
    label: &str,
    variants: &[&str],
    data: impl Into<Option<&'a mut usize>>
) -> usize
[src]

impl Ui[src]

pub fn drag<T: Num, T1: Into<Option<(T, T)>>>(
    &mut self,
    id: Id,
    label: &str,
    range: T1,
    data: &mut T
)
[src]

impl Ui[src]

pub fn editbox(&mut self, id: Id, size: Vector2, text: &mut String) -> bool[src]

impl Ui[src]

pub fn group<F: FnOnce(&mut Ui)>(&mut self, id: Id, size: Vector2, f: F) -> Drag[src]

impl Ui[src]

pub fn input_field(&mut self, id: Id, label: &str, data: &mut String)[src]

👎 Deprecated:

Use input_text instead

pub fn input_text(&mut self, id: Id, label: &str, data: &mut String)[src]

impl Ui[src]

pub fn label<P: Into<Option<Vector2>>>(&mut self, position: P, label: &str)[src]

impl Ui[src]

pub fn popup<F: FnOnce(&mut Ui)>(&mut self, id: Id, size: Vector2, f: F)[src]

impl Ui[src]

pub fn separator(&mut self)[src]

impl Ui[src]

pub fn slider(&mut self, id: Id, label: &str, range: Range<f32>, data: &mut f32)[src]

impl Ui[src]

pub fn tabbar<'a>(
    &mut self,
    id: Id,
    position: Vector2,
    size: Vector2,
    tabs: &'a [&'a str]
) -> u32
[src]

impl Ui[src]

pub fn texture(&mut self, texture: u32, w: f32, h: f32) -> bool[src]

impl Ui[src]

pub fn tree_node<F: FnOnce(&mut Ui)>(
    &mut self,
    id: Id,
    label: &str,
    f: F
) -> bool
[src]

impl Ui[src]

pub fn window<F: FnOnce(&mut Ui)>(
    &mut self,
    id: Id,
    position: Vector2,
    size: Vector2,
    f: F
) -> bool
[src]

Trait Implementations

impl InputHandler for Ui[src]

Auto Trait Implementations

impl !RefUnwindSafe for Ui[src]

impl !Send for Ui[src]

impl !Sync for Ui[src]

impl Unpin for Ui[src]

impl !UnwindSafe for Ui[src]

Blanket Implementations

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

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

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

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.