]> Pileus Git - ~andy/gtk/blob - gtk/gtkcellarea.h
Implemented "cell properties" on the GtkCellArea
[~andy/gtk] / gtk / gtkcellarea.h
1 /* gtkcellarea.h
2  *
3  * Copyright (C) 2010 Openismus GmbH
4  *
5  * Authors:
6  *      Tristan Van Berkom <tristanvb@openismus.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23
24 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
25 #error "Only <gtk/gtk.h> can be included directly."
26 #endif
27
28 #ifndef __GTK_CELL_AREA_H__
29 #define __GTK_CELL_AREA_H__
30
31 #include <gtk/gtkcellrenderer.h>
32 #include <gtk/gtkwidget.h>
33 #include <gtk/gtktreemodel.h>
34
35 G_BEGIN_DECLS
36
37 #define GTK_TYPE_CELL_AREA                (gtk_cell_area_get_type ())
38 #define GTK_CELL_AREA(obj)                (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_AREA, GtkCellArea))
39 #define GTK_CELL_AREA_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_AREA, GtkCellAreaClass))
40 #define GTK_IS_CELL_AREA(obj)     (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_AREA))
41 #define GTK_IS_CELL_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_AREA))
42 #define GTK_CELL_AREA_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_AREA, GtkCellAreaClass))
43
44 typedef struct _GtkCellArea              GtkCellArea;
45 typedef struct _GtkCellAreaClass         GtkCellAreaClass;
46 typedef struct _GtkCellAreaPrivate       GtkCellAreaPrivate;
47 typedef struct _GtkCellAreaIter          GtkCellAreaIter;
48
49 /**
50  * GtkCellCallback:
51  * @renderer: the cell renderer to operate on
52  * @data: user-supplied data
53  *
54  * The type of the callback functions used for iterating over
55  * the cell renderers of a #GtkCellArea, see gtk_cell_area_forall().
56  */
57 typedef void    (*GtkCellCallback)     (GtkCellRenderer  *renderer,
58                                         gpointer          data);
59
60
61 struct _GtkCellArea
62 {
63   GInitiallyUnowned parent_instance;
64
65   GtkCellAreaPrivate *priv;
66 };
67
68 struct _GtkCellAreaClass
69 {
70   GInitiallyUnownedClass parent_class;
71
72   /* vtable - not signals */
73
74   /* Basic methods */
75   void               (* add)                             (GtkCellArea             *area,
76                                                           GtkCellRenderer         *renderer);
77   void               (* remove)                          (GtkCellArea             *area,
78                                                           GtkCellRenderer         *renderer);
79   void               (* forall)                          (GtkCellArea             *area,
80                                                           GtkCellCallback          callback,
81                                                           gpointer                 callback_data);
82   gint               (* event)                           (GtkCellArea             *area,
83                                                           GtkCellAreaIter         *iter,
84                                                           GtkWidget               *widget,
85                                                           GdkEvent                *event,
86                                                           const GdkRectangle      *cell_area);
87   void               (* render)                          (GtkCellArea             *area,
88                                                           GtkCellAreaIter         *iter,
89                                                           GtkWidget               *widget,
90                                                           cairo_t                 *cr,
91                                                           const GdkRectangle      *cell_area);
92
93   /* Geometry */
94   GtkCellAreaIter   *(* create_iter)                     (GtkCellArea             *area);
95   GtkSizeRequestMode (* get_request_mode)                (GtkCellArea             *area);
96   void               (* get_preferred_width)             (GtkCellArea             *area,
97                                                           GtkCellAreaIter         *iter,
98                                                           GtkWidget               *widget,
99                                                           gint                    *minimum_size,
100                                                           gint                    *natural_size);
101   void               (* get_preferred_height_for_width)  (GtkCellArea             *area,
102                                                           GtkCellAreaIter         *iter,
103                                                           GtkWidget               *widget,
104                                                           gint                     width,
105                                                           gint                    *minimum_height,
106                                                           gint                    *natural_height);
107   void               (* get_preferred_height)            (GtkCellArea             *area,
108                                                           GtkCellAreaIter         *iter,
109                                                           GtkWidget               *widget,
110                                                           gint                    *minimum_size,
111                                                           gint                    *natural_size);
112   void               (* get_preferred_width_for_height)  (GtkCellArea             *area,
113                                                           GtkCellAreaIter         *iter,
114                                                           GtkWidget               *widget,
115                                                           gint                     height,
116                                                           gint                    *minimum_width,
117                                                           gint                    *natural_width);
118
119   /* Cell Properties */
120   void               (* set_cell_property)               (GtkCellArea             *area,
121                                                           GtkCellRenderer         *renderer,
122                                                           guint                    property_id,
123                                                           const GValue            *value,
124                                                           GParamSpec              *pspec);
125   void               (* get_cell_property)               (GtkCellArea             *area,
126                                                           GtkCellRenderer         *renderer,
127                                                           guint                    property_id,
128                                                           GValue                  *value,
129                                                           GParamSpec              *pspec);
130
131   /* Padding for future expansion */
132   void (*_gtk_reserved1) (void);
133   void (*_gtk_reserved2) (void);
134   void (*_gtk_reserved3) (void);
135   void (*_gtk_reserved4) (void);
136   void (*_gtk_reserved5) (void);
137   void (*_gtk_reserved6) (void);
138   void (*_gtk_reserved7) (void);
139   void (*_gtk_reserved8) (void);
140 };
141
142 GType              gtk_cell_area_get_type                       (void) G_GNUC_CONST;
143
144 /* Basic methods */
145 void               gtk_cell_area_add                            (GtkCellArea        *area,
146                                                                  GtkCellRenderer    *renderer);
147 void               gtk_cell_area_remove                         (GtkCellArea        *area,
148                                                                  GtkCellRenderer    *renderer);
149 void               gtk_cell_area_forall                         (GtkCellArea        *area,
150                                                                  GtkCellCallback     callback,
151                                                                  gpointer            callback_data);
152 gint               gtk_cell_area_event                          (GtkCellArea        *area,
153                                                                  GtkCellAreaIter    *iter,
154                                                                  GtkWidget          *widget,
155                                                                  GdkEvent           *event,
156                                                                  const GdkRectangle *cell_area);
157 void               gtk_cell_area_render                         (GtkCellArea        *area,
158                                                                  GtkCellAreaIter    *iter,
159                                                                  GtkWidget          *widget,
160                                                                  cairo_t            *cr,
161                                                                  const GdkRectangle *cell_area);
162
163 /* Geometry */
164 GtkCellAreaIter   *gtk_cell_area_create_iter                    (GtkCellArea        *area);
165 GtkSizeRequestMode gtk_cell_area_get_request_mode               (GtkCellArea        *area);
166 void               gtk_cell_area_get_preferred_width            (GtkCellArea        *area,
167                                                                  GtkCellAreaIter    *iter,
168                                                                  GtkWidget          *widget,
169                                                                  gint               *minimum_size,
170                                                                  gint               *natural_size);
171 void               gtk_cell_area_get_preferred_height_for_width (GtkCellArea        *area,
172                                                                  GtkCellAreaIter    *iter,
173                                                                  GtkWidget          *widget,
174                                                                  gint                width,
175                                                                  gint               *minimum_height,
176                                                                  gint               *natural_height);
177 void               gtk_cell_area_get_preferred_height           (GtkCellArea        *area,
178                                                                  GtkCellAreaIter    *iter,
179                                                                  GtkWidget          *widget,
180                                                                  gint               *minimum_size,
181                                                                  gint               *natural_size);
182 void               gtk_cell_area_get_preferred_width_for_height (GtkCellArea        *area,
183                                                                  GtkCellAreaIter    *iter,
184                                                                  GtkWidget          *widget,
185                                                                  gint                height,
186                                                                  gint               *minimum_width,
187                                                                  gint               *natural_width);
188
189 /* Attributes */
190 void               gtk_cell_area_apply_attributes               (GtkCellArea        *area,
191                                                                  GtkTreeModel       *tree_model,
192                                                                  GtkTreeIter        *iter);
193 void               gtk_cell_area_attribute_connect              (GtkCellArea        *area,
194                                                                  GtkCellRenderer    *renderer,
195                                                                  const gchar        *attribute,
196                                                                  gint                column); 
197 void               gtk_cell_area_attribute_disconnect           (GtkCellArea        *area,
198                                                                  GtkCellRenderer    *renderer,
199                                                                  const gchar        *attribute);
200
201 /* Cell Properties */
202 void               gtk_cell_area_class_install_cell_property    (GtkCellAreaClass   *aclass,
203                                                                  guint               property_id,
204                                                                  GParamSpec         *pspec);
205 GParamSpec*        gtk_cell_area_class_find_cell_property       (GtkCellAreaClass   *aclass,
206                                                                  const gchar        *property_name);
207 GParamSpec**       gtk_cell_area_class_list_cell_properties     (GtkCellAreaClass   *aclass,
208                                                                  guint              *n_properties);
209 void               gtk_cell_area_add_with_properties            (GtkCellArea        *area,
210                                                                  GtkCellRenderer    *renderer,
211                                                                  const gchar        *first_prop_name,
212                                                                  ...) G_GNUC_NULL_TERMINATED;
213 void               gtk_cell_area_cell_set                       (GtkCellArea        *area,
214                                                                  GtkCellRenderer    *renderer,
215                                                                  const gchar        *first_prop_name,
216                                                                  ...) G_GNUC_NULL_TERMINATED;
217 void               gtk_cell_area_cell_get                       (GtkCellArea        *area,
218                                                                  GtkCellRenderer    *renderer,
219                                                                  const gchar        *first_prop_name,
220                                                                  ...) G_GNUC_NULL_TERMINATED;
221 void               gtk_cell_area_cell_set_valist                (GtkCellArea        *area,
222                                                                  GtkCellRenderer    *renderer,
223                                                                  const gchar        *first_property_name,
224                                                                  va_list             var_args);
225 void               gtk_cell_area_cell_get_valist                (GtkCellArea        *area,
226                                                                  GtkCellRenderer    *renderer,
227                                                                  const gchar        *first_property_name,
228                                                                  va_list             var_args);
229 void               gtk_cell_area_cell_set_property              (GtkCellArea        *area,
230                                                                  GtkCellRenderer    *renderer,
231                                                                  const gchar        *property_name,
232                                                                  const GValue       *value);
233 void               gtk_cell_area_cell_get_property              (GtkCellArea        *area,
234                                                                  GtkCellRenderer    *renderer,
235                                                                  const gchar        *property_name,
236                                                                  GValue             *value);
237
238
239 G_END_DECLS
240
241 #endif /* __GTK_CELL_AREA_H__ */