Struct re_ui::list_item::scope::LayoutInfo
source · pub struct LayoutInfo {
pub(crate) left_x: f32,
pub(crate) left_column_width: Option<f32>,
pub(crate) reserve_action_button_space: bool,
scope_id: Id,
pub(crate) property_content_max_width: Option<f32>,
}
Expand description
Layout information prepared by list_item_scope
to be used by super::ListItemContent
.
This structure has two purposes:
- Provide read-only layout information to be used when rendering the list item.
- Provide an API to register needs (such as left column width). These needs are then accumulated and used to set up the next frame’s layout information.
super::ListItemContent
implementations have access to this structure via
super::ContentContext
.
Fields§
§left_x: f32
Left-most X coordinate for the scope.
This is the reference point for tracking column width. This is set by list_item_scope
based on ui.max_rect()
.
left_column_width: Option<f32>
Column width to be read this frame.
The column width has left_x
as reference, so it includes:
- All the indentation on the left side of the list item.
- Any extra indentation added by the list item itself.
- The list item’s collapsing triangle, if any.
The effective left column width for a given super::ListItemContent
implementation can be
calculated as left_column_width - (context.rect.left() - left_x)
.
This value is set to None
during the first frame, when list_item_scope
isn’t able to
determine a suitable value. In that case, implementations should devise a suitable default
value.
If true, right-aligned space should be reserved for the action button, even if not used.
scope_id: Id
Scope id, used to retrieve the corresponding LayoutStatistics
.
property_content_max_width: Option<f32>
PropertyContent
only — last frame’s max content width, to be used in desired_width()
This value is measured from left_x
.
Implementations§
source§impl LayoutInfo
impl LayoutInfo
sourcepub fn register_desired_left_column_width(
&self,
ctx: &Context,
desired_width: f32
)
pub fn register_desired_left_column_width( &self, ctx: &Context, desired_width: f32 )
Register the desired width of the left column.
All super::ListItemContent
implementation that attempt to align on the two-column system should
call this function once in their super::ListItemContent::ui
method.
Indicate whether right-aligned space should be reserved for the action button.
sourcepub(crate) fn register_max_item_width(&self, ctx: &Context, width: f32)
pub(crate) fn register_max_item_width(&self, ctx: &Context, width: f32)
Register the maximum width of the item.
Should only be set by super::ListItem
.
sourcepub(super) fn register_property_content_max_width(
&self,
ctx: &Context,
width: f32
)
pub(super) fn register_property_content_max_width( &self, ctx: &Context, width: f32 )
PropertyContent
only — register max content width in the current scope
Trait Implementations§
source§impl Clone for LayoutInfo
impl Clone for LayoutInfo
source§fn clone(&self) -> LayoutInfo
fn clone(&self) -> LayoutInfo
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for LayoutInfo
impl Debug for LayoutInfo
Auto Trait Implementations§
impl Freeze for LayoutInfo
impl RefUnwindSafe for LayoutInfo
impl Send for LayoutInfo
impl Sync for LayoutInfo
impl Unpin for LayoutInfo
impl UnwindSafe for LayoutInfo
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 more