Loading...
Searching...
No Matches
Dialogs.h
Go to the documentation of this file.
1/**************************************************************************************************
2 * This file is a part of Ultralight. *
3 * *
4 * See <https://ultralig.ht> for licensing and more. *
5 * *
6 * (C) 2024 Ultralight, Inc. *
7 **************************************************************************************************/
8
9#pragma once
10
11#include "Defines.h"
12#include <Ultralight/String.h>
13
14namespace ultralight {
15
16///
17/// Enum representing the icon to be displayed in a dialog.
18///
19enum class DialogIcon {
20 Info, ///< Information icon
21 Warning, ///< Warning icon
22 Error, ///< Error icon
23 Question ///< Question icon
24};
25
26///
27/// Enum representing the button types in a dialog.
28///
29enum class ButtonType {
30 OK, ///< Single "OK" button
31 OKCancel, ///< "OK" and "Cancel" buttons
32 YesNo ///< "Yes" and "No" buttons
33};
34
35///
36/// Enum representing the result of a dialog button press.
37///
38enum class ButtonResult {
39 OK, ///< "OK" button was pressed
40 Cancel, ///< "Cancel" button was pressed
41 Yes, ///< "Yes" button was pressed
42 No ///< "No" button was pressed
43};
44
45///
46/// Shows a modal message box with the specified title, message, icon, and buttons.
47///
48/// @param title The title of the message box.
49/// @param message The message to display in the message box.
50/// @param icon The icon to display in the message box (default: DialogIcon::Info).
51/// @param buttons The button type to display in the message box (default: ButtonType::OK).
52///
53/// @return The result of the button press.
54///
55AExport ButtonResult ShowMessageBox(const String& title, const String& message,
57 ButtonType buttons = ButtonType::OK);
58
59} // namespace ultralight
#define AExport
Definition Defines.h:42
Unicode string container with conversions for UTF-8, UTF-16, and UTF-32.
Definition String.h:34
Definition App.h:14
DialogIcon
Enum representing the icon to be displayed in a dialog.
Definition Dialogs.h:19
@ Warning
Warning icon.
@ Info
Information icon.
@ Question
Question icon.
ButtonResult
Enum representing the result of a dialog button press.
Definition Dialogs.h:38
@ Yes
"Yes" button was pressed
@ No
"No" button was pressed
@ Cancel
"Cancel" button was pressed
ButtonResult ShowMessageBox(const String &title, const String &message, DialogIcon icon=DialogIcon::Info, ButtonType buttons=ButtonType::OK)
Shows a modal message box with the specified title, message, icon, and buttons.
ButtonType
Enum representing the button types in a dialog.
Definition Dialogs.h:29
@ OKCancel
"OK" and "Cancel" buttons
@ YesNo
"Yes" and "No" buttons
@ OK
Single "OK" button.