]> Pileus Git - ~andy/gtk/blob - gtk/gtkcellareacontext.h
stylecontext: Do invalidation on first resize container
[~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, see <http://www.gnu.org/licenses/>.
20  */
21
22 #ifndef __GTK_CELL_AREA_CONTEXT_H__
23 #define __GTK_CELL_AREA_CONTEXT_H__
24
25 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
26 #error "Only <gtk/gtk.h> can be included directly."
27 #endif
28
29 #include <gtk/gtkcellarea.h>
30
31 G_BEGIN_DECLS
32
33 #define GTK_TYPE_CELL_AREA_CONTEXT            (gtk_cell_area_context_get_type ())
34 #define GTK_CELL_AREA_CONTEXT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_AREA_CONTEXT, GtkCellAreaContext))
35 #define GTK_CELL_AREA_CONTEXT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_AREA_CONTEXT, GtkCellAreaContextClass))
36 #define GTK_IS_CELL_AREA_CONTEXT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_AREA_CONTEXT))
37 #define GTK_IS_CELL_AREA_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_AREA_CONTEXT))
38 #define GTK_CELL_AREA_CONTEXT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_AREA_CONTEXT, GtkCellAreaContextClass))
39
40 typedef struct _GtkCellAreaContextPrivate       GtkCellAreaContextPrivate;
41 typedef struct _GtkCellAreaContextClass         GtkCellAreaContextClass;
42
43 struct _GtkCellAreaContext
44 {
45   /*< private >*/
46   GObject parent_instance;
47
48   GtkCellAreaContextPrivate *priv;
49 };
50
51 /**
52  * GtkCellAreaContextClass:
53  * @allocate: This tells the context that an allocation width or height
54  *     (or both) have been decided for a group of rows. The context should
55  *     store any allocations for internally aligned cells at this point so
56  *     that they dont need to be recalculated at gtk_cell_area_render() time.
57  * @reset: Clear any previously stored information about requested and
58  *     allocated sizes for the context.
59  * @get_preferred_height_for_width: Returns the aligned height for the given
60  *     width that context must store while collecting sizes for it's rows.
61  * @get_preferred_width_for_height: Returns the aligned width for the given
62  *     height that context must store while collecting sizes for it's rows.
63  */
64 struct _GtkCellAreaContextClass
65 {
66   /*< private >*/
67   GObjectClass parent_class;
68
69   /*< public >*/
70   void    (* allocate)                       (GtkCellAreaContext *context,
71                                               gint                width,
72                                               gint                height);
73   void    (* reset)                          (GtkCellAreaContext *context);
74   void    (* get_preferred_height_for_width) (GtkCellAreaContext *context,
75                                               gint                width,
76                                               gint               *minimum_height,
77                                               gint               *natural_height);
78   void    (* get_preferred_width_for_height) (GtkCellAreaContext *context,
79                                               gint                height,
80                                               gint               *minimum_width,
81                                               gint               *natural_width);
82
83   /*< private >*/
84   /* Padding for future expansion */
85   void (*_gtk_reserved1) (void);
86   void (*_gtk_reserved2) (void);
87   void (*_gtk_reserved3) (void);
88   void (*_gtk_reserved4) (void);
89   void (*_gtk_reserved5) (void);
90   void (*_gtk_reserved6) (void);
91 };
92
93 GType        gtk_cell_area_context_get_type              (void) G_GNUC_CONST;
94
95 /* Main apis */
96 GtkCellArea *gtk_cell_area_context_get_area                        (GtkCellAreaContext *context);
97 void         gtk_cell_area_context_allocate                        (GtkCellAreaContext *context,
98                                                                     gint                width,
99                                                                     gint                height);
100 void         gtk_cell_area_context_reset                           (GtkCellAreaContext *context);
101
102 /* Apis for GtkCellArea clients to consult cached values
103  * for a series of GtkTreeModel rows
104  */
105 void         gtk_cell_area_context_get_preferred_width            (GtkCellAreaContext *context,
106                                                                    gint               *minimum_width,
107                                                                    gint               *natural_width);
108 void         gtk_cell_area_context_get_preferred_height           (GtkCellAreaContext *context,
109                                                                    gint               *minimum_height,
110                                                                    gint               *natural_height);
111 void         gtk_cell_area_context_get_preferred_height_for_width (GtkCellAreaContext *context,
112                                                                    gint                width,
113                                                                    gint               *minimum_height,
114                                                                    gint               *natural_height);
115 void         gtk_cell_area_context_get_preferred_width_for_height (GtkCellAreaContext *context,
116                                                                    gint                height,
117                                                                    gint               *minimum_width,
118                                                                    gint               *natural_width);
119 void         gtk_cell_area_context_get_allocation                 (GtkCellAreaContext *context,
120                                                                    gint               *width,
121                                                                    gint               *height);
122
123 /* Apis for GtkCellArea implementations to update cached values
124  * for multiple GtkTreeModel rows
125  */
126 void         gtk_cell_area_context_push_preferred_width  (GtkCellAreaContext *context,
127                                                           gint                minimum_width,
128                                                           gint                natural_width);
129 void         gtk_cell_area_context_push_preferred_height (GtkCellAreaContext *context,
130                                                           gint                minimum_height,
131                                                           gint                natural_height);
132
133 G_END_DECLS
134
135 #endif /* __GTK_CELL_AREA_CONTEXT_H__ */