Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

simple_dialog.h
Go to the documentation of this file.
1 /* simple_dialog.h
2 * Definitions for alert box routines with toolkit-independent APIs but
3 * toolkit-dependent implementations.
4 *
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
8 *
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 */
11
12 #ifndef __SIMPLE_DIALOG_UI_H__
13 #define __SIMPLE_DIALOG_UI_H__
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif /* __cplusplus */
18
26 typedef enum {
27 ESD_TYPE_INFO,
29 ESD_TYPE_WARN,
30 ESD_TYPE_CONFIRMATION,
32 ESD_TYPE_ERROR,
33 ESD_TYPE_STOP
34 } ESD_TYPE_E;
35
37 #define ESD_BTN_NONE 0x00
38
39 #define ESD_BTN_OK 0x01
40
41 #define ESD_BTN_CANCEL 0x02
42
43 #define ESD_BTN_YES 0x04
44
45 #define ESD_BTN_NO 0x08
46
47 #define ESD_BTN_CLEAR 0x10
48
49 #define ESD_BTN_SAVE 0x20
50
51 #define ESD_BTN_DONT_SAVE 0x40
52
53 #define ESD_BTN_QUIT_DONT_SAVE 0x80
54
56 #define ESD_BTNS_OK_CANCEL (ESD_BTN_OK|ESD_BTN_CANCEL)
57
58 #define ESD_BTNS_YES_NO (ESD_BTN_YES|ESD_BTN_NO)
59
60 #define ESD_BTNS_YES_NO_CANCEL (ESD_BTN_YES|ESD_BTN_NO|ESD_BTN_CANCEL)
61
62 #define ESD_BTNS_SAVE_DONTSAVE (ESD_BTN_SAVE|ESD_BTN_DONT_SAVE)
63 #define ESD_BTNS_SAVE_DONTSAVE_CANCEL (ESD_BTN_DONT_SAVE|ESD_BTN_CANCEL|ESD_BTN_SAVE)
64
65 #define ESD_BTNS_SAVE_QUIT_DONTSAVE_CANCEL (ESD_BTN_QUIT_DONT_SAVE|ESD_BTN_CANCEL|ESD_BTN_SAVE)
66
67 #define ESD_BTNS_QUIT_DONTSAVE_CANCEL (ESD_BTN_QUIT_DONT_SAVE|ESD_BTN_CANCEL)
68
77 /*
78 * XXX This is a bit clunky. We typically pass in:
79 * - simple_dialog_primary_start
80 * - The primary message
81 * - simple_dialog_primary_end
82 * - Optionally, the secondary message.
83 *
84 * In the Qt UI we use primary_start and _end to split the primary and
85 * secondary messages. They are then added to a QMessageBox via setText and
86 * setInformativeText respectively. No formatting is applied.
87 *
88 * Callers are responsible for wrapping the primary message and formatting
89 * the message text.
90 *
91 * Explicitly passing in separate primary and secondary messages would let us
92 * get rid of primary_start and primary_end and reduce the amount of
93 * gymnastics we have to to in the Qt UI.
94 */
95 extern gpointer simple_dialog(ESD_TYPE_E type, gint btn_mask,
96 const gchar *msg_format, ...)
97 G_GNUC_PRINTF(3, 4);
98
102 extern const char *simple_dialog_primary_start(void);
106 extern const char *simple_dialog_primary_end(void);
107
114 extern char *simple_dialog_format_message(const char *msg);
115
116 /*
117 * Alert box, with optional "don't show this message again" variable
118 * and checkbox, and optional secondary text.
119 */
120 extern void simple_message_box(ESD_TYPE_E type, gboolean *notagain,
121 const char *secondary_msg,
122 const char *msg_format, ...) G_GNUC_PRINTF(4, 5);
123
124 /*
125 * Error alert box, taking a format and a va_list argument.
126 */
127 extern void vsimple_error_message_box(const char *msg_format, va_list ap);
128
129 /*
130 * Error alert box, taking a format and a list of arguments.
131 */
132 extern void simple_error_message_box(const char *msg_format, ...) G_GNUC_PRINTF(1, 2);
133
134 /*
135 * Warning alert box, taking a format and a va_list argument.
136 */
137 extern void vsimple_warning_message_box(const char *msg_format, va_list ap);
138
139 #ifdef __cplusplus
140 }
141 #endif /* __cplusplus */
142
143 #endif /* __SIMPLE_DIALOG_UI_H__ */
144
145 /*
146 * Editor modelines
147 *
148 * Local Variables:
149 * c-basic-offset: 4
150 * tab-width: 8
151 * indent-tabs-mode: nil
152 * End:
153 *
154 * ex: set shiftwidth=4 tabstop=8 expandtab:
155 * :indentSize=4:tabSize=8:noTabs=true:
156 */
ESD_TYPE_STOP
Definition: simple_dialog.h:33
simple_dialog
gpointer simple_dialog(ESD_TYPE_E type, gint btn_mask, const gchar *msg_format,...) G_GNUC_PRINTF(3
ESD_TYPE_CONFIRMATION
Definition: simple_dialog.h:30
ESD_TYPE_INFO
Definition: simple_dialog.h:27
simple_dialog_primary_start
gpointer const char * simple_dialog_primary_start(void)
Definition: simple_dialog.cpp:48
ESD_TYPE_WARN
Definition: simple_dialog.h:29
simple_dialog_format_message
char * simple_dialog_format_message(const char *msg)
Definition: simple_dialog.cpp:58
ESD_TYPE_E
ESD_TYPE_E
Definition: simple_dialog.h:26
simple_dialog_primary_end
const char * simple_dialog_primary_end(void)
Definition: simple_dialog.cpp:53
ESD_TYPE_ERROR
Definition: simple_dialog.h:32