1 /* gtkcellareaboxcontext.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_BOX_CONTEXT_H__ 23 #define __GTK_CELL_AREA_BOX_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/gtkcellareacontext.h> 30 #include <gtk/gtkcellareabox.h> 31 #include <gtk/gtkcellrenderer.h> 32 #include <gtk/gtksizerequest.h> 33 34 G_BEGIN_DECLS 35 36 #define GTK_TYPE_CELL_AREA_BOX_CONTEXT (_gtk_cell_area_box_context_get_type ()) 37 #define GTK_CELL_AREA_BOX_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_AREA_BOX_CONTEXT, GtkCellAreaBoxContext)) 38 #define GTK_CELL_AREA_BOX_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_AREA_BOX_CONTEXT, GtkCellAreaBoxContextClass)) 39 #define GTK_IS_CELL_AREA_BOX_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_AREA_BOX_CONTEXT)) 40 #define GTK_IS_CELL_AREA_BOX_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_AREA_BOX_CONTEXT)) 41 #define GTK_CELL_AREA_BOX_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_AREA_BOX_CONTEXT, GtkCellAreaBoxContextClass)) 42 43 typedef struct _GtkCellAreaBoxContext GtkCellAreaBoxContext; 44 typedef struct _GtkCellAreaBoxContextClass GtkCellAreaBoxContextClass; 45 typedef struct _GtkCellAreaBoxContextPrivate GtkCellAreaBoxContextPrivate; 46 47 struct _GtkCellAreaBoxContext 48 { 49 GtkCellAreaContext parent_instance; 50 51 GtkCellAreaBoxContextPrivate *priv; 52 }; 53 54 struct _GtkCellAreaBoxContextClass 55 { 56 GtkCellAreaContextClass parent_class; 57 58 }; 59 60 GType _gtk_cell_area_box_context_get_type (void) G_GNUC_CONST; 61 62 63 /* Create a duplicate of the context */ 64 GtkCellAreaBoxContext *_gtk_cell_area_box_context_copy (GtkCellAreaBox *box, 65 GtkCellAreaBoxContext *box_context); 66 67 /* Initialize group array dimensions */ 68 void _gtk_cell_area_box_init_groups (GtkCellAreaBoxContext *box_context, 69 guint n_groups, 70 gboolean *expand_groups, 71 gboolean *align_groups); 72 73 /* Update cell-group sizes */ 74 void _gtk_cell_area_box_context_push_group_width (GtkCellAreaBoxContext *box_context, 75 gint group_idx, 76 gint minimum_width, 77 gint natural_width); 78 79 void _gtk_cell_area_box_context_push_group_height_for_width (GtkCellAreaBoxContext *box_context, 80 gint group_idx, 81 gint for_width, 82 gint minimum_height, 83 gint natural_height); 84 85 void _gtk_cell_area_box_context_push_group_height (GtkCellAreaBoxContext *box_context, 86 gint group_idx, 87 gint minimum_height, 88 gint natural_height); 89 90 void _gtk_cell_area_box_context_push_group_width_for_height (GtkCellAreaBoxContext *box_context, 91 gint group_idx, 92 gint for_height, 93 gint minimum_width, 94 gint natural_width); 95 96 /* Fetch cell-group sizes */ 97 void _gtk_cell_area_box_context_get_group_width (GtkCellAreaBoxContext *box_context, 98 gint group_idx, 99 gint *minimum_width, 100 gint *natural_width); 101 102 void _gtk_cell_area_box_context_get_group_height_for_width (GtkCellAreaBoxContext *box_context, 103 gint group_idx, 104 gint for_width, 105 gint *minimum_height, 106 gint *natural_height); 107 108 void _gtk_cell_area_box_context_get_group_height (GtkCellAreaBoxContext *box_context, 109 gint group_idx, 110 gint *minimum_height, 111 gint *natural_height); 112 113 void _gtk_cell_area_box_context_get_group_width_for_height (GtkCellAreaBoxContext *box_context, 114 gint group_idx, 115 gint for_height, 116 gint *minimum_width, 117 gint *natural_width); 118 119 GtkRequestedSize *_gtk_cell_area_box_context_get_widths (GtkCellAreaBoxContext *box_context, 120 gint *n_widths); 121 GtkRequestedSize *_gtk_cell_area_box_context_get_heights (GtkCellAreaBoxContext *box_context, 122 gint *n_heights); 123 124 /* Private context/area interaction */ 125 typedef struct { 126 gint group_idx; /* Groups containing only invisible cells are not allocated */ 127 gint position; /* Relative group allocation position in the orientation of the box */ 128 gint size; /* Full allocated size of the cells in this group spacing inclusive */ 129 } GtkCellAreaBoxAllocation; 130 131 GtkCellAreaBoxAllocation * 132 _gtk_cell_area_box_context_get_orientation_allocs (GtkCellAreaBoxContext *context, 133 gint *n_allocs); 134 135 G_END_DECLS 136 137 #endif /* __GTK_CELL_AREA_BOX_CONTEXT_H__ */ 138