]> Pileus Git - ~andy/gtk/blob - gtk/gtkcellarea.h
Merge branch 'master' into treeview-refactor
[~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
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 /**
62  * GtkCellAttributeCallback:
63  * @renderer: the #GtkCellRenderer that has an attribute
64  * @attribute: the property attributed to @id
65  * @id: the identifier of this attributed value
66  * @data: user-supplied data
67  *
68  * The type of the callback functions used for iterating over the 
69  * attributes of the cell renderers in a #GtkCellArea, 
70  * see gtk_cell_area_attribute_forall().
71  */
72 typedef void    (*GtkCellAttributeCallback)     (GtkCellRenderer  *renderer,
73                                                  const gchar      *attribute,
74                                                  gint              id,
75                                                  gpointer          data);
76
77
78 struct _GtkCellArea
79 {
80   GInitiallyUnowned parent_instance;
81
82   GtkCellAreaPrivate *priv;
83 };
84
85 struct _GtkCellAreaClass
86 {
87   GInitiallyUnownedClass parent_class;
88
89   /* vtable - not signals */
90
91   /* Basic methods */
92   void               (* add)                             (GtkCellArea             *area,
93                                                           GtkCellRenderer         *renderer);
94   void               (* remove)                          (GtkCellArea             *area,
95                                                           GtkCellRenderer         *renderer);
96   void               (* forall)                          (GtkCellArea             *area,
97                                                           GtkCellCallback          callback,
98                                                           gpointer                 callback_data);
99   gint               (* event)                           (GtkCellArea             *area,
100                                                           GtkWidget               *widget,
101                                                           GdkEvent                *event,
102                                                           const GdkRectangle      *cell_area);
103   void               (* render)                          (GtkCellArea             *area,
104                                                           cairo_t                 *cr,
105                                                           GtkWidget               *widget,
106                                                           const GdkRectangle      *cell_area);
107
108   /* Attributes */
109   void               (* attribute_connect)               (GtkCellArea             *area,
110                                                           GtkCellRenderer         *renderer,
111                                                           const gchar             *attribute,
112                                                           gint                     id);
113   void               (* attribute_disconnect)            (GtkCellArea             *area,
114                                                           GtkCellRenderer         *renderer,
115                                                           const gchar             *attribute,
116                                                           gint                     id);
117   void               (* attribute_forall)                (GtkCellArea             *area,
118                                                           GtkCellRenderer         *renderer,
119                                                           GtkCellAttributeCallback callback,
120                                                           gpointer                 user_data);
121
122   /* Geometry */
123   GtkSizeRequestMode (* get_request_mode)                (GtkCellArea             *area);
124   void               (* get_preferred_width)             (GtkCellArea             *area,
125                                                           GtkWidget               *widget,
126                                                           gint                    *minimum_size,
127                                                           gint                    *natural_size);
128   void               (* get_preferred_height_for_width)  (GtkCellArea             *area,
129                                                           GtkWidget               *widget,
130                                                           gint                     width,
131                                                           gint                    *minimum_height,
132                                                           gint                    *natural_height);
133   void               (* get_preferred_height)            (GtkCellArea             *area,
134                                                           GtkWidget               *widget,
135                                                           gint                    *minimum_size,
136                                                           gint                    *natural_size);
137   void               (* get_preferred_width_for_height)  (GtkCellArea             *area,
138                                                           GtkWidget               *widget,
139                                                           gint                     height,
140                                                           gint                    *minimum_width,
141                                                           gint                    *natural_width);
142
143
144   /* Padding for future expansion */
145   void (*_gtk_reserved1) (void);
146   void (*_gtk_reserved2) (void);
147   void (*_gtk_reserved3) (void);
148   void (*_gtk_reserved4) (void);
149   void (*_gtk_reserved5) (void);
150   void (*_gtk_reserved6) (void);
151   void (*_gtk_reserved7) (void);
152   void (*_gtk_reserved8) (void);
153 };
154
155 GType              gtk_cell_area_get_type                       (void) G_GNUC_CONST;
156
157 /* Basic methods */
158 void               gtk_cell_area_add                            (GtkCellArea        *area,
159                                                                  GtkCellRenderer    *renderer);
160 void               gtk_cell_area_remove                         (GtkCellArea        *area,
161                                                                  GtkCellRenderer    *renderer);
162 void               gtk_cell_area_forall                         (GtkCellArea        *area,
163                                                                  GtkCellCallback     callback,
164                                                                  gpointer            callback_data);
165 gint               gtk_cell_area_event                          (GtkCellArea        *area,
166                                                                  GtkWidget          *widget,
167                                                                  GdkEvent           *event,
168                                                                  const GdkRectangle *cell_area);
169 void               gtk_cell_area_render                         (GtkCellArea        *area,
170                                                                  cairo_t            *cr,
171                                                                  GtkWidget          *widget,
172                                                                  const GdkRectangle *cell_area);
173
174 /* Attributes */
175 void               gtk_cell_area_attribute_connect              (GtkCellArea             *area,
176                                                                  GtkCellRenderer         *renderer,
177                                                                  const gchar             *attribute,
178                                                                  gint                     id); 
179 void               gtk_cell_area_attribute_disconnect           (GtkCellArea             *area,
180                                                                  GtkCellRenderer         *renderer,
181                                                                  const gchar             *attribute,
182                                                                  gint                     id);
183 void               gtk_cell_area_attribute_forall               (GtkCellArea             *area,
184                                                                  GtkCellRenderer         *renderer,
185                                                                  GtkCellAttributeCallback callback,
186                                                                  gpointer                 user_data);
187
188 /* Geometry */
189 GtkSizeRequestMode gtk_cell_area_get_request_mode               (GtkCellArea        *area);
190 void               gtk_cell_area_get_preferred_width            (GtkCellArea        *area,
191                                                                  GtkWidget          *widget,
192                                                                  gint               *minimum_size,
193                                                                  gint               *natural_size);
194 void               gtk_cell_area_get_preferred_height_for_width (GtkCellArea        *area,
195                                                                  GtkWidget          *widget,
196                                                                  gint                width,
197                                                                  gint               *minimum_height,
198                                                                  gint               *natural_height);
199 void               gtk_cell_area_get_preferred_height           (GtkCellArea        *area,
200                                                                  GtkWidget          *widget,
201                                                                  gint               *minimum_size,
202                                                                  gint               *natural_size);
203 void               gtk_cell_area_get_preferred_width_for_height (GtkCellArea        *area,
204                                                                  GtkWidget          *widget,
205                                                                  gint                height,
206                                                                  gint               *minimum_width,
207                                                                  gint               *natural_width);
208
209
210 /* Following apis are not class virtual methods */
211 void               gtk_cell_area_apply_attributes               (GtkCellArea        *area,
212                                                                  GtkTreeModel       *tree_model,
213                                                                  GtkTreeIter        *iter);
214
215
216 G_END_DECLS
217
218 #endif /* __GTK_CELL_AREA_H__ */