Save the current_proto value before calling subdissectors, and restore
[obnox/wireshark/wip.git] / simple_dialog.h
1 /* simple_dialog.h
2  * Definitions for alert box routines with toolkit-independent APIs but
3  * toolkit-dependent implementations.
4  *
5  * $Id: simple_dialog.h,v 1.11 2004/02/12 22:24:27 guy Exp $
6  *
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@ethereal.com>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25
26 #ifndef __DIALOG_H__
27 #define __DIALOG_H__
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif /* __cplusplus */
32
33 /* Dialog type.
34
35    INFO: tells the user something they should know, but not requiring
36    any action; the only button should be "OK".
37
38    WARN: tells the user about a problem; the only button should be "OK"
39
40    CONFIRMATION: asks the user for confirmation; there should be more than
41    one button
42    
43    ERROR: tells the user about a serious problem; the only button should be
44    "OK". */
45 #define ESD_TYPE_INFO         0x00
46 #define ESD_TYPE_WARN         0x01
47 #define ESD_TYPE_CONFIRMATION 0x02
48 #define ESD_TYPE_ERROR        0x03
49
50 /* Which buttons to display. */
51 #define ESD_BTN_OK     0x01
52 #define ESD_BTN_CANCEL 0x02
53 #define ESD_BTN_YES    0x04
54 #define ESD_BTN_NO     0x08
55 #define ESD_BTN_CLEAR  0x10
56
57 #define ESD_BTNS_OK_CANCEL      (ESD_BTN_OK|ESD_BTN_CANCEL)
58 #define ESD_BTNS_YES_NO         (ESD_BTN_YES|ESD_BTN_NO)
59 #define ESD_BTNS_YES_NO_CANCEL  (ESD_BTN_YES|ESD_BTN_NO|ESD_BTN_CANCEL)
60
61 /* show a simple dialog */
62 #if __GNUC__ >= 2
63 extern gpointer simple_dialog(gint type, gint btn_mask, gchar *msg_format, ...)
64     __attribute__((format (printf, 3, 4)));
65 #else
66 extern gpointer simple_dialog(gint type, gint btn_mask, gchar *msg_format, ...);
67 #endif
68
69 /* callback function type */
70 typedef void (* simple_dialog_cb_t) (gpointer dialog, gint btn, gpointer data);
71
72 /* set the callback function, which has to be called when a button was pressed */
73 extern void simple_dialog_set_cb(gpointer dialog, simple_dialog_cb_t callback_fct, gpointer data);
74
75 extern char *simple_dialog_primary_start(void);
76 extern char *simple_dialog_primary_end(void);
77
78 #ifdef __cplusplus
79 }
80 #endif /* __cplusplus */
81
82 #endif /* __DIALOG_H__ */