pub struct PopupCore<'a> { /* private fields */ }Expand description
Provides the core for popup widgets.
This does widget can calculate the placement of a popup widget using the placement, offset and the outer boundary.
It provides the widget area as widget_area. It’s up to the user to render the actual content for the popup.
§Event handling
The widget will detect any suspicious mouse activity outside its bounds and returns PopupOutcome::Hide if it finds such.
The widget doesn’t change its active/visible state by itself, it’s up to the caller to do this.
See See the examples some variants.
Implementations§
source§impl<'a> PopupCore<'a>
impl<'a> PopupCore<'a>
sourcepub fn placement(self, placement: Placement) -> PopupCore<'a>
pub fn placement(self, placement: Placement) -> PopupCore<'a>
Placement of the popup widget. See placement for the options.
sourcepub fn offset(self, offset: (i16, i16)) -> PopupCore<'a>
pub fn offset(self, offset: (i16, i16)) -> PopupCore<'a>
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<'a>
pub fn boundary(self, boundary: Rect) -> PopupCore<'a>
Sets outer boundaries for the resulting widget.
This will be used to ensure that the widget is fully visible, after calculation its position using the other parameters.
If not set it will use Buffer::area for this.
sourcepub fn get_block_size(&self) -> Size
pub fn get_block_size(&self) -> Size
Return the size required for the block.
Trait Implementations§
source§impl<'a> StatefulWidget for PopupCore<'a>
impl<'a> StatefulWidget for PopupCore<'a>
source§type State = PopupCoreState
type State = PopupCoreState
Auto Trait Implementations§
impl<'a> Freeze for PopupCore<'a>
impl<'a> RefUnwindSafe for PopupCore<'a>
impl<'a> Send for PopupCore<'a>
impl<'a> Sync for PopupCore<'a>
impl<'a> Unpin for PopupCore<'a>
impl<'a> UnwindSafe for PopupCore<'a>
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)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