pub struct Popup {
pub align: RectAlign,
pub gap: f64,
pub close_behavior: PopupCloseBehavior,
/* private fields */
}Expand description
Controller for a single anchored popup surface.
Fields§
§align: RectAlign§gap: f64§close_behavior: PopupCloseBehaviorImplementations§
Source§impl Popup
impl Popup
pub fn new() -> Self
pub fn is_open(&self) -> bool
pub fn open(&mut self)
pub fn close(&mut self)
pub fn set_open(&mut self, open: bool)
Sourcepub fn set_anchor(&mut self, anchor: Rect)
pub fn set_anchor(&mut self, anchor: Rect)
Record the anchor rect (the opener widget’s bounds, in the coordinate space the popup is placed and hit-tested in).
pub fn anchor(&self) -> Rect
Sourcepub fn effective_align(&self, viewport: Size) -> RectAlign
pub fn effective_align(&self, viewport: Size) -> RectAlign
The placement actually used this frame: the configured align if the
popup fits on-screen with it, otherwise the first of its
RectAlign::symmetries (then RectAlign::MENU_ALIGNS) that does —
egui’s overflow-flip (Popup::get_best_align in
egui/src/containers/popup.rs).
Sourcepub fn rect(&self, viewport: Size) -> Rect
pub fn rect(&self, viewport: Size) -> Rect
The placed popup rect: best-fit alignment first (overflow flip), then clamped to the viewport as the final fallback when even the best candidate overflows.
Sourcepub fn contains(&self, pos: Point, viewport: Size) -> bool
pub fn contains(&self, pos: Point, viewport: Size) -> bool
Whether pos falls inside the placed popup rect.
Sourcepub fn on_escape(&mut self) -> bool
pub fn on_escape(&mut self) -> bool
Close on Escape, regardless of PopupCloseBehavior — egui closes any
popup on Escape (popup.rs should_close), so even an IgnoreClicks
popup stays keyboard-dismissable. Returns true if this call closed
the popup (callers should consume the key event then).
Sourcepub fn on_mouse_down(&mut self, pos: Point, viewport: Size) -> PopupClickOutcome
pub fn on_mouse_down(&mut self, pos: Point, viewport: Size) -> PopupClickOutcome
Apply the close behavior to a left mouse-down at pos.
Returns the PopupClickOutcome so the host knows whether the popup
closed and whether to consume the event. A no-op (returns all-false)
when the popup is already closed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Popup
impl RefUnwindSafe for Popup
impl Send for Popup
impl Sync for Popup
impl Unpin for Popup
impl UnsafeUnpin for Popup
impl UnwindSafe for Popup
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§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>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§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.Source§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.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
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> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().