Provide for per-protocol-tree data in the proto_tree code.
[obnox/wireshark/wip.git] / gtk / colors.h
1 /* colors.h
2  * Definitions for color structures and routines
3  *
4  * $Id: colors.h,v 1.5 2001/12/18 19:09:07 gram Exp $
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@zing.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * 
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  * 
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  * 
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25 #ifndef  __COLORS_H__
26 #define  __COLORS_H__
27
28 #include  "proto.h"
29 #include  "dfilter/dfilter.h"
30 #include <gtk/gtk.h>
31 #include  "epan.h"
32
33 #define MAXCOLORS       255
34 #define MAX_COLOR_FILTER_NAME_LEN 33
35 #define MAX_COLOR_FILTER_STRING_LEN 256
36
37 #define CFILTERS_CONTAINS_FILTER(filter) \
38         ((filter)->num_of_filters != 0)
39
40 extern GdkColor WHITE;
41 extern GdkColor BLACK;
42
43 /* Data for a color filter. */
44 typedef struct _color_filter {
45         gchar *filter_name;     /* name of the filter */
46         gchar *filter_text;     /* text of the filter expression */
47         GdkColor bg_color;      /* background color for packets that match */
48         GdkColor fg_color;      /* foreground color for packets that match */
49         dfilter_t *c_colorfilter;       /* compiled filter expression */
50         GtkWidget *edit_dialog; /* if filter is being edited, dialog box for it */
51 } color_filter_t;
52
53 /* List of all color filters. */
54 extern GSList *filter_list;
55
56 typedef struct _colfilter  {
57         gint      num_of_filters;  /* first num_of_filters rows filled */
58         gint      row_selected;    /* row in color_filters that is selected */
59 } colfilter;
60
61 colfilter *colfilter_new(void);
62
63 gboolean write_filters(colfilter *filter);
64
65 color_filter_t *new_color_filter(colfilter *filters, gchar *name,
66                                  gchar *filter_string);
67 void delete_color_filter(color_filter_t *colorf);
68
69 gboolean get_color (GdkColor *new_color);
70
71 void
72 filter_list_prime_edt(epan_dissect_t *edt);
73
74 #endif