Struct iui::prelude::UI [−][src]
pub struct UI { /* fields omitted */ }
A handle to user interface functionality.
Methods
impl UI
[src]
impl UI
pub fn parent_of<T: Into<Control>>(&self, control: T) -> Option<Control>
[src]
pub fn parent_of<T: Into<Control>>(&self, control: T) -> Option<Control>
pub unsafe fn set_parent_of<T: Into<Control>>(
&mut self,
control: T,
parent: Option<T>
)
[src]
pub unsafe fn set_parent_of<T: Into<Control>>(
&mut self,
control: T,
parent: Option<T>
)
Set the parent control of this control, "moving" it to a new place in
the UI tree or, if passed None
, removing it from the tree.
pub fn is_toplevel<T: Into<Control>>(&self, control: T) -> bool
[src]
pub fn is_toplevel<T: Into<Control>>(&self, control: T) -> bool
Returns true if this control is a top-level control; the root of the UI tree.
pub fn is_shown<T: Into<Control>>(&self, control: T) -> bool
[src]
pub fn is_shown<T: Into<Control>>(&self, control: T) -> bool
Returns true if this control is currently set to be displayed.
pub fn set_shown<T: Into<Control>>(&mut self, control: T, show: bool)
[src]
pub fn set_shown<T: Into<Control>>(&mut self, control: T, show: bool)
Sets whether or not the control should be displayed.
pub fn is_enabled<T: Into<Control>>(&self, control: T) -> bool
[src]
pub fn is_enabled<T: Into<Control>>(&self, control: T) -> bool
Returns true if the control is enabled (can be interacted with).
pub fn set_enabled<T: Into<Control>>(&mut self, control: T, enabled: bool)
[src]
pub fn set_enabled<T: Into<Control>>(&mut self, control: T, enabled: bool)
Sets the enable/disable state of the control. If disabled, a control cannot be interacted with, and visual cues to that effect are presented to the user.
impl UI
[src]
impl UI
pub fn init() -> Result<UI, UIError>
[src]
pub fn init() -> Result<UI, UIError>
Initializes the underlying UI bindings, producing a UI
struct which can be used
to actually build your user interface. This is a reference counted type; clone it
to get an additional reference that can be passed to, e.g., callbacks.
Only one libUI binding can be active at once; if multiple instances are detected,
this function will return a MultipleInitError
.
Be aware the Cocoa (GUI toolkit on Mac OS) requires that the first thread spawned controls
the UI, so do not spin off your UI interactions into an alternative thread. You're likely to
have problems on Mac OS.
{ let ui1 = UI::init().unwrap(); // This will fail because there is already an instance of UI. let ui2 = UI::init(); assert!(ui2.is_err()); // ui1 dropped here. } let ui3 = UI::init().unwrap();
If libUI cannot initialize its hooks into the platform bindings, this function will
return a FailedInitError
with the description of the problem.
pub fn main(&self)
[src]
pub fn main(&self)
Hands control of this thread to the UI toolkit, allowing it to display the UI and respond to events. Does not return until the UI quits.
For more control, use the EventLoop
struct.
pub fn event_loop(&self) -> EventLoop
[src]
pub fn event_loop(&self) -> EventLoop
Returns an EventLoop
, a struct that allows you to step over iterations or events in the UI.
pub fn quit(&self)
[src]
pub fn quit(&self)
Running this function causes the UI to quit, exiting from main and no longer showing any widgets.
Run in every window's default on_closing
callback.
pub fn queue_main<F: FnMut()>(&self, callback: F)
[src]
pub fn queue_main<F: FnMut()>(&self, callback: F)
Queues a function to be executed on the GUI threa when next possible. Returns immediately, not waiting for the function to be executed.
Example
use iui::prelude::*; let ui = UI::init().unwrap(); ui.queue_main(|| { println!("Runs first") } ); ui.queue_main(|| { println!("Runs second") } ); ui.quit();
pub fn on_should_quit<F: FnMut()>(&self, callback: F)
[src]
pub fn on_should_quit<F: FnMut()>(&self, callback: F)
Set a callback to be run when the application quits.