]> Pileus Git - ~andy/gtk/blob - gtk/gtkcellareacontext.h
Added apis to GtkCellArea for GtkIconView purposes.
[~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   /*< private >*/
48   GObject parent_instance;
49
50   GtkCellAreaContextPrivate *priv;
51 };
52
53 /**
54  * GtkCellAreaContextClass:
55  * @allocate: This tells the context that an allocation width or height (or both)
56  * have been decided for a group of rows. The context should store any allocations
57  * for internally aligned cells at this point so that they dont need to be
58  * recalculated at gtk_cell_area_render() time.
59  * @reset: Clear any previously stored information about requested and allocated
60  * sizes for the context.
61  */
62 struct _GtkCellAreaContextClass
63 {
64   /*< private >*/
65   GObjectClass parent_class;
66
67   /*< public >*/
68   void    (* allocate)                       (GtkCellAreaContext *context,
69                                               gint                width,
70                                               gint                height);
71   void    (* reset)                          (GtkCellAreaContext *context);
72   void    (* get_preferred_height_for_width) (GtkCellAreaContext *context,
73                                               gint                width,
74                                               gint               *minimum_height,
75                                               gint               *natural_height);
76   void    (* get_preferred_width_for_height) (GtkCellAreaContext *context,
77                                               gint                height,
78                                               gint               *minimum_width,
79                                               gint               *natural_width);
80
81   /*< private >*/
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 /* Main apis */
92 GtkCellArea *gtk_cell_area_context_get_area                        (GtkCellAreaContext *context);
93 void         gtk_cell_area_context_allocate                        (GtkCellAreaContext *context,
94                                                                     gint                width,
95                                                                     gint                height);
96 void         gtk_cell_area_context_reset                           (GtkCellAreaContext *context);
97
98 /* Apis for GtkCellArea clients to consult cached values for a series of GtkTreeModel rows */
99 void         gtk_cell_area_context_get_preferred_width            (GtkCellAreaContext *context,
100                                                                    gint               *minimum_width,
101                                                                    gint               *natural_width);
102 void         gtk_cell_area_context_get_preferred_height           (GtkCellAreaContext *context,
103                                                                    gint               *minimum_height,
104                                                                    gint               *natural_height);
105 void         gtk_cell_area_context_get_preferred_height_for_width (GtkCellAreaContext *context,
106                                                                    gint                width,
107                                                                    gint               *minimum_height,
108                                                                    gint               *natural_height);
109 void         gtk_cell_area_context_get_preferred_width_for_height (GtkCellAreaContext *context,
110                                                                    gint                height,
111                                                                    gint               *minimum_width,
112                                                                    gint               *natural_width);
113 void         gtk_cell_area_context_get_allocation                 (GtkCellAreaContext *context,
114                                                                    gint               *width,
115                                                                    gint               *height);
116
117 /* Apis for GtkCellArea implementations to update cached values for multiple GtkTreeModel rows */
118 void         gtk_cell_area_context_push_preferred_width  (GtkCellAreaContext *context,
119                                                           gint                minimum_width,
120                                                           gint                natural_width);
121 void         gtk_cell_area_context_push_preferred_height (GtkCellAreaContext *context,
122                                                           gint                minimum_height,
123                                                           gint                natural_height);
124
125 G_END_DECLS
126
127 #endif /* __GTK_CELL_AREA_CONTEXT_H__ */