Move the declaration of "color_add_filter_cb()" to "color.h", as,
[metze/wireshark/wip.git] / color.h
1 /* color.h
2  * Definitions for "toolkit-independent" colors
3  *
4  * $Id$
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@ethereal.com>
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 __COLOR_H__
26 #define __COLOR_H__
27
28 #include "epan/dfilter/dfilter.h"
29
30 /*
31  * Data structure holding RGB value for a color.
32  *
33  * XXX - yes, I know, there's a "pixel" value in there as well; for
34  * now, it's intended to look just like a GdkColor but not to require
35  * that any GTK+ header files be included in order to use it.
36  * The way we handle colors needs to be cleaned up somewhat, in order
37  * to keep toolkit-specific stuff separate from toolkit-independent stuff.
38  */
39 typedef struct {
40         guint32 pixel;
41         guint16 red;
42         guint16 green;
43         guint16 blue;
44 } color_t;
45
46 /** Create a color from R, G, and B values, and do whatever toolkit-dependent
47  ** work needs to be done.
48  *
49  * @param color the color_t to be filled
50  * @param red the red value for the color
51  * @param green the green value for the color
52  * @param blue the blue value for the color
53  * @param source the GdkColor to be filled
54  * @return TRUE if it succeeds, FALSE if it fails
55  */
56 gboolean create_color(color_t *color, guint16 red, guint16 green, guint16 blue);
57
58 /* Data for a color filter. */
59 typedef struct _color_filter {
60         gchar     *filter_name;   /* name of the filter */
61         gchar     *filter_text;   /* text of the filter expression */
62         color_t    bg_color;      /* background color for packets that match */
63         color_t    fg_color;      /* foreground color for packets that match */
64         dfilter_t *c_colorfilter; /* compiled filter expression */
65         void      *edit_dialog;   /* if filter is being edited, dialog
66                                    * box for it */
67         gboolean    marked;         /* set if the filter is marked in the color dialog box */
68 } color_filter_t;
69
70 /* List of all color filters. */
71 extern GSList *filter_list;
72 extern GSList *removed_filter_list;
73
74 /** Add a color filter.
75  *
76  * @param colorf the new color filter
77  * @param arg the color filter widget
78  */
79 void color_add_filter_cb (color_filter_t *colorf, gpointer arg);
80
81 void
82 filter_list_prime_edt(epan_dissect_t *edt);
83
84 #endif