Struct pixel_game_lib::gui::GuiBuilder
source · pub struct GuiBuilder { /* private fields */ }
Expand description
Construct a GUI from a tree of widgets defined by the layout.
Implementations§
source§impl GuiBuilder
impl GuiBuilder
sourcepub fn new(root_layout: Style) -> Self
pub fn new(root_layout: Style) -> Self
Start creating a GUI.
Arguments
root_layout
- Layout for the root node. Size will be automatically set by theWidget::update_layout
trait call.
sourcepub fn add_widget<W>(
&mut self,
widget: W,
layout: Style,
parent: Node
) -> Result<Node>where
W: Widget + 'static,
pub fn add_widget<W>(
&mut self,
widget: W,
layout: Style,
parent: Node
) -> Result<Node>where
W: Widget + 'static,
Register a widget.
This will automatically update the widget size and location when it changes.
Arguments
widget
- Widget implementing theWidget
trait.layout
- How theWidget
behaves as a layout.parent
- Parent Taffy node the widget will be a child of.
Returns
A Taffy node type that can be used to create a hierarchy of nodes. This can be used in the update or draw loop to get a reference to the widget itself.
Auto Trait Implementations§
impl !RefUnwindSafe for GuiBuilder
impl !Send for GuiBuilder
impl !Sync for GuiBuilder
impl Unpin for GuiBuilder
impl !UnwindSafe for GuiBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more