aboutsummaryrefslogtreecommitdiffstats
path: root/filter/filter-arg.h
blob: 95e7d1caeae964eaa384d6a37f387efce707264d (plain) (blame)
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
/*
 *  Copyright (C) 2000 Helix Code Inc.
 *
 *  Authors: Michael Zucchi <notzed@helixcode.com>
 *
 *  Abstract class to hold filter arguments.
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Library 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 Library General Public License for more details.
 *
 *  You should have received a copy of the GNU Library General Public
 *  License along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef _FILTER_ARG_H
#define _FILTER_ARG_H

#include <gtk/gtk.h>
#include <gtkhtml/gtkhtml.h>
#include <gnome-xml/tree.h>

#define FILTER_ARG(obj)         GTK_CHECK_CAST (obj, filter_arg_get_type (), FilterArg)
#define FILTER_ARG_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_arg_get_type (), FilterArgClass)
#define IS_FILTER_ARG(obj)      GTK_CHECK_TYPE (obj, filter_arg_get_type ())

typedef struct _FilterArg      FilterArg;
typedef struct _FilterArgClass FilterArgClass;

struct _FilterArg {
    GtkObject object;

    char *name;
    GList *values;
};

struct _FilterArgClass {
    GtkObjectClass parent_class;

    /* virtual methods */
    void (*write_html)(FilterArg *arg, GtkHTML *html, GtkHTMLStreamHandle *stream);
    void (*write_text)(FilterArg *arg, GString *string);
    void (*free_value)(FilterArg *arg, void *v);
    void (*edit_values)(FilterArg *arg);

    void (*values_add_xml)(FilterArg *arg, xmlNodePtr node);
    xmlNodePtr (*values_get_xml)(FilterArg *arg);

    char * (*get_value_as_string)(FilterArg *arg, void *data);

    /* signals */
    void (*changed)(FilterArg *arg);
};

guint       filter_arg_get_type (void);
FilterArg      *filter_arg_new  (char *name);
void        filter_arg_value_add(FilterArg *a, void *v);

void        filter_arg_edit_values(FilterArg *arg);

xmlNodePtr  filter_arg_values_get_xml(FilterArg *arg);
void        filter_arg_values_add_xml(FilterArg *arg, xmlNodePtr node);
int     filter_arg_get_count(FilterArg *arg);
void           *filter_arg_get_value(FilterArg *arg, int index);
char           *filter_arg_get_value_as_string(FilterArg *arg, int index);

#endif /* ! _FILTER_ARG_H */