]> Pileus Git - ~andy/gtk/blob - gtk/gtkcellareaiter.h
b2e0e55a937fbe69283d2a5bb668ecaab5051222
[~andy/gtk] / gtk / gtkcellareaiter.h
1 /* gtkcellareaiter.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_ITER_H__
29 #define __GTK_CELL_AREA_ITER_H__
30
31 #include <gtk/gtkcellarea.h>
32
33 G_BEGIN_DECLS
34
35 #define GTK_TYPE_CELL_AREA_ITER           (gtk_cell_area_iter_get_type ())
36 #define GTK_CELL_AREA_ITER(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_AREA_ITER, GtkCellAreaIter))
37 #define GTK_CELL_AREA_ITER_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_AREA_ITER, GtkCellAreaIterClass))
38 #define GTK_IS_CELL_AREA_ITER(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_AREA_ITER))
39 #define GTK_IS_CELL_AREA_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_AREA_ITER))
40 #define GTK_CELL_AREA_ITER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_AREA_ITER, GtkCellAreaIterClass))
41
42 typedef struct _GtkCellAreaIterPrivate       GtkCellAreaIterPrivate;
43 typedef struct _GtkCellAreaIterClass         GtkCellAreaIterClass;
44
45 struct _GtkCellAreaIter
46 {
47   GObject parent_instance;
48
49   GtkCellAreaIterPrivate *priv;
50 };
51
52 struct _GtkCellAreaIterClass
53 {
54   GObjectClass parent_class;
55
56   /* Subclasses can use this to flush their alignments */
57   void    (* flush_preferred_width)              (GtkCellAreaIter *iter);
58   void    (* flush_preferred_height_for_width)   (GtkCellAreaIter *iter,
59                                                   gint             width);
60   void    (* flush_preferred_height)             (GtkCellAreaIter *iter);
61   void    (* flush_preferred_width_for_height)   (GtkCellAreaIter *iter,
62                                                   gint             height);
63
64   /* These must be invoked after a series of requests before consulting 
65    * the iter values, implementors use this to push the overall
66    * requests while acconting for any internal alignments */
67   void    (* sum_preferred_width)                (GtkCellAreaIter *iter);
68   void    (* sum_preferred_height_for_width)     (GtkCellAreaIter *iter,
69                                                   gint             width);
70   void    (* sum_preferred_height)               (GtkCellAreaIter *iter);
71   void    (* sum_preferred_width_for_height)     (GtkCellAreaIter *iter,
72                                                   gint             height);
73
74   /* Padding for future expansion */
75   void (*_gtk_reserved1) (void);
76   void (*_gtk_reserved2) (void);
77   void (*_gtk_reserved3) (void);
78   void (*_gtk_reserved4) (void);
79 };
80
81 GType        gtk_cell_area_iter_get_type                         (void) G_GNUC_CONST;
82
83 GtkCellArea *gtk_cell_area_iter_get_area                         (GtkCellAreaIter *iter);
84
85 /* Apis for GtkCellArea clients to consult cached values for multiple GtkTreeModel rows */
86 void         gtk_cell_area_iter_get_preferred_width              (GtkCellAreaIter *iter,
87                                                                   gint            *minimum_width,
88                                                                   gint            *natural_width);
89 void         gtk_cell_area_iter_get_preferred_height_for_width   (GtkCellAreaIter *iter,
90                                                                   gint             for_width,
91                                                                   gint            *minimum_height,
92                                                                   gint            *natural_height);
93 void         gtk_cell_area_iter_get_preferred_height             (GtkCellAreaIter *iter,
94                                                                   gint            *minimum_height,
95                                                                   gint            *natural_height);
96 void         gtk_cell_area_iter_get_preferred_width_for_height   (GtkCellAreaIter *iter,
97                                                                   gint             for_height,
98                                                                   gint            *minimum_width,
99                                                                   gint            *natural_width);
100
101 /* Apis for GtkCellArea clients to sum up the results of a series of requests, this
102  * call is required to reduce the processing while calculating the size of each row */
103 void         gtk_cell_area_iter_sum_preferred_width              (GtkCellAreaIter *iter);
104 void         gtk_cell_area_iter_sum_preferred_height_for_width   (GtkCellAreaIter *iter,
105                                                                   gint             for_width);
106 void         gtk_cell_area_iter_sum_preferred_height             (GtkCellAreaIter *iter);
107 void         gtk_cell_area_iter_sum_preferred_width_for_height   (GtkCellAreaIter *iter,
108                                                                   gint             for_height);
109
110 /* Apis for GtkCellArea clients to flush the cache */
111 void         gtk_cell_area_iter_flush                            (GtkCellAreaIter *iter);
112 void         gtk_cell_area_iter_flush_preferred_width            (GtkCellAreaIter *iter);
113 void         gtk_cell_area_iter_flush_preferred_height_for_width (GtkCellAreaIter *iter,
114                                                                   gint             for_width);
115 void         gtk_cell_area_iter_flush_preferred_height           (GtkCellAreaIter *iter);
116 void         gtk_cell_area_iter_flush_preferred_width_for_height (GtkCellAreaIter *iter,
117                                                                   gint             for_height);
118
119 /* Apis for GtkCellArea implementations to update cached values for multiple GtkTreeModel rows */
120 void         gtk_cell_area_iter_push_preferred_width             (GtkCellAreaIter *iter,
121                                                                   gint             minimum_width,
122                                                                   gint             natural_width);
123 void         gtk_cell_area_iter_push_preferred_height_for_width  (GtkCellAreaIter *iter,
124                                                                   gint             for_width,
125                                                                   gint             minimum_height,
126                                                                   gint             natural_height);
127 void         gtk_cell_area_iter_push_preferred_height            (GtkCellAreaIter *iter,
128                                                                   gint             minimum_height,
129                                                                   gint             natural_height);
130 void         gtk_cell_area_iter_push_preferred_width_for_height  (GtkCellAreaIter *iter,
131                                                                   gint             for_height,
132                                                                   gint             minimum_width,
133                                                                   gint             natural_width);
134
135 G_END_DECLS
136
137 #endif /* __GTK_CELL_AREA_ITER_H__ */