pub struct UiBuilder {
pub id_salt: Option<Id>,
pub ui_stack_info: UiStackInfo,
pub layer_id: Option<LayerId>,
pub max_rect: Option<Rect>,
pub layout: Option<Layout>,
pub disabled: bool,
pub invisible: bool,
pub sizing_pass: bool,
pub style: Option<Arc<Style>>,
pub sense: Option<Sense>,
}Expand description
Build a Ui as the child of another Ui.
By default, everything is inherited from the parent,
except for max_rect which by default is set to
the parent Ui::available_rect_before_wrap.
Fields§
§id_salt: Option<Id>§ui_stack_info: UiStackInfo§layer_id: Option<LayerId>§max_rect: Option<Rect>§layout: Option<Layout>§disabled: bool§invisible: bool§sizing_pass: bool§style: Option<Arc<Style>>§sense: Option<Sense>Implementations§
Source§impl UiBuilder
impl UiBuilder
pub fn new() -> Self
Sourcepub fn ui_stack_info(self, ui_stack_info: UiStackInfo) -> Self
pub fn ui_stack_info(self, ui_stack_info: UiStackInfo) -> Self
Provide some information about the new Ui being built.
Sourcepub fn max_rect(self, max_rect: Rect) -> Self
pub fn max_rect(self, max_rect: Rect) -> Self
Set the max rectangle, within which widgets will go.
New widgets will try to fit within this rectangle.
Text labels will wrap to fit within max_rect.
Separator lines will span the max_rect.
If a new widget doesn’t fit within the max_rect then the
Ui will make room for it by expanding both min_rect and
If not set, this will be set to the parent
Ui::available_rect_before_wrap.
Sourcepub fn layout(self, layout: Layout) -> Self
pub fn layout(self, layout: Layout) -> Self
Override the layout.
Will otherwise be inherited from the parent.
Sourcepub fn disabled(self) -> Self
pub fn disabled(self) -> Self
Make the new Ui disabled, i.e. grayed-out and non-interactive.
Note that if the parent Ui is disabled, the child will always be disabled.
Sourcepub fn invisible(self) -> Self
pub fn invisible(self) -> Self
Make the contents invisible.
Will also disable the Ui (see Self::disabled).
If the parent Ui is invisible, the child will always be invisible.
Sourcepub fn sizing_pass(self) -> Self
pub fn sizing_pass(self) -> Self
Set to true in special cases where we do one frame where we size up the contents of the Ui, without actually showing it.
If the sizing_pass flag is set on the parent,
the child will inherit it automatically.
Sourcepub fn style(self, style: impl Into<Arc<Style>>) -> Self
pub fn style(self, style: impl Into<Arc<Style>>) -> Self
Override the style.
Otherwise will inherit the style of the parent.
Sourcepub fn sense(self, sense: Sense) -> Self
pub fn sense(self, sense: Sense) -> Self
Set if you want sense clicks and/or drags. Default is Sense::hover.
The sense will be registered below the Senses of any widgets contained in this Ui, so
if the user clicks a button contained within this Ui, that button will receive the click
instead.
The response can be read early with Ui::response.