muteki
Loading...
Searching...
No Matches
messagebox.h File Reference

Functions related to the message box view. More...

#include <muteki/common.h>

Go to the source code of this file.

Enumerations

enum  message_box_type_e {
  MB_DEFAULT = 0 , MB_ICON_ERROR , MB_ICON_INFO , MB_ICON_WARNING ,
  MB_ICON_QUESTION , MB_BUTTON_YES = 1 << 8 , MB_BUTTON_NO = 2 << 8 , MB_BUTTON_OK = 4 << 8 ,
  MB_BUTTON_CANCEL = 8 << 8 , MB_BUTTON_NONE = 16 << 8
}
 Message box types. More...
 
enum  message_box_result_e { MB_RESULT_OK = 3 , MB_RESULT_CANCEL = 4 , MB_RESULT_YES = 5 , MB_RESULT_NO = 6 }
 Results returned by the MessageBox() function after the user dismisses the message box. More...
 

Functions

int MessageBox (const UTF16 *text, unsigned short type)
 High level message box function.
 

Detailed Description

Functions related to the message box view.

Enumeration Type Documentation

◆ message_box_result_e

Results returned by the MessageBox() function after the user dismisses the message box.

Enumerator
MB_RESULT_OK 

The OK button was pressed by the user.

Pressing Y key on the keyboard could also trigger this (specifically when OK button is enabled via MB_BUTTON_OK).

MB_RESULT_CANCEL 

The Cancel button was pressed by the user.

Pressing C key or ESC key on the keyboard could also trigger this.

MB_RESULT_YES 

The Yes button was pressed by the user.

Pressing Y key on the keyboard could also trigger this (specifically when Yes button is enabled via MB_BUTTON_YES).

MB_RESULT_NO 

The No button was pressed by the user.

Pressing N key or ESC key on the keyboard could also trigger this.

◆ message_box_type_e

Message box types.

A valid message box type is either MB_DEFAULT or a MB_ICON_ enum joined by one or more MB_BUTTON_ enums with the bitwise-or operator (|). For example,

#define _BUL(x)
Besta UTF-16 string literal.
Definition common.h:61
@ MB_BUTTON_YES
Provide Yes button on the message box.
Definition messagebox.h:56
@ MB_BUTTON_NO
Provide No button on the message box.
Definition messagebox.h:60
@ MB_ICON_WARNING
Display a warning (exclamation-point) icon on the message box.
Definition messagebox.h:48
int MessageBox(const UTF16 *text, unsigned short type)
High level message box function.

will cause a message box with the message "hello world", the exclamation-point icon, and both the Yes and No buttons to be shown.

Enumerator
MB_DEFAULT 

The default type.

This is usually equivalent to (MB_ICON_WARNING | MB_BUTTON_OK).

MB_ICON_ERROR 

Display an error (stop-sign) icon on the message box.

MB_ICON_INFO 

Display an info icon (lower case i) on the message box.

MB_ICON_WARNING 

Display a warning (exclamation-point) icon on the message box.

MB_ICON_QUESTION 

Display a question-mark icon on the message box.

MB_BUTTON_YES 

Provide Yes button on the message box.

MB_BUTTON_NO 

Provide No button on the message box.

MB_BUTTON_OK 

Provide OK button on the message box.

MB_BUTTON_CANCEL 

Provide Cancel button on the message box.

MB_BUTTON_NONE 

Do not show any button.

This will hide all buttons on the message box. Any key press will dismiss the message box and the return value will always be set to message_box_result_t::MB_RESULT_OK.

Function Documentation

◆ MessageBox()

int MessageBox ( const UTF16 text,
unsigned short  type 
)
extern

High level message box function.

Create and show a message box view with the specified text, an icon and one or more buttons, and return which button on the message box is pressed when the user dismisses it. The type argument controls the icon and buttons shown on the message box view.

Message boxes can be dismissed by 3 ways: Pressing the button on the message box (including selecting them and pressing Enter), using the key bind (Y for OK/Yes, N for No and C for cancel) or pressing the ESC key when Cancel-like operations are defined (i.e. Cancel or No, with Cancel taking precedence when both are shown).

When OK and Yes are both available, what the user has selected takes precedence. That is, if the user selects Yes button instead of the OK button with TAB or arrow keys, pressing the Y key on the keyboard will make the function return MB_RESULT_YES instead of MB_RESULT_OK.

Syscall Number
0x1013d
Parameters
textUTF-16 encoded text to be displayed on the message box.
typeThe message box type.
Returns
Which button is pressed to dismiss the message box.
See also
message_box_type_e Valid message box types.
message_box_result_e Valid return values of this function.