Move the common parts of iface_lists.[ch] from ui/gtk/ to ui/. Leave the
[metze/wireshark/wip.git] / ui / gtk / prefs_dlg.h
1 /* prefs_dlg.h
2  * Definitions for preference handling routines
3  *
4  * $Id$
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  */
24
25 #ifndef __PREFS_DLG_H__
26 #define __PREFS_DLG_H__
27
28 /** @defgroup prefs_group Preferences
29  * 
30  *  All GUI related preferences things. Please note, that some GUI related things 
31  *  are saved in the recent file, which is processed in recent.h.
32  *
33  *  The Preference dialog has the following page submodules:
34    @dot
35   digraph prefs_pages {
36       node [shape=record, fontname=Helvetica, fontsize=10];
37       dialog [ label="Preferences dialog" URL="\ref prefs_dlg.h"];
38       ui [ label="User Interface" URL="\ref prefs_gui.h"];
39       layout [ label="UI: Layout" URL="\ref prefs_layout.h"];
40       columns [ label="UI: Columns" URL="\ref prefs_column.h"];
41       font [ label="UI: Font" URL="\ref prefs_gui.h"];
42       colors [ label="UI: Colors" URL="\ref prefs_stream.h"];
43       capture [ label="Capture" URL="\ref prefs_capture.h"];
44       print [ label="Printing" URL="\ref prefs_print.h"];
45       nameres [ label="Name resolution" URL="\ref prefs_nameres.h"];
46       protocols [ label="Protocols" URL="\ref prefs_dlg.h"];
47       dialog -> ui [ arrowhead="open", style="solid" ];
48       dialog -> layout [ arrowhead="open", style="solid" ];
49       dialog -> columns [ arrowhead="open", style="solid" ];
50       dialog -> font [ arrowhead="open", style="solid" ];
51       dialog -> colors [ arrowhead="open", style="solid" ];
52       dialog -> capture [ arrowhead="open", style="solid" ];
53       dialog -> print [ arrowhead="open", style="solid" ];
54       dialog -> nameres [ arrowhead="open", style="solid" ];
55       dialog -> protocols [ arrowhead="open", style="solid" ];
56   }
57   @enddot
58  */
59
60 /** @file
61  * "Preferences" and "Protocol properties" dialog boxes.
62  *  @ingroup dialog_group
63  *  @ingroup prefs_group
64  */
65
66 typedef enum {
67   PREFS_PAGE_USER_INTERFACE,
68   PREFS_PAGE_LAYOUT,
69   PREFS_PAGE_COLUMNS
70 } PREFS_PAGE_E;
71
72 /** Show the preferences dialog.
73  * 
74  * @param widget parent widget (unused)
75  * @param data unused
76  */
77 extern void prefs_cb(GtkWidget *widget, gpointer data);
78
79 /** Show the preferences dialog in given page.
80  * 
81  * @param widget parent widget (unused)
82  * @param data unused
83  * @param prefs_page page to show
84  */
85 extern void prefs_page_cb(GtkWidget *widget, gpointer data, PREFS_PAGE_E prefs_page);
86
87 /** Show the protocol properties dialog.
88  * 
89  * @param widget parent widget (unused)
90  * @param data unused
91  */
92 extern void properties_cb(GtkWidget *widget, gpointer data);
93
94 /** Create a check button for a preferences page.
95  *
96  * @param main_tb the table to put this button into
97  * @param table_row row in the table
98  * @param label_text the label text for the left side
99  * @param tooltip_text the tooltip for this check button
100  * @param active the check button is initially active
101  * @return the new check button
102  */
103 extern GtkWidget *create_preference_check_button(GtkWidget *main_tb, int table_row,
104     const gchar *label_text, const gchar *tooltip_text, gboolean active);
105
106 /** Create a radio button for a preferences page.
107  *
108  * @param main_tb the table to put this button into
109  * @param table_row row in the table
110  * @param label_text the label text for the left side
111  * @param tooltip_text the tooltip for this radio button
112  * @param enumvals the values
113  * @param current_val the initially selected value
114  * @return the new radio button
115  */
116 extern GtkWidget *create_preference_radio_buttons(GtkWidget *main_tb, int table_row,
117     const gchar *label_text, const gchar *tooltip_text,
118     const enum_val_t *enumvals, gint current_val);
119
120 /** Get the currently selected value from a radio button.
121  * 
122  * @param button the button from create_preference_radio_buttons()
123  * @param enumvals the same enum vals as in create_preference_radio_buttons()
124  * @return the index of the currently selected item
125  */
126 extern gint fetch_preference_radio_buttons_val(GtkWidget *button, const enum_val_t *enumvals);
127
128 /** Create an option menu for a preferences page.
129  *
130  * @param main_tb the table to put this menu into
131  * @param table_row row in the table
132  * @param label_text the label text for the left side
133  * @param tooltip_text the tooltip for this option menu
134  * @param enumvals the values
135  * @param current_val the initially selected value
136  * @return the new option menu
137  */
138 extern GtkWidget *create_preference_option_menu(GtkWidget *main_tb, int table_row,
139     const gchar *label_text, const gchar *tooltip_text,
140     const enum_val_t *enumvals, gint current_val);
141
142 /** Get the currently selected value from an option menu.
143  * 
144  * @param optmenu the option menu from create_preference_option_menu()
145  * @param enumvals the same enum vals as in create_preference_option_menu()
146  * @return the index of the currently selected item
147  */
148 extern gint fetch_preference_option_menu_val(GtkWidget *optmenu, const enum_val_t *enumvals);
149
150 /** Create a text entry for a preferences page.
151  *
152  * @param main_tb the table to put this entry into
153  * @param table_row row in the table
154  * @param label_text the label text for the left side
155  * @param tooltip_text the tooltip for this text entry
156  * @param value the initially value
157  * @return the new text entry
158  */
159 extern GtkWidget *create_preference_entry(GtkWidget *main_tb, int table_row,
160     const gchar *label_text, const gchar *tooltip_text, char *value);
161
162 /** Create a static text for a preferences page.
163  *
164  * @param main_tb the table to put this entry into
165  * @param table_position row in the table
166  * @param label_text the label text
167  * @param tooltip_text the tooltip for this text (not needed at all...)
168  * @return the new static text label
169  */
170 GtkWidget *
171 create_preference_static_text(GtkWidget *main_tb, int table_position,
172     const gchar *label_text, const gchar *tooltip_text);
173
174 /** Create a UAT button for a preferences page.
175  *
176  * @param main_tb the table to put this entry into
177  * @param table_position row in the table
178  * @param label_text the label text
179  * @param tooltip_text the tooltip for this text
180  * @param uat pointer to the UAT
181  * @return the new UAT button
182  */
183 GtkWidget *
184 create_preference_uat(GtkWidget *main_tb, int table_position,
185     const gchar *label_text, const gchar *tooltip_text, void *uat);
186
187 /** Save all preferences */
188 void
189 prefs_main_write(void);
190
191 #endif