pub struct PopupCore {
pub constraint: Cell<PopupConstraint>,
pub offset: (i16, i16),
pub boundary_area: Option<Rect>,
pub non_exhaustive: NonExhaustive,
}Expand description
Provides the core for popup widgets.
This widget can calculate the placement of a popup widget using placement, offset and the outer boundary.
It provides the widget area as area.
After rendering the PopupCore the main widget can render it’s content in the calculated PopupCoreState::area.
§Event handling
Will detect any mouse-clicks outside its area and return PopupOutcome::Hide. Actually showing/hiding the popup is the job of the main widget.
See See the examples some variants.
Fields§
§constraint: Cell<PopupConstraint>Constraints for the popup.
offset: (i16, i16)Extra offset after calculating the position with constraint.
boundary_area: Option<Rect>Outer boundary for the popup-placement. If not set uses the buffer-area.
non_exhaustive: NonExhaustiveImplementations§
Source§impl PopupCore
impl PopupCore
Sourcepub fn ref_constraint(&self, constraint: PopupConstraint) -> &PopupCore
pub fn ref_constraint(&self, constraint: PopupConstraint) -> &PopupCore
Placement constraints for the popup widget.
Sourcepub fn constraint(self, constraint: PopupConstraint) -> PopupCore
pub fn constraint(self, constraint: PopupConstraint) -> PopupCore
Placement constraints for the popup widget.
Sourcepub fn offset(self, offset: (i16, i16)) -> PopupCore
pub fn offset(self, offset: (i16, i16)) -> PopupCore
Adds an extra offset to the widget area.
This can be used to
- place the widget under the mouse cursor.
- align the widget not by the outer bounds but by the text content.
Sourcepub fn boundary(self, boundary: Rect) -> PopupCore
pub fn boundary(self, boundary: Rect) -> PopupCore
Sets outer boundaries for the popup widget.
This will be used to ensure that the popup widget is fully visible. First it tries to move the popup in a way that is fully inside this area. If this is not enought the popup area will be clipped.
If this is not set, Buffer::area will be used instead.
Sourcepub fn styles(self, styles: PopupStyle) -> PopupCore
pub fn styles(self, styles: PopupStyle) -> PopupCore
Set styles
Trait Implementations§
Source§impl StatefulWidget for &PopupCore
impl StatefulWidget for &PopupCore
Source§type State = PopupCoreState
type State = PopupCoreState
Source§impl StatefulWidget for PopupCore
impl StatefulWidget for PopupCore
Source§type State = PopupCoreState
type State = PopupCoreState
Auto Trait Implementations§
impl !Freeze for PopupCore
impl !RefUnwindSafe for PopupCore
impl Send for PopupCore
impl !Sync for PopupCore
impl Unpin for PopupCore
impl UnwindSafe for PopupCore
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more