2 * Declarations of utilities to use when constructing dialogs
4 * $Id: dlg_utils.h,v 1.20 2004/06/04 17:16:57 ulfl Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@ethereal.com>
8 * Copyright 1998 Gerald Combs
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.
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.
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.
25 /** @defgroup dialog_group Dialogs
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.
30 * @section normal_dialogs Normal dialogs
32 * Normal dialogs are created using dlg_window_new().
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 ..." gtk_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()
64 * @section file_sel_dialogs File selection dialogs
66 * File selection dialogs are created using file_selection_new().
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()
82 * Utilities for dialog boxes. Depending on the window functions in
83 * ui_util.h, see: @ref howto_window_page for details.
84 * @ingroup dialog_group
87 #ifndef __DLG_UTILS_H__
88 #define __DLG_UTILS_H__
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.
95 * @param title the title for the new dialog
96 * @return the newly created dialog
98 extern GtkWidget *dlg_window_new(const gchar *title);
100 /** the action a file selection is designed for */
102 FILE_SELECTION_OPEN, /**< open a file */
103 FILE_SELECTION_SAVE /**< save/export a file */
104 } file_selection_action_t;
106 /** Create a file selection dialog box window that belongs to Ethereal's
107 * main window. See window_new() for usage.
109 * @param title the title for the new file selection dialog
110 * @param action the desired action
111 * @return the newly created file selection dialog
113 extern GtkWidget *file_selection_new(const gchar *title, file_selection_action_t action);
115 /** Set the current folder for a file selection dialog.
117 * @param fs the file selection dialog from file_selection_new()
118 * @param filename the folder to set
120 * @todo what's the return value?
122 extern gboolean file_selection_set_current_folder(GtkWidget *fs, const gchar *filename);
124 /** Set the "extra" widget for a file selection dialog. This is needed to support
125 * user-supplied options.
127 * @param fs the file selection dialog from file_selection_new()
128 * @param extra the widget to set
130 extern void file_selection_set_extra_widget(GtkWidget *fs, GtkWidget *extra);
133 #define E_FILE_SEL_DIALOG_PTR_KEY "file_sel_dialog_ptr"
135 /** Browse the files and fill in the associated text entry.
137 * @param file_bt the button that called us (to get the toplevel widget)
138 * @param file_te the GtkEntry the dialog will have to fill in the filename
139 * @param title the title for the file selection dialog
140 * @param action the desired action
141 * @todo use the parent widget as the first parameter, not the button
144 file_selection_browse(GtkWidget *file_bt, GtkWidget *file_te, const char *title, file_selection_action_t action);
146 /** Get the latest opened directory.
148 * @return the dirname
150 extern char *get_last_open_dir(void);
152 /** Set the latest opened directory.
153 * Will already be done when using file_selection_new().
155 * @param dirname the dirname
157 extern void set_last_open_dir(char *dirname);
160 /** Create a button row (with variable number of buttons) for a dialog.
161 * The button widgets will be available by OBJECT_GET_DATA(dlg, stock_id) later.
163 * @param stock_id_first the first button (e.g. GTK_STOCK_OK)
164 * @param ... the next buttons, just like stock_id_first
165 * @return the new button row
166 * @todo move this to ui_util.h
168 extern GtkWidget *dlg_button_row_new(gchar *stock_id_first, ...);
170 /** Set the "activate" signal for a widget to call a routine to
171 * activate the "OK" button for a dialog box.
173 * @param widget a widget which should be connected (usually a GtkEntry)
174 * @param ok_button the button to be activated
175 * @todo move this to ui_util.h
177 extern void dlg_set_activate(GtkWidget *widget, GtkWidget *ok_button);
180 /** used by compat_macros.h only, don't use directly */
181 extern GtkWidget *dlg_radio_button_new_with_label_with_mnemonic(GSList *group,
182 const gchar *label, GtkAccelGroup *accel_group);
183 /** used by compat_macros.h only, don't use directly */
184 extern GtkWidget *dlg_check_button_new_with_label_with_mnemonic(const gchar *label,
185 GtkAccelGroup *accel_group);
186 /** used by compat_macros.h only, don't use directly */
187 extern GtkWidget *dlg_toggle_button_new_with_label_with_mnemonic(const gchar *label,
188 GtkAccelGroup *accel_group);