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
31G_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
40typedef struct _GtkCellAreaContextPrivate GtkCellAreaContextPrivate;
41typedef struct _GtkCellAreaContextClass GtkCellAreaContextClass;
42
43struct _GtkCellAreaContext
44{
45 /*< private >*/
46 GObject parent_instance;
47};
48
49/**
50 * GtkCellAreaContextClass:
51 * @allocate: This tells the context that an allocation width or height
52 * (or both) have been decided for a group of rows. The context should
53 * store any allocations for internally aligned cells at this point so
54 * that they dont need to be recalculated at gtk_cell_area_render() time.
55 * @reset: Clear any previously stored information about requested and
56 * allocated sizes for the context.
57 * @get_preferred_height_for_width: Returns the aligned height for the given
58 * width that context must store while collecting sizes for it’s rows.
59 * @get_preferred_width_for_height: Returns the aligned width for the given
60 * height that context must store while collecting sizes for it’s rows.
61 */
62struct _GtkCellAreaContextClass
63{
64 /*< private >*/
65 GObjectClass parent_class;
66
67 /*< public >*/
68 void (* allocate) (GtkCellAreaContext *context,
69 int width,
70 int height);
71 void (* reset) (GtkCellAreaContext *context);
72 void (* get_preferred_height_for_width) (GtkCellAreaContext *context,
73 int width,
74 int *minimum_height,
75 int *natural_height);
76 void (* get_preferred_width_for_height) (GtkCellAreaContext *context,
77 int height,
78 int *minimum_width,
79 int *natural_width);
80
81 /*< private >*/
82
83 gpointer padding[8];
84};
85
86GDK_AVAILABLE_IN_ALL
87GType gtk_cell_area_context_get_type (void) G_GNUC_CONST;
88
89/* Main apis */
90GDK_AVAILABLE_IN_ALL
91GtkCellArea *gtk_cell_area_context_get_area (GtkCellAreaContext *context);
92GDK_AVAILABLE_IN_ALL
93void gtk_cell_area_context_allocate (GtkCellAreaContext *context,
94 int width,
95 int height);
96GDK_AVAILABLE_IN_ALL
97void gtk_cell_area_context_reset (GtkCellAreaContext *context);
98
99/* Apis for GtkCellArea clients to consult cached values
100 * for a series of GtkTreeModel rows
101 */
102GDK_AVAILABLE_IN_ALL
103void gtk_cell_area_context_get_preferred_width (GtkCellAreaContext *context,
104 int *minimum_width,
105 int *natural_width);
106GDK_AVAILABLE_IN_ALL
107void gtk_cell_area_context_get_preferred_height (GtkCellAreaContext *context,
108 int *minimum_height,
109 int *natural_height);
110GDK_AVAILABLE_IN_ALL
111void gtk_cell_area_context_get_preferred_height_for_width (GtkCellAreaContext *context,
112 int width,
113 int *minimum_height,
114 int *natural_height);
115GDK_AVAILABLE_IN_ALL
116void gtk_cell_area_context_get_preferred_width_for_height (GtkCellAreaContext *context,
117 int height,
118 int *minimum_width,
119 int *natural_width);
120GDK_AVAILABLE_IN_ALL
121void gtk_cell_area_context_get_allocation (GtkCellAreaContext *context,
122 int *width,
123 int *height);
124
125/* Apis for GtkCellArea implementations to update cached values
126 * for multiple GtkTreeModel rows
127 */
128GDK_AVAILABLE_IN_ALL
129void gtk_cell_area_context_push_preferred_width (GtkCellAreaContext *context,
130 int minimum_width,
131 int natural_width);
132GDK_AVAILABLE_IN_ALL
133void gtk_cell_area_context_push_preferred_height (GtkCellAreaContext *context,
134 int minimum_height,
135 int natural_height);
136
137G_END_DECLS
138
139#endif /* __GTK_CELL_AREA_CONTEXT_H__ */
140

source code of gtk/gtk/gtkcellareacontext.h