1/* gtkcelllayout.h
2 * Copyright (C) 2003 Kristian Rietveld <kris@gtk.org>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __GTK_CELL_LAYOUT_H__
19#define __GTK_CELL_LAYOUT_H__
20
21#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
22#error "Only <gtk/gtk.h> can be included directly."
23#endif
24
25#include <gtk/gtkcellrenderer.h>
26#include <gtk/gtkcellarea.h>
27#include <gtk/gtkbuildable.h>
28#include <gtk/gtkbuilder.h>
29
30G_BEGIN_DECLS
31
32#define GTK_TYPE_CELL_LAYOUT (gtk_cell_layout_get_type ())
33#define GTK_CELL_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_LAYOUT, GtkCellLayout))
34#define GTK_IS_CELL_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_LAYOUT))
35#define GTK_CELL_LAYOUT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_CELL_LAYOUT, GtkCellLayoutIface))
36
37typedef struct _GtkCellLayout GtkCellLayout; /* dummy typedef */
38typedef struct _GtkCellLayoutIface GtkCellLayoutIface;
39
40/* keep in sync with GtkTreeCellDataFunc */
41/**
42 * GtkCellLayoutDataFunc:
43 * @cell_layout: a #GtkCellLayout
44 * @cell: the cell renderer whose value is to be set
45 * @tree_model: the model
46 * @iter: a #GtkTreeIter indicating the row to set the value for
47 * @data: (closure): user data passed to gtk_cell_layout_set_cell_data_func()
48 *
49 * A function which should set the value of @cell_layout’s cell renderer(s)
50 * as appropriate.
51 */
52typedef void (* GtkCellLayoutDataFunc) (GtkCellLayout *cell_layout,
53 GtkCellRenderer *cell,
54 GtkTreeModel *tree_model,
55 GtkTreeIter *iter,
56 gpointer data);
57
58/**
59 * GtkCellLayoutIface:
60 * @pack_start: Packs the cell into the beginning of cell_layout.
61 * @pack_end: Adds the cell to the end of cell_layout.
62 * @clear: Unsets all the mappings on all renderers on cell_layout and
63 * removes all renderers from cell_layout.
64 * @add_attribute: Adds an attribute mapping to the list in
65 * cell_layout.
66 * @set_cell_data_func: Sets the #GtkCellLayoutDataFunc to use for
67 * cell_layout.
68 * @clear_attributes: Clears all existing attributes previously set
69 * with gtk_cell_layout_set_attributes().
70 * @reorder: Re-inserts cell at position.
71 * @get_cells: Get the cell renderers which have been added to
72 * cell_layout.
73 * @get_area: Get the underlying #GtkCellArea which might be
74 * cell_layout if called on a #GtkCellArea or might be NULL if no
75 * #GtkCellArea is used by cell_layout.
76 */
77struct _GtkCellLayoutIface
78{
79 /*< private >*/
80 GTypeInterface g_iface;
81
82 /*< public >*/
83
84 /* Virtual Table */
85 void (* pack_start) (GtkCellLayout *cell_layout,
86 GtkCellRenderer *cell,
87 gboolean expand);
88 void (* pack_end) (GtkCellLayout *cell_layout,
89 GtkCellRenderer *cell,
90 gboolean expand);
91 void (* clear) (GtkCellLayout *cell_layout);
92 void (* add_attribute) (GtkCellLayout *cell_layout,
93 GtkCellRenderer *cell,
94 const gchar *attribute,
95 gint column);
96 void (* set_cell_data_func) (GtkCellLayout *cell_layout,
97 GtkCellRenderer *cell,
98 GtkCellLayoutDataFunc func,
99 gpointer func_data,
100 GDestroyNotify destroy);
101 void (* clear_attributes) (GtkCellLayout *cell_layout,
102 GtkCellRenderer *cell);
103 void (* reorder) (GtkCellLayout *cell_layout,
104 GtkCellRenderer *cell,
105 gint position);
106 GList* (* get_cells) (GtkCellLayout *cell_layout);
107
108 GtkCellArea *(* get_area) (GtkCellLayout *cell_layout);
109};
110
111GDK_AVAILABLE_IN_ALL
112GType gtk_cell_layout_get_type (void) G_GNUC_CONST;
113GDK_AVAILABLE_IN_ALL
114void gtk_cell_layout_pack_start (GtkCellLayout *cell_layout,
115 GtkCellRenderer *cell,
116 gboolean expand);
117GDK_AVAILABLE_IN_ALL
118void gtk_cell_layout_pack_end (GtkCellLayout *cell_layout,
119 GtkCellRenderer *cell,
120 gboolean expand);
121GDK_AVAILABLE_IN_ALL
122GList *gtk_cell_layout_get_cells (GtkCellLayout *cell_layout);
123GDK_AVAILABLE_IN_ALL
124void gtk_cell_layout_clear (GtkCellLayout *cell_layout);
125GDK_AVAILABLE_IN_ALL
126void gtk_cell_layout_set_attributes (GtkCellLayout *cell_layout,
127 GtkCellRenderer *cell,
128 ...) G_GNUC_NULL_TERMINATED;
129GDK_AVAILABLE_IN_ALL
130void gtk_cell_layout_add_attribute (GtkCellLayout *cell_layout,
131 GtkCellRenderer *cell,
132 const gchar *attribute,
133 gint column);
134GDK_AVAILABLE_IN_ALL
135void gtk_cell_layout_set_cell_data_func (GtkCellLayout *cell_layout,
136 GtkCellRenderer *cell,
137 GtkCellLayoutDataFunc func,
138 gpointer func_data,
139 GDestroyNotify destroy);
140GDK_AVAILABLE_IN_ALL
141void gtk_cell_layout_clear_attributes (GtkCellLayout *cell_layout,
142 GtkCellRenderer *cell);
143GDK_AVAILABLE_IN_ALL
144void gtk_cell_layout_reorder (GtkCellLayout *cell_layout,
145 GtkCellRenderer *cell,
146 gint position);
147GDK_AVAILABLE_IN_ALL
148GtkCellArea *gtk_cell_layout_get_area (GtkCellLayout *cell_layout);
149
150gboolean _gtk_cell_layout_buildable_custom_tag_start (GtkBuildable *buildable,
151 GtkBuilder *builder,
152 GObject *child,
153 const gchar *tagname,
154 GMarkupParser *parser,
155 gpointer *data);
156gboolean _gtk_cell_layout_buildable_custom_tag_end (GtkBuildable *buildable,
157 GtkBuilder *builder,
158 GObject *child,
159 const gchar *tagname,
160 gpointer *data);
161void _gtk_cell_layout_buildable_add_child (GtkBuildable *buildable,
162 GtkBuilder *builder,
163 GObject *child,
164 const gchar *type);
165
166G_END_DECLS
167
168#endif /* __GTK_CELL_LAYOUT_H__ */
169