pub struct UiBuilder {
pub id_salt: Option<Id>,
pub ui_stack_info: UiStackInfo,
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 chlild 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
§max_rect: Option<Rect>
§layout: Option<Layout>
§disabled: bool
§invisible: bool
§sizing_pass: bool
§style: Option<Arc<Style>>
§sense: Option<Sense>
Implementations§
§impl UiBuilder
impl UiBuilder
pub fn new() -> UiBuilder
pub fn ui_stack_info(self, ui_stack_info: UiStackInfo) -> UiBuilder
pub fn ui_stack_info(self, ui_stack_info: UiStackInfo) -> UiBuilder
Provide some information about the new Ui
being built.
pub fn max_rect(self, max_rect: Rect) -> UiBuilder
pub fn max_rect(self, max_rect: Rect) -> UiBuilder
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
.
pub fn layout(self, layout: Layout) -> UiBuilder
pub fn layout(self, layout: Layout) -> UiBuilder
Override the layout.
Will otherwise be inherited from the parent.
pub fn disabled(self) -> UiBuilder
pub fn disabled(self) -> UiBuilder
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.
pub fn invisible(self) -> UiBuilder
pub fn invisible(self) -> UiBuilder
Make the contents invisible.
Will also disable the Ui
(see Self::disabled
).
If the parent Ui
is invisible, the child will always be invisible.
pub fn sizing_pass(self) -> UiBuilder
pub fn sizing_pass(self) -> UiBuilder
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.
pub fn style(self, style: impl Into<Arc<Style>>) -> UiBuilder
pub fn style(self, style: impl Into<Arc<Style>>) -> UiBuilder
Override the style.
Otherwise will inherit the style of the parent.
pub fn sense(self, sense: Sense) -> UiBuilder
pub fn sense(self, sense: Sense) -> UiBuilder
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
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UiBuilder
impl !RefUnwindSafe for UiBuilder
impl Send for UiBuilder
impl Sync for UiBuilder
impl Unpin for UiBuilder
impl !UnwindSafe for UiBuilder
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
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request