pub(crate) struct ExpandedRows<'a> {
row_height: f32,
cache: &'a mut ExpandedRowsCache,
egui_ctx: Context,
id: Id,
}
Expand description
Helper to keep track of row expansion.
This is a short-lived struct to be created every frame. The persistent state is stored in
ExpandedRowsCache
.
Uses egui’s animation support to animate the row expansion/contraction. For this to work:
- When collapsed, the row entry must be set to 0 instead of being removed. Otherwise, it will no longer be “seen” by the animation code. Technically, it could be removed after the animation completes, but it’s not worth the complexity.
- When the row is first expanded, for the animation to work, it must be immediately seeded to 0 for the animation to have a starting point.
Fields§
§row_height: f32
Base row height.
cache: &'a mut ExpandedRowsCache
Cache containing the row expanded-ness.
egui_ctx: Context
[egui::Context
] used to animate the row expansion.
id: Id
[egui::Id
] used to store the animation state.
Implementations§
source§impl<'a> ExpandedRows<'a>
impl<'a> ExpandedRows<'a>
sourcepub(crate) fn new(
egui_ctx: Context,
id: Id,
cache: &'a mut ExpandedRowsCache,
row_height: f32
) -> Self
pub(crate) fn new( egui_ctx: Context, id: Id, cache: &'a mut ExpandedRowsCache, row_height: f32 ) -> Self
Create a new ExpandedRows
instance.
egui_ctx
is used to animate the row expansion
id
is used to store the animation state and invalidate the cache, make it persistent and
unique
sourcepub(crate) fn row_top_offset(&self, row_nr: u64) -> f32
pub(crate) fn row_top_offset(&self, row_nr: u64) -> f32
Implementation for [egui_table::TableDelegate::row_top_offset
].
sourcepub(crate) fn is_row_odd(&self, row_nr: u64) -> bool
pub(crate) fn is_row_odd(&self, row_nr: u64) -> bool
Returns whether the first line of the specified row is odd.
This depends on how many additional lines the rows before have.
sourcepub(crate) fn additional_lines_for_row(&self, row_nr: u64) -> u64
pub(crate) fn additional_lines_for_row(&self, row_nr: u64) -> u64
Return by how many additional lines this row is expended.
sourcepub(crate) fn set_additional_lines_for_row(
&mut self,
row_nr: u64,
additional_lines: u64
)
pub(crate) fn set_additional_lines_for_row( &mut self, row_nr: u64, additional_lines: u64 )
Set the expansion of a row.
Units are in extra row heights.
sourcepub(crate) fn remove_additional_lines_for_row(&mut self, row_nr: u64)
pub(crate) fn remove_additional_lines_for_row(&mut self, row_nr: u64)
Collapse a row.
fn row_id(&self, row_nr: u64) -> Id
Auto Trait Implementations§
impl<'a> Freeze for ExpandedRows<'a>
impl<'a> !RefUnwindSafe for ExpandedRows<'a>
impl<'a> Send for ExpandedRows<'a>
impl<'a> Sync for ExpandedRows<'a>
impl<'a> Unpin for ExpandedRows<'a>
impl<'a> !UnwindSafe for ExpandedRows<'a>
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