Skip to main content

Popup

Struct Popup 

Source
pub struct Popup;
Expand description

With the latest enhancement of Focus this is obsolete.

Focus collects all the areas of widgets and containers and can set a z-index for each area. With this information it runs a hit-test for each mouse event and sets and sets the mouse-focus flag for each widget and container. This works well with popups and overlapping widgets. This makes the differentiation between regular widgets and widgets that might show a popup that overlaps other widgets obsolete.

If you don’t use Focus you will still have to consider the information below.

Obsoleted

Popup/Overlays are a bit difficult to handle, as there is no z-order/area tree, which would direct mouse interactions. We can simulate a z-order in the event-handler by trying the things with a higher z-order first.

If a widget might show a popup, you have to call its event-handling before any other widgets that might be (partially) hidden behind the widget. This applies for e.g. Menubar, Choice and ComboBox. To make this difference visible in the application code, these widgets use Popup as marker for their event-handling instead of Regular.

If you implement a widget with a popup, you must make sure to consume all mouse-events within the widget area to prevent any interaction with a hidden widget.

Trait Implementations§

Source§

impl Clone for Popup

Source§

fn clone(&self) -> Popup

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Popup

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Popup

Source§

fn default() -> Popup

Returns the “default value” for a type. Read more
Source§

impl<T: PartialEq + Clone + Default> HandleEvent<Event, Popup, ChoiceOutcome> for ChoiceState<T>

Source§

fn handle(&mut self, event: &Event, _qualifier: Popup) -> ChoiceOutcome

Handle an event. Read more
Source§

impl HandleEvent<Event, Popup, ComboboxOutcome> for ComboboxState

Source§

fn handle(&mut self, event: &Event, _qualifier: Popup) -> ComboboxOutcome

Handle an event. Read more
Source§

impl HandleEvent<Event, Popup, MenuOutcome> for MenubarState

Source§

fn handle(&mut self, event: &Event, _qualifier: Popup) -> MenuOutcome

Handle an event. Read more
Source§

impl HandleEvent<Event, Popup, MenuOutcome> for PopupMenuState

Source§

fn handle(&mut self, event: &Event, _qualifier: Popup) -> MenuOutcome

Handle all events.

Key-events are only handled when the popup menu is_active. You need to set this state according to your logic.

The popup menu will return MenuOutcome::Hide if it thinks it should be hidden.

Source§

impl HandleEvent<Event, Popup, PopupOutcome> for PopupCoreState

Source§

fn handle(&mut self, event: &Event, _qualifier: Popup) -> PopupOutcome

Handle an event. Read more
Source§

impl Copy for Popup

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.