]> Pileus Git - ~andy/gtk/blob - gtk/gtkcellareacontext.h
Merge branch 'master' into treeview-refactor
[~andy/gtk] / gtk / gtkcellareacontext.h
1 /* gtkcellareacontext.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_CONTEXT_H__
29 #define __GTK_CELL_AREA_CONTEXT_H__
30
31 #include <gtk/gtkcellarea.h>
32
33 G_BEGIN_DECLS
34
35 #define GTK_TYPE_CELL_AREA_CONTEXT            (gtk_cell_area_context_get_type ())
36 #define GTK_CELL_AREA_CONTEXT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_AREA_CONTEXT, GtkCellAreaContext))
37 #define GTK_CELL_AREA_CONTEXT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_AREA_CONTEXT, GtkCellAreaContextClass))
38 #define GTK_IS_CELL_AREA_CONTEXT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_AREA_CONTEXT))
39 #define GTK_IS_CELL_AREA_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_AREA_CONTEXT))
40 #define GTK_CELL_AREA_CONTEXT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_AREA_CONTEXT, GtkCellAreaContextClass))
41
42 typedef struct _GtkCellAreaContextPrivate       GtkCellAreaContextPrivate;
43 typedef struct _GtkCellAreaContextClass         GtkCellAreaContextClass;
44
45 struct _GtkCellAreaContext
46 {
47   GObject parent_instance;
48
49   GtkCellAreaContextPrivate *priv;
50 };
51
52 struct _GtkCellAreaContextClass
53 {
54   GObjectClass parent_class;
55
56   /* Subclasses can use this to flush their alignments/allocations */
57   void    (* flush_preferred_width)              (GtkCellAreaContext *context);
58   void    (* flush_preferred_height_for_width)   (GtkCellAreaContext *context,
59                                                   gint                width);
60   void    (* flush_preferred_height)             (GtkCellAreaContext *context);
61   void    (* flush_preferred_width_for_height)   (GtkCellAreaContext *context,
62                                                   gint                height);
63   void    (* flush_allocation)                   (GtkCellAreaContext *context);
64
65   /* These must be invoked after a series of requests before consulting 
66    * the context values, implementors use this to push the overall
67    * requests while acconting for any internal alignments */
68   void    (* sum_preferred_width)                (GtkCellAreaContext *context);
69   void    (* sum_preferred_height_for_width)     (GtkCellAreaContext *context,
70                                                   gint                width);
71   void    (* sum_preferred_height)               (GtkCellAreaContext *context);
72   void    (* sum_preferred_width_for_height)     (GtkCellAreaContext *context,
73                                                   gint                height);
74
75   /* Store an allocation value for a GtkCellArea contextual to a range of
76    * treemodel rows */
77   void    (* allocate_width)                     (GtkCellAreaContext *context,
78                                                   gint                width);
79   void    (* allocate_height)                    (GtkCellAreaContext *context,
80                                                   gint                height);
81
82   /* Padding for future expansion */
83   void (*_gtk_reserved1) (void);
84   void (*_gtk_reserved2) (void);
85   void (*_gtk_reserved3) (void);
86   void (*_gtk_reserved4) (void);
87 };
88
89 GType        gtk_cell_area_context_get_type                         (void) G_GNUC_CONST;
90
91 GtkCellArea *gtk_cell_area_context_get_area                         (GtkCellAreaContext *context);
92
93 /* Apis for GtkCellArea clients to flush the cache */
94 void         gtk_cell_area_context_flush                            (GtkCellAreaContext *context);
95 void         gtk_cell_area_context_flush_preferred_width            (GtkCellAreaContext *context);
96 void         gtk_cell_area_context_flush_preferred_height_for_width (GtkCellAreaContext *context,
97                                                                      gint                for_width);
98 void         gtk_cell_area_context_flush_preferred_height           (GtkCellAreaContext *context);
99 void         gtk_cell_area_context_flush_preferred_width_for_height (GtkCellAreaContext *context,
100                                                                      gint                for_height);
101 void         gtk_cell_area_context_flush_allocation                 (GtkCellAreaContext *context);
102
103 /* Apis for GtkCellArea clients to sum up the results of a series of requests, this
104  * call is required to reduce the processing while calculating the size of each row */
105 void         gtk_cell_area_context_sum_preferred_width              (GtkCellAreaContext *context);
106 void         gtk_cell_area_context_sum_preferred_height_for_width   (GtkCellAreaContext *context,
107                                                                      gint                for_width);
108 void         gtk_cell_area_context_sum_preferred_height             (GtkCellAreaContext *context);
109 void         gtk_cell_area_context_sum_preferred_width_for_height   (GtkCellAreaContext *context,
110                                                                      gint                for_height);
111
112 /* Apis to set an allocation size in one dimension or another, the subclass specific context
113  * will store allocated positions/sizes for individual cells or groups of cells */
114 void         gtk_cell_area_context_allocate_width                   (GtkCellAreaContext *context,
115                                                                      gint                width);
116 void         gtk_cell_area_context_allocate_height                  (GtkCellAreaContext *context,
117                                                                      gint                height);
118
119 /* Apis for GtkCellArea clients to consult cached values for multiple GtkTreeModel rows */
120 void         gtk_cell_area_context_get_preferred_width              (GtkCellAreaContext *context,
121                                                                      gint               *minimum_width,
122                                                                      gint               *natural_width);
123 void         gtk_cell_area_context_get_preferred_height_for_width   (GtkCellAreaContext *context,
124                                                                      gint                for_width,
125                                                                      gint               *minimum_height,
126                                                                      gint               *natural_height);
127 void         gtk_cell_area_context_get_preferred_height             (GtkCellAreaContext *context,
128                                                                      gint               *minimum_height,
129                                                                      gint               *natural_height);
130 void         gtk_cell_area_context_get_preferred_width_for_height   (GtkCellAreaContext *context,
131                                                                      gint                for_height,
132                                                                      gint               *minimum_width,
133                                                                      gint               *natural_width);
134 void         gtk_cell_area_context_get_allocation                   (GtkCellAreaContext *context,
135                                                                      gint               *width,
136                                                                      gint               *height);
137
138 /* Apis for GtkCellArea implementations to update cached values for multiple GtkTreeModel rows */
139 void         gtk_cell_area_context_push_preferred_width             (GtkCellAreaContext *context,
140                                                                      gint                minimum_width,
141                                                                      gint                natural_width);
142 void         gtk_cell_area_context_push_preferred_height_for_width  (GtkCellAreaContext *context,
143                                                                      gint                for_width,
144                                                                      gint                minimum_height,
145                                                                      gint                natural_height);
146 void         gtk_cell_area_context_push_preferred_height            (GtkCellAreaContext *context,
147                                                                      gint                minimum_height,
148                                                                      gint                natural_height);
149 void         gtk_cell_area_context_push_preferred_width_for_height  (GtkCellAreaContext *context,
150                                                                      gint                for_height,
151                                                                      gint                minimum_width,
152                                                                      gint                natural_width);
153
154 G_END_DECLS
155
156 #endif /* __GTK_CELL_AREA_CONTEXT_H__ */