pub enum MessageBoxKind {
Warning,
Error,
Information,
Confirmation,
}Expand description
The dialog title — which kind of alert this is.
Modal alert, confirmation, and input dialogs.
Builders for the standard pop-up dialogs: a body of text with a title
(build_message_box) and a single-field prompt (build_input_box). Each
returns a ready-to-run Dialog; the program runs it modally and returns the
command that closed it.
The option types are typed instead of a packed flag word: MessageBoxKind
picks the title and MessageBoxButtons selects which of [Yes, No, OK, Cancel]
to show, in that fixed order.
§Initial focus
After inserting the buttons, focus goes to the first selectable child (the
first button in [Yes, No, OK, Cancel] order). build_message_box returns that
button’s ViewId, which
Program::message_box_rect passes as
the initial-focus target.
§Button behavior
All message-box buttons are normal (not default). A button fires when focused
(Space / Alt+hotkey) or on a direct mouse click — see Button
(focused-Space and Alt+hotkey arm the animation timer, which fires the command
on expiry).
Pass to Program::message_box or Program::message_box_rect as the
kind argument. Each variant maps to a fixed title string shown in the
dialog frame:
Warning— “Warning”: an unexpected but recoverable condition.Error— “Error”: an operation failed.Information— “Information”: a neutral informational notice.Confirmation— “Confirm”: asking the user to approve an action.
§Turbo Vision heritage
Ports the messageBox / inputBox free functions and their …Rect variants
(msgbox.cpp; titles and button labels from tvtext2.cpp). The original
packed aOptions flag word becomes the typed MessageBoxKind +
MessageBoxButtons (deviation D5); running the dialog modally and destroying
it afterward live in Program, so the builders are pure
(deviation D9).
Replaces the C++ mfWarning/mfError/mfInformation/mfConfirmation
nibble packed into the aOptions Word (msgbox.cpp); the type is now a
closed enum.
Variants§
Warning
“Warning” title — an unexpected but recoverable condition.
Error
“Error” title — an operation failed.
Information
“Information” title — a neutral notice.
Confirmation
“Confirm” title — asking for user approval before proceeding.
Trait Implementations§
Source§impl Clone for MessageBoxKind
impl Clone for MessageBoxKind
Source§fn clone(&self) -> MessageBoxKind
fn clone(&self) -> MessageBoxKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for MessageBoxKind
Source§impl Debug for MessageBoxKind
impl Debug for MessageBoxKind
impl Eq for MessageBoxKind
Source§impl PartialEq for MessageBoxKind
impl PartialEq for MessageBoxKind
impl StructuralPartialEq for MessageBoxKind
Auto Trait Implementations§
impl Freeze for MessageBoxKind
impl RefUnwindSafe for MessageBoxKind
impl Send for MessageBoxKind
impl Sync for MessageBoxKind
impl Unpin for MessageBoxKind
impl UnsafeUnpin for MessageBoxKind
impl UnwindSafe for MessageBoxKind
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.