Skip to main content

PopupDialog

Struct PopupDialog 

Source
pub struct PopupDialog<'a, T, F>
where F: FnMut(&mut Frame<'_>, Rect, &mut T),
{ /* private fields */ }
Expand description

Generic popup dialog container.

Manages rendering, focus, and event handling for a popup dialog.

Implementations§

Source§

impl<'a, T, F> PopupDialog<'a, T, F>
where F: FnMut(&mut Frame<'_>, Rect, &mut T),

Source

pub fn new( config: &'a DialogConfig, state: &'a mut DialogState<T>, content_renderer: F, ) -> Self

Create a new popup dialog.

§Arguments
  • config - Dialog configuration
  • state - Dialog state
  • content_renderer - Closure to render dialog content
Source

pub fn calculate_area(&self, screen: Rect) -> Rect

Calculate dialog area centered on screen.

Source

pub fn render(&mut self, frame: &mut Frame<'_>)

Render the popup.

Source

pub fn handle_key(&mut self, key: KeyEvent) -> EventResult

Handle keyboard event.

Source

pub fn handle_mouse(&mut self, mouse: MouseEvent) -> EventResult

Handle mouse event.

Source

pub fn handle_mouse_with_screen( &mut self, mouse: MouseEvent, screen: Rect, ) -> EventResult

Handle mouse event with screen dimensions.

Auto Trait Implementations§

§

impl<'a, T, F> Freeze for PopupDialog<'a, T, F>
where F: Freeze,

§

impl<'a, T, F> RefUnwindSafe for PopupDialog<'a, T, F>

§

impl<'a, T, F> Send for PopupDialog<'a, T, F>
where F: Send, T: Send,

§

impl<'a, T, F> Sync for PopupDialog<'a, T, F>
where F: Sync, T: Sync,

§

impl<'a, T, F> Unpin for PopupDialog<'a, T, F>
where F: Unpin,

§

impl<'a, T, F> !UnwindSafe for PopupDialog<'a, T, F>

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> 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, 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.