pub struct PopupBuilder<State = Unbound> { /* private fields */ }Expand description
Builder for configuring popups
The builder uses phantom types to ensure compile-time safety:
PopupBuilder<Unbound>- Configuration only, cannot show popupsPopupBuilder<Bound>- Has shell reference, can show popups
§Example
ⓘ
shell.on("Main", "open_menu", |control| {
let popup_handle = control.popups().builder("MenuPopup")
.at_cursor()
.grab(true)
.close_on("menu_closed")
.show()?;
});Implementations§
Source§impl PopupBuilder<Unbound>
impl PopupBuilder<Unbound>
Sourcepub fn new(component: impl Into<String>) -> Self
pub fn new(component: impl Into<String>) -> Self
Creates a new popup builder for the specified component
This builder is unbound and cannot show popups directly.
Use PopupShell::builder to create a bound builder that can call .show().
Source§impl<State> PopupBuilder<State>
impl<State> PopupBuilder<State>
pub fn position(self, position: PopupPosition) -> Self
pub fn at_cursor(self) -> Self
pub fn at_position(self, x: f32, y: f32) -> Self
pub fn centered(self) -> Self
pub fn relative_to_rect( self, rect: LogicalRect, anchor: AnchorPoint, alignment: Alignment, ) -> Self
pub fn offset(self, x: f32, y: f32) -> Self
pub fn size(self, size: PopupSize) -> Self
pub fn fixed_size(self, width: f32, height: f32) -> Self
pub fn min_size(self, width: f32, height: f32) -> Self
pub fn max_size(self, width: f32, height: f32) -> Self
pub fn content_sized(self) -> Self
pub fn grab(self, enable: bool) -> Self
pub fn modal(self, enable: bool) -> Self
pub fn close_on_click_outside(self) -> Self
pub fn close_on_escape(self) -> Self
pub fn constraint_adjustment(self, adjustment: ConstraintAdjustment) -> Self
pub fn on_output(self, target: OutputTarget) -> Self
pub fn on_primary(self) -> Self
pub fn on_active(self) -> Self
pub fn parent(self, parent: PopupHandle) -> Self
pub const fn z_index(self, index: i32) -> Self
pub fn close_on(self, callback_name: impl Into<String>) -> Self
pub fn resize_on(self, callback_name: impl Into<String>) -> Self
Sourcepub fn build(self) -> PopupConfig
pub fn build(self) -> PopupConfig
Builds the configuration without showing the popup
Returns a PopupConfig that can be shown later using PopupShell::show.
Source§impl PopupBuilder<Bound>
impl PopupBuilder<Bound>
Sourcepub fn show(self) -> Result<PopupHandle>
pub fn show(self) -> Result<PopupHandle>
Shows the popup with the configured settings
This method is only available on builders created via PopupShell::builder,
ensuring at compile time that the builder has access to a shell.
Auto Trait Implementations§
impl<State> Freeze for PopupBuilder<State>where
State: Freeze,
impl<State> RefUnwindSafe for PopupBuilder<State>where
State: RefUnwindSafe,
impl<State> Send for PopupBuilder<State>where
State: Send,
impl<State> Sync for PopupBuilder<State>where
State: Sync,
impl<State> Unpin for PopupBuilder<State>where
State: Unpin,
impl<State> UnwindSafe for PopupBuilder<State>where
State: UnwindSafe,
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
Mutably borrows from an owned value. Read more
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>
Convert
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> 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)
Convert
&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)
Convert
&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> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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