"gtk_tap_dfilter_dlg_cb()" is no longer used outside
[metze/wireshark/wip.git] / gtk / dlg_utils.h
1 /* dlg_utils.h
2  * Declarations of utilities to use when constructing dialogs
3  *
4  * $Id$
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@ethereal.com>
8  * Copyright 1998 Gerald Combs
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  */
24
25 /** @defgroup dialog_group Dialogs
26  *
27  * Dialogs are specially created windows and are related to their parent windows (usually the main window). 
28  * See: @ref howto_window_page for details.
29  *
30  * @section normal_dialogs Normal dialogs 
31  *
32  * Normal dialogs are created using dlg_window_new().
33  *
34  * - "About" about_ethereal_cb()
35  * - "Capture Options" capture_prep()
36  * - "Capture" capture_info_create()
37  * - "Interface Options" ifopts_edit_cb()
38  * - "Coloring Rules" colorize_dialog_new()
39  * - "Edit Color Filter" edit_color_filter_dialog_new()
40  * - "Compute DCE-RPC SRT statistics" gtk_dcerpcstat_cb()
41  * - "Decode As: Show" decode_show_cb()
42  * - "Decode As" decode_as_cb()
43  * - "Filter Expression" dfilter_expr_dlg_new()
44  * - "Compute Fibre Channel Service Response Time statistics" gtk_fcstat_cb()
45  * - "Filter" (display and capture) filter_dialog_new()
46  * - "Find Packet" find_frame_cb()
47  * - "Follow TCP stream" follow_stream_cb()
48  * - "Go To Packet" goto_frame_cb()
49  * - "Compute LDAP Service Response Time statistics" gtk_ldapstat_cb()
50  * - "Preferences" tools_plugins_cmd_cb()
51  * - "Print" / "Export" open_print_dialog()
52  * - "Progress" create_progress_dlg()
53  * - "Enabled Protocols" proto_cb()
54  * - "Compute ONC-RPC SRT statistics" gtk_rpcstat_cb()
55  * - "RTP Streams" rtpstream_dlg_create()
56  * - "Simple Dialog" display_simple_dialog()
57  * - "Compute SMB SRT statistics" gtk_smbstat_cb()
58  * - "Compute ..." tap_dfilter_dlg_cb()
59  * - "Tcp Graph" create_drawing_area()
60  * - "Tcp Graph Control" control_panel_create()
61  * - "Help for TCP graphing" callback_create_help()
62  * - "Tcp Graph Magnify" magnify_create()
63  *
64  * @section file_sel_dialogs File selection dialogs 
65  *
66  * File selection dialogs are created using file_selection_new().
67  *
68  * - "Browse" file_selection_browse()
69  * - "Open Capture File" file_open_cmd()
70  * - "Save Capture File As" file_save_as_cmd()
71  * - "Import Color Filters" file_color_import_cmd_cb()
72  * - "Export Color Filters" file_color_export_cmd_cb()
73  * - "Save TCP Follow Stream As" follow_save_as_cmd_cb()
74  * - "Export Selected Packet Bytes" savehex_cb()
75  * - "Save Data As CSV" save_csv_as_cb()
76  * - "Save Payload As ..." on_save_bt_clicked()
77  * - "Save selected stream in rtpdump" rtpstream_on_save()
78  * 
79  */
80
81 /** @file
82  * Utilities for dialog boxes. Depending on the window functions in 
83  * gui_utils.h, see: @ref howto_window_page for details.
84  * @ingroup dialog_group
85  */
86
87 #ifndef __DLG_UTILS_H__
88 #define __DLG_UTILS_H__
89
90
91 /** Create a dialog box window that belongs to Ethereal's main window.
92  * If you want to create a window, use window_new() instead. 
93  * See window_new() for general window usage.
94  *
95  * @param title the title for the new dialog
96  * @return the newly created dialog
97  */
98 extern GtkWidget *dlg_window_new(const gchar *title);
99
100 /** the action a file selection is designed for */
101 typedef enum {
102         FILE_SELECTION_OPEN,            /**< open a file */
103         FILE_SELECTION_READ_BROWSE,     /**< browse for a file to read */
104         FILE_SELECTION_SAVE,            /**< save/export a file */
105         FILE_SELECTION_WRITE_BROWSE     /**< browse for a file to write to */
106 } file_selection_action_t;
107
108 /** Create a file selection dialog box window that belongs to Ethereal's
109  *  main window. See window_new() for usage.
110  *
111  * @param title the title for the new file selection dialog
112  * @param action the desired action
113  * @return the newly created file selection dialog
114  */
115 extern GtkWidget *file_selection_new(const gchar *title, file_selection_action_t action);
116
117 /** Set the current folder for a file selection dialog.
118  *
119  * @param fs the file selection dialog from file_selection_new()
120  * @param filename the folder to set
121  * @return TRUE if the folder could be changed successfully
122  */
123 extern gboolean file_selection_set_current_folder(GtkWidget *fs, const gchar *filename);
124
125 /** Set the "extra" widget for a file selection dialog. This is needed to support 
126  *  user-supplied options.
127  *
128  * @param fs the file selection dialog from file_selection_new()
129  * @param extra the widget to set
130  */
131 extern void file_selection_set_extra_widget(GtkWidget *fs, GtkWidget *extra);
132
133 /** The function file_selection_browse() will OBJECT_SET_DATA() itself on it's parent window.
134  *  When destroying the parent window, it can close the corresponding file selection. */
135 #define E_FILE_SEL_DIALOG_PTR_KEY "file_sel_dialog_ptr"
136
137 /** Browse the files and fill in the associated text entry.
138  *
139  * @param file_bt the button that called us (to get the toplevel widget)
140  * @param file_te the GtkEntry the dialog will have to fill in the filename
141  * @param title the title for the file selection dialog
142  * @param action the desired action
143  */
144 extern void
145 file_selection_browse(GtkWidget *file_bt, GtkWidget *file_te, const char *title, file_selection_action_t action);
146
147 /** Get the latest opened directory.
148  *
149  * @return the dirname
150  */
151 extern char *get_last_open_dir(void);
152
153 /** Set the latest opened directory.
154  *  Will already be done when using file_selection_new().
155  *
156  * @param dirname the dirname
157  */
158 extern void set_last_open_dir(char *dirname);
159
160
161 /** Create a button row (with variable number of buttons) for a dialog.
162  *  The button widgets will be available by OBJECT_GET_DATA(dlg, stock_id) later.
163  *
164  * @param stock_id_first the first button (e.g. GTK_STOCK_OK)
165  * @param ... the next buttons, just like stock_id_first
166  * @return the new button row
167  * @todo move this to gui_utils.h
168  */
169 extern GtkWidget *dlg_button_row_new(const gchar *stock_id_first, ...);
170
171 /** Set the "activate" signal for a widget to call a routine to
172  *  activate the "OK" button for a dialog box.
173  *
174  * @param widget a widget which should be connected (usually a GtkEntry)
175  * @param ok_button the button to be activated
176  * @todo move this to gui_utils.h
177  */
178 extern void dlg_set_activate(GtkWidget *widget, GtkWidget *ok_button);
179
180
181 /** used by compat_macros.h only, don't use directly */
182 extern GtkWidget *dlg_radio_button_new_with_label_with_mnemonic(GSList *group,
183     const gchar *label, GtkAccelGroup *accel_group);
184 /** used by compat_macros.h only, don't use directly */
185 extern GtkWidget *dlg_check_button_new_with_label_with_mnemonic(const gchar *label,
186     GtkAccelGroup *accel_group);
187 /** used by compat_macros.h only, don't use directly */
188 extern GtkWidget *dlg_toggle_button_new_with_label_with_mnemonic(const gchar *label,
189                         GtkAccelGroup *accel_group);
190
191 #endif