2007-10-14 Johannes Schmid <jhs@gnome.org>
[anjuta-git-plugin.git] / plugins / class-gen / element-editor.h
blob683930406801b89bc0025963eefa79e886eab307
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 /* element-editor.h
3 * Copyright (C) 2006 Armin Burgmeier
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef __CLASSGEN_ELEMENT_EDITOR_H__
21 #define __CLASSGEN_ELEMENT_EDITOR_H__
23 #include <plugins/project-wizard/values.h>
25 #include <gtk/gtktreeview.h>
26 #include <gtk/gtkbutton.h>
28 #include <glib-object.h>
30 G_BEGIN_DECLS
32 #define CG_TYPE_ELEMENT_EDITOR (cg_element_editor_get_type ())
33 #define CG_ELEMENT_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CG_TYPE_ELEMENT_EDITOR, CgElementEditor))
34 #define CG_ELEMENT_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CG_TYPE_ELEMENT_EDITOR, CgElementEditorClass))
35 #define CG_IS_ELEMENT_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CG_TYPE_ELEMENT_EDITOR))
36 #define CG_IS_ELEMENT_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CG_TYPE_ELEMENT_EDITOR))
37 #define CG_ELEMENT_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CG_TYPE_ELEMENT_EDITOR, CgElementEditorClass))
39 typedef struct _CgElementEditorClass CgElementEditorClass;
40 typedef struct _CgElementEditor CgElementEditor;
42 typedef enum
44 CG_ELEMENT_EDITOR_COLUMN_LIST,
45 CG_ELEMENT_EDITOR_COLUMN_FLAGS,
46 CG_ELEMENT_EDITOR_COLUMN_STRING,
47 CG_ELEMENT_EDITOR_COLUMN_ARGUMENTS
48 } CgElementEditorColumnType;
50 typedef struct CgElementEditorFlags_
52 const gchar *name;
53 const gchar *abbrevation;
54 } CgElementEditorFlags;
56 struct _CgElementEditorClass
58 GObjectClass parent_class;
61 struct _CgElementEditor
63 GObject parent_instance;
66 GType cg_element_editor_get_type (void) G_GNUC_CONST;
68 CgElementEditor *cg_element_editor_new (GtkTreeView *view,
69 GtkButton *add_button,
70 GtkButton *remove_button,
71 guint n_columns,
72 ...);
74 typedef void(*CgElementEditorTransformFunc) (GHashTable *, gpointer);
76 /* The CgElementEditorTransformFunc may be used to modify the values
77 * before they are stored in the value heap. It is also possible to
78 * remove some or to create new ones. You should keep the key string
79 * static because it is not freed when the hash table is destroyed, but
80 * the data string may be dynamically allocated, it will be freed
81 * eventually. */
82 void cg_element_editor_set_values (CgElementEditor *editor,
83 const gchar *name,
84 NPWValueHeap *values,
85 CgElementEditorTransformFunc func,
86 gpointer user_data,
87 ...);
89 typedef gboolean(*CgElementEditorConditionFunc) (const gchar **, gpointer);
91 void cg_element_editor_set_value_count (CgElementEditor *editor,
92 const gchar *name,
93 NPWValueHeap *values,
94 CgElementEditorConditionFunc func,
95 gpointer user_data);
97 G_END_DECLS
99 #endif /* __CLASSGEN_ELEMENT_EDITOR_H__ */