aboutsummaryrefslogtreecommitdiffstats
path: root/ui/gtk/extcap_gtk.h
blob: cdc26167ab1e5b8894c3db4d376ff6d5b60fc65f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/* extcap_gtk.c
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifndef __EXTCAP_GTK_H__
#define __EXTCAP_GTK_H__

#include <stdio.h>
#include <string.h>

#include <glib.h>
#include <gtk/gtk.h>

#include <extcap_parser.h>

/*
 * GObject data keys for linking argument records to the gtk
 * UI
 */
#define EXTCAP_GTK_DATA_KEY_ARGPTR      "EXTCAP_ARGPTR"
#define EXTCAP_GTK_DATA_KEY_VALPTR      "EXTCAP_VALPTR"
#define EXTCAP_GTK_DATA_KEY_FIRSTRADIO  "EXTCAP_FIRSTRADIO"
#define EXTCAP_GTK_DATA_KEY_WIDGETLIST  "EXTCAP_WIDGETLIST"
#define EXTCAP_GTK_DATA_KEY_TREEVIEW    "EXTCAP_TREEVIEW"
#define EXTCAP_GTK_DATA_KEY_FILENAME    "EXTCAP_FILENAME"
#define EXTCAP_GTK_DATA_KEY_TIMESTAMP   "EXTCAP_TIMESTAMP"
#define EXTCAP_GTK_DATA_KEY_ARGUMENT    "EXTCAP_ARGUMENT"

/*
 * GTK UI / EXTCAP Linkage:
 *
 * Packed vbox of widgets
 *      Contains EXTCAP_WIDGETLIST pointing to enclosed widget list
 *
 * GSList gtk_ui_widgets
 *      Linked list of drawable widgets in the UI
 *
 * GtkWidget contained in GSList
 *      Drawn GTK UI element.  If UI element is directly linked
 *      to argument, will contain EXTCAP_ARGPTR.
 *
 *      Top-level GTK widgets will include text boxes, sliders
 *      (if supported), and checkboxes.
 *
 *      If the top level widget contains radio buttons, it will
 *      contain an EXTCAP_ARGPTR *and* an EXTCAP_FIRSTRADIO
 *
 * Radio buttons
 *      Each radio button will contain an EXTCAP_VALPTR reference
 *      to the extcap_value * value being used.
 *
 * Selectors
 *      Each selector row contains a pointer to the value, in the
 *      column COL_VALUE
 *
 */

enum extcap_gtk_col_types {
    EXTCAP_GTK_COL_DISPLAY = 0, EXTCAP_GTK_COL_VALUE = 1, EXTCAP_GTK_NUM_COLS
};

enum extcap_gtk_multi_col_types {
    EXTCAP_GTK_MULTI_COL_CHECK = 0,
    EXTCAP_GTK_MULTI_COL_DISPLAY = 1,
    EXTCAP_GTK_MULTI_COL_VALUE = 2,
    EXTCAP_GTK_MULTI_COL_ACTIVATABLE = 3,
    EXTCAP_GTK_MULTI_NUM_COLS
};

/* Get a hash map of calls and values from the top widget */
GHashTable *extcap_gtk_get_state(GtkWidget *widget);

GtkWidget *extcap_create_gtk_rangewidget(extcap_arg *argument,
        GHashTable *prev_map);
GtkWidget *extcap_create_gtk_listwidget(extcap_arg *argument,
        GHashTable *prev_map);
GtkWidget *extcap_create_gtk_radiowidget(extcap_arg *argument,
        GHashTable *prev_map);
GtkWidget *extcap_create_gtk_multicheckwidget(extcap_arg *argument,
        GHashTable *prev_map);

/*
 * Populate a (pre-created) container widget based on an arguments record.
 * For secondary repopulations, a saved state can be passed to populate
 * with known values.  This should occur when setting interface options
 * repeatedly, for example
 */
GSList *extcap_populate_gtk_vbox(GList *arguments, GtkWidget *vbox,
        GHashTable *prev_map);

/* Free args associated with a GTK item */
void extcap_gtk_free_args(GtkWidget *vbox);

#endif

/*
 * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
 *
 * Local variables:
 * c-basic-offset: 4
 * tab-width: 8
 * indent-tabs-mode: nil
 * End:
 *
 * vi: set shiftwidth=4 tabstop=8 expandtab:
 * :indentSize=4:tabSize=8:noTabs=true:
 */