egui/atomics/sized_atom.rs
1use crate::SizedAtomKind;
2use emath::Vec2;
3
4/// A [`crate::Atom`] which has been sized.
5#[derive(Clone, Debug)]
6pub struct SizedAtom<'a> {
7 pub id: Option<crate::Id>,
8
9 pub(crate) grow: bool,
10
11 /// The size of the atom.
12 ///
13 /// Used for placing this atom in [`crate::AtomLayout`], the cursor will advance by
14 /// size.x + gap.
15 pub size: Vec2,
16
17 /// Intrinsic size of the atom. This is used to calculate `Response::intrinsic_size`.
18 pub intrinsic_size: Vec2,
19
20 /// How will the atom be aligned in its available space?
21 pub align: emath::Align2,
22
23 pub kind: SizedAtomKind<'a>,
24}
25
26impl SizedAtom<'_> {
27 /// Was this [`crate::Atom`] marked as `grow`?
28 pub fn is_grow(&self) -> bool {
29 self.grow
30 }
31}