dca73eb296f32b20f1ae0083e914e24cea1a85ab
[obnox/wireshark/wip.git] / 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 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 #define E_TOOLTIPS_KEY "tooltips"
95
96 /** Create a check button for a preferences page.
97  *
98  * @param main_tb the table to put this button into
99  * @param table_row row in the table
100  * @param label_text the label text for the left side
101  * @param tooltip_text the tooltip for this check button
102  * @param active the check button is initially active
103  * @return the new check button
104  */
105 extern GtkWidget *create_preference_check_button(GtkWidget *main_tb, int table_row,
106     const gchar *label_text, const gchar *tooltip_text, gboolean active);
107
108 /** Create a radio button for a preferences page.
109  *
110  * @param main_tb the table to put this button into
111  * @param table_row row in the table
112  * @param label_text the label text for the left side
113  * @param tooltip_text the tooltip for this radio button
114  * @param enumvals the values
115  * @param current_val the initially selected value
116  * @return the new radio button
117  */
118 extern GtkWidget *create_preference_radio_buttons(GtkWidget *main_tb, int table_row,
119     const gchar *label_text, const gchar *tooltip_text,
120     const enum_val_t *enumvals, gint current_val);
121
122 /** Get the currently selected value from a radio button.
123  * 
124  * @param button the button from create_preference_radio_buttons()
125  * @param enumvals the same enum vals as in create_preference_radio_buttons()
126  * @return the index of the currently selected item
127  */
128 extern gint fetch_preference_radio_buttons_val(GtkWidget *button, const enum_val_t *enumvals);
129
130 /** Create an option menu for a preferences page.
131  *
132  * @param main_tb the table to put this menu into
133  * @param table_row row in the table
134  * @param label_text the label text for the left side
135  * @param tooltip_text the tooltip for this option menu
136  * @param enumvals the values
137  * @param current_val the initially selected value
138  * @return the new option menu
139  */
140 extern GtkWidget *create_preference_option_menu(GtkWidget *main_tb, int table_row,
141     const gchar *label_text, const gchar *tooltip_text,
142     const enum_val_t *enumvals, gint current_val);
143
144 /** Get the currently selected value from an option menu.
145  * 
146  * @param optmenu the option menu from create_preference_option_menu()
147  * @param enumvals the same enum vals as in create_preference_option_menu()
148  * @return the index of the currently selected item
149  */
150 extern gint fetch_preference_option_menu_val(GtkWidget *optmenu, const enum_val_t *enumvals);
151
152 /** Create a text entry for a preferences page.
153  *
154  * @param main_tb the table to put this entry into
155  * @param table_row row in the table
156  * @param label_text the label text for the left side
157  * @param tooltip_text the tooltip for this text entry
158  * @param value the initially value
159  * @return the new text entry
160  */
161 extern GtkWidget *create_preference_entry(GtkWidget *main_tb, int table_row,
162     const gchar *label_text, const gchar *tooltip_text, char *value);
163
164 /** Create a static text for a preferences page.
165  *
166  * @param main_tb the table to put this entry into
167  * @param table_position row in the table
168  * @param label_text the label text
169  * @param tooltip_text the tooltip for this text (not needed at all...)
170  * @return the new static text label
171  */
172 GtkWidget *
173 create_preference_static_text(GtkWidget *main_tb, int table_position,
174     const gchar *label_text, const gchar *tooltip_text);
175
176 /** Create a UAT button for a preferences page.
177  *
178  * @param main_tb the table to put this entry into
179  * @param table_position row in the table
180  * @param label_text the label text
181  * @param tooltip_text the tooltip for this text
182  * @param uat pointer to the UAT
183  * @return the new UAT button
184  */
185 GtkWidget *
186 create_preference_uat(GtkWidget *main_tb, int table_position,
187     const gchar *label_text, const gchar *tooltip_text, void *uat);
188
189 /** Save all preferences */
190 void
191 prefs_main_write(void);
192
193 #endif