pub struct MessageBox {
pub style: Style,
pub text_color: Color,
pub button_text_color: Color,
/* private fields */
}Expand description
LVGL-parity message-box dialog (LPAR-14 §5.H).
Combines a title header, a wrapped body message, and a button row into a
single widget. The button row is implemented as an internal
ButtonMatrix.
§Button IDs
Buttons are assigned sequential ButtonId values in the order supplied
to new. Use those IDs with active_button and
[activate_button].
Fields§
§style: StyleStyle for the outer container.
text_color: ColorText colour for the title and body.
Text colour for the button labels (forwarded to the inner matrix).
Implementations§
Source§impl MessageBox
impl MessageBox
Sourcepub fn new(
bounds: Rect,
title: &str,
text: &str,
buttons: &[&str],
) -> MessageBox
pub fn new( bounds: Rect, title: &str, text: &str, buttons: &[&str], ) -> MessageBox
Create a MessageBox with the given bounds, title, body text,
and button labels.
buttons is a slice of label strings. An empty slice creates a
message-box with no footer buttons.
Sourcepub fn set_font(&mut self, font: &'static dyn FontMetrics)
pub fn set_font(&mut self, font: &'static dyn FontMetrics)
Assign the font used to render this widget (FONT-00 §5); resolves to
FONT_6X10 when unset.
Return the most-recently activated button, or BUTTON_NONE if no
button has been activated yet.
Programmatically activate button id, recording it as the active
button. Equivalent to the user pressing a button.
Return the label of button id, or None if id is out of range.
Return the total number of buttons in the footer row.
Sourcepub fn close(&mut self) -> ButtonId
pub fn close(&mut self) -> ButtonId
Signal that the dialog should be dismissed.
Records closed = true and returns the currently
active_button. The caller must detach or hide
the widget; no z-order or tree manipulation is performed.