pub trait Dialog {
// Required methods
fn title(&self) -> &str;
fn render(&self, area: Rect, buf: &mut Buffer);
fn handle_key(&mut self, key: KeyEvent) -> DialogOutcome;
// Provided method
fn preferred_size(&self, outer: Rect) -> Rect { ... }
}Expand description
A full-screen or modal dialog rendered over the main TUI chrome.
Implementors typically hold their own local state (cursor, field
values, …), draw themselves inside the provided area, and emit
a DialogOutcome per key event to tell the surrounding
ModalStack how to react.
Required Methods§
Sourcefn handle_key(&mut self, key: KeyEvent) -> DialogOutcome
fn handle_key(&mut self, key: KeyEvent) -> DialogOutcome
Handle a key event and report back how the stack should react.
Provided Methods§
Sourcefn preferred_size(&self, outer: Rect) -> Rect
fn preferred_size(&self, outer: Rect) -> Rect
Preferred size of the dialog when rendered inside outer.
The default implementation returns a 30x12 rectangle centred
inside outer — enough for a typical seven-item menu. Dialogs
with more fields (e.g. the serial-port setup dialog) override
this to return a wider rect. The crate::app::TuiApp render
loop consults this method to position the modal overlay.