pub struct Atom<'a> {
pub size: Option<Vec2>,
pub max_size: Vec2,
pub grow: bool,
pub shrink: bool,
pub kind: AtomKind<'a>,
}
Expand description
A low-level ui building block.
Implements From
for String
, str
, crate::Image
and much more for convenience.
You can directly call the atom_*
methods on anything that implements Into<Atom>
.
use egui::AtomExt as _;
let string_atom = "Hello".atom_grow(true);
let image_atom = Image::new("some_image_url").atom_size(Vec2::splat(20.0));
Fields§
§size: Option<Vec2>
§max_size: Vec2
§grow: bool
§shrink: bool
§kind: AtomKind<'a>
The atom type
Implementations§
Source§impl<'a> Atom<'a>
impl<'a> Atom<'a>
Sourcepub fn grow() -> Self
pub fn grow() -> Self
Create an empty Atom
marked as grow
.
This will expand in size, allowing all preceding atoms to be left-aligned, and all following atoms to be right-aligned
Sourcepub fn custom(id: Id, size: impl Into<Vec2>) -> Self
pub fn custom(id: Id, size: impl Into<Vec2>) -> Self
Create a AtomKind::Custom
with a specific size.
Sourcepub fn into_sized(
self,
ui: &Ui,
available_size: Vec2,
wrap_mode: Option<TextWrapMode>,
) -> SizedAtom<'a>
pub fn into_sized( self, ui: &Ui, available_size: Vec2, wrap_mode: Option<TextWrapMode>, ) -> SizedAtom<'a>
Turn this into a SizedAtom
.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Atom<'a>
impl<'a> RefUnwindSafe for Atom<'a>
impl<'a> Send for Atom<'a>
impl<'a> Sync for Atom<'a>
impl<'a> Unpin for Atom<'a>
impl<'a> UnwindSafe for Atom<'a>
Blanket Implementations§
Source§impl<'a, T> AtomExt<'a> for T
impl<'a, T> AtomExt<'a> for T
Source§fn atom_shrink(self, shrink: bool) -> Atom<'a>
fn atom_shrink(self, shrink: bool) -> Atom<'a>
Shrink this atom if there isn’t enough space. Read more
Source§fn atom_max_size(self, max_size: Vec2) -> Atom<'a>
fn atom_max_size(self, max_size: Vec2) -> Atom<'a>
Set the maximum size of this atom. Read more
Source§fn atom_max_width(self, max_width: f32) -> Atom<'a>
fn atom_max_width(self, max_width: f32) -> Atom<'a>
Set the maximum width of this atom. Read more
Source§fn atom_max_height(self, max_height: f32) -> Atom<'a>
fn atom_max_height(self, max_height: f32) -> Atom<'a>
Set the maximum height of this atom.
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
Mutably borrows from an owned value. Read more