Wireshark  4.3.0
The Wireshark network protocol analyzer
simple_dialog.h
Go to the documentation of this file.
1 
13 #ifndef __SIMPLE_DIALOG_UI_H__
14 #define __SIMPLE_DIALOG_UI_H__
15 
16 #include <glib.h>
17 
18 #include <stdbool.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif /* __cplusplus */
23 
31 typedef enum {
40 
42 #define ESD_BTN_NONE 0x00
44 #define ESD_BTN_OK 0x01
46 #define ESD_BTN_CANCEL 0x02
48 #define ESD_BTN_YES 0x04
50 #define ESD_BTN_NO 0x08
52 #define ESD_BTN_CLEAR 0x10
54 #define ESD_BTN_SAVE 0x20
56 #define ESD_BTN_DONT_SAVE 0x40
58 #define ESD_BTN_QUIT_DONT_SAVE 0x80
59 
61 #define ESD_BTNS_OK_CANCEL (ESD_BTN_OK|ESD_BTN_CANCEL)
63 #define ESD_BTNS_YES_NO (ESD_BTN_YES|ESD_BTN_NO)
65 #define ESD_BTNS_YES_NO_CANCEL (ESD_BTN_YES|ESD_BTN_NO|ESD_BTN_CANCEL)
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)
70 #define ESD_BTNS_SAVE_QUIT_DONTSAVE_CANCEL (ESD_BTN_QUIT_DONT_SAVE|ESD_BTN_CANCEL|ESD_BTN_SAVE)
72 #define ESD_BTNS_QUIT_DONTSAVE_CANCEL (ESD_BTN_QUIT_DONT_SAVE|ESD_BTN_CANCEL)
73 
82 /*
83  * XXX This is a bit clunky. We typically pass in:
84  * - simple_dialog_primary_start
85  * - The primary message
86  * - simple_dialog_primary_end
87  * - Optionally, the secondary message.
88  *
89  * In the Qt UI we use primary_start and _end to split the primary and
90  * secondary messages. They are then added to a QMessageBox via setText and
91  * setInformativeText respectively. No formatting is applied.
92  *
93  * Callers are responsible for wrapping the primary message and formatting
94  * the message text.
95  *
96  * Explicitly passing in separate primary and secondary messages would let us
97  * get rid of primary_start and primary_end and reduce the amount of
98  * gymnastics we have to do in the Qt UI.
99  */
100 extern void *simple_dialog(ESD_TYPE_E type, int btn_mask,
101  const char *msg_format, ...)
102  G_GNUC_PRINTF(3, 4);
103 
104 extern void *simple_dialog_async(ESD_TYPE_E type, int btn_mask,
105  const char *msg_format, ...)
106  G_GNUC_PRINTF(3, 4);
107 
111 extern const char *simple_dialog_primary_start(void);
115 extern const char *simple_dialog_primary_end(void);
116 
123 extern char *simple_dialog_format_message(const char *msg);
124 
125 /*
126  * Alert box, with optional "don't show this message again" variable
127  * and checkbox, and optional secondary text.
128  */
129 extern void simple_message_box(ESD_TYPE_E type, bool *notagain,
130  const char *secondary_msg,
131  const char *msg_format, ...) G_GNUC_PRINTF(4, 5);
132 
133 /*
134  * Error alert box, taking a format and a va_list argument.
135  */
136 extern void vsimple_error_message_box(const char *msg_format, va_list ap);
137 
138 /*
139  * Error alert box, taking a format and a list of arguments.
140  */
141 extern void simple_error_message_box(const char *msg_format, ...) G_GNUC_PRINTF(1, 2);
142 
143 /*
144  * Warning alert box, taking a format and a va_list argument.
145  */
146 extern void vsimple_warning_message_box(const char *msg_format, va_list ap);
147 
148 #ifdef __cplusplus
149 }
150 #endif /* __cplusplus */
151 
152 #endif /* __SIMPLE_DIALOG_UI_H__ */
ESD_TYPE_E
Definition: simple_dialog.h:31
@ ESD_TYPE_CONFIRMATION
Definition: simple_dialog.h:35
@ ESD_TYPE_STOP
Definition: simple_dialog.h:38
@ ESD_TYPE_WARN
Definition: simple_dialog.h:34
@ ESD_TYPE_INFO
Definition: simple_dialog.h:32
@ ESD_TYPE_ERROR
Definition: simple_dialog.h:37
const char * simple_dialog_primary_end(void)
Definition: simple_dialog.cpp:83
char * simple_dialog_format_message(const char *msg)
Definition: simple_dialog.cpp:88
void void const char * simple_dialog_primary_start(void)
Definition: simple_dialog.cpp:78
void * simple_dialog(ESD_TYPE_E type, int btn_mask, const char *msg_format,...) G_GNUC_PRINTF(3