3 * Definitions for alert box routines with toolkit-independent APIs but
4 * toolkit-dependent implementations.
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
13 #ifndef __SIMPLE_DIALOG_UI_H__
14 #define __SIMPLE_DIALOG_UI_H__
22 #endif /* __cplusplus */
26 * @ingroup dialog_group
32 ESD_TYPE_INFO
, /**< tells the user something they should know, but not requiring
33 any action; the only button should be "OK" */
34 ESD_TYPE_WARN
, /**< tells the user about a problem; the only button should be "OK" */
35 ESD_TYPE_CONFIRMATION
, /**< asks the user for confirmation; there should be more than
37 ESD_TYPE_ERROR
, /**< tells the user about a serious problem; the only button should be "OK" */
38 ESD_TYPE_STOP
/**< tells the user a stop action is in progress, there should be no button */
41 /** display no buttons at all */
42 #define ESD_BTN_NONE 0x00
43 /** display an "Ok" button */
44 #define ESD_BTN_OK 0x01
45 /** display a "Cancel" button */
46 #define ESD_BTN_CANCEL 0x02
47 /** display a "Yes" button */
48 #define ESD_BTN_YES 0x04
49 /** display a "No" button */
50 #define ESD_BTN_NO 0x08
51 /** display a "Clear" button */
52 #define ESD_BTN_CLEAR 0x10
53 /** display a "Save" button */
54 #define ESD_BTN_SAVE 0x20
55 /** display a "Continue without Saving" button */
56 #define ESD_BTN_DONT_SAVE 0x40
57 /** display a "Quit without Saving" button */
58 #define ESD_BTN_QUIT_DONT_SAVE 0x80
60 /** Standard button combination "Ok" + "Cancel". */
61 #define ESD_BTNS_OK_CANCEL (ESD_BTN_OK|ESD_BTN_CANCEL)
62 /** Standard button combination "Yes" + "No". */
63 #define ESD_BTNS_YES_NO (ESD_BTN_YES|ESD_BTN_NO)
64 /** Standard button combination "Yes" + "No" + "Cancel". */
65 #define ESD_BTNS_YES_NO_CANCEL (ESD_BTN_YES|ESD_BTN_NO|ESD_BTN_CANCEL)
66 /** Standard button combination "No" + "Cancel" + "Save". */
67 #define ESD_BTNS_SAVE_DONTSAVE (ESD_BTN_SAVE|ESD_BTN_DONT_SAVE)
68 #define ESD_BTNS_SAVE_DONTSAVE_CANCEL (ESD_BTN_DONT_SAVE|ESD_BTN_CANCEL|ESD_BTN_SAVE)
69 /** Standard button combination "Quit without saving" + "Cancel" + "Save". */
70 #define ESD_BTNS_SAVE_QUIT_DONTSAVE_CANCEL (ESD_BTN_QUIT_DONT_SAVE|ESD_BTN_CANCEL|ESD_BTN_SAVE)
71 /** Standard button combination "Quit without saving" + "Cancel". */
72 #define ESD_BTNS_QUIT_DONTSAVE_CANCEL (ESD_BTN_QUIT_DONT_SAVE|ESD_BTN_CANCEL)
74 /** Create and show a simple dialog.
76 * @param type type of dialog, e.g. ESD_TYPE_WARN
77 * @param btn_mask The buttons to display, e.g. ESD_BTNS_OK_CANCEL
78 * @param msg_format Printf like message format. Text must be plain.
79 * @param ... Printf like parameters
80 * @return The newly created dialog
82 extern void *simple_dialog(ESD_TYPE_E type
, int btn_mask
,
83 const char *msg_format
, ...)
86 extern void *simple_dialog_async(ESD_TYPE_E type
, int btn_mask
,
87 const char *msg_format
, ...)
90 /** Escape the message text, if it probably contains Pango escape sequences.
91 * For example html like tags starting with a <.
93 * @param msg the string to escape
94 * @return the escaped message text, must be freed with g_free() later
96 extern char *simple_dialog_format_message(const char *msg
);
99 * Alert box, with optional "don't show this message again" variable
100 * and checkbox, and optional secondary text.
102 extern void simple_message_box(ESD_TYPE_E type
, bool *notagain
,
103 const char *secondary_msg
,
104 const char *msg_format
, ...) G_GNUC_PRINTF(4, 5);
107 * Error alert box, taking a format and a va_list argument.
109 extern void vsimple_error_message_box(const char *msg_format
, va_list ap
);
112 * Error alert box, taking a format and a list of arguments.
114 extern void simple_error_message_box(const char *msg_format
, ...) G_GNUC_PRINTF(1, 2);
117 * Warning alert box, taking a format and a va_list argument.
119 extern void vsimple_warning_message_box(const char *msg_format
, va_list ap
);
123 #endif /* __cplusplus */
125 #endif /* __SIMPLE_DIALOG_UI_H__ */