summaryrefslogtreecommitdiff
path: root/gtk/gtkcellareabox.c
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2010-12-13 00:18:00 +0900
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2010-12-13 00:29:21 +0900
commit0431dd67f82def7af57119b27bcc4dea0b7a2167 (patch)
tree94dceaea7c9f8b34b5674aacc98dd0e663ba838c /gtk/gtkcellareabox.c
parentff39c76bfd9ea882c80c60313b594cf73035fa6e (diff)
downloadgtk+-0431dd67f82def7af57119b27bcc4dea0b7a2167.tar.gz
Added apis to GtkCellArea for GtkIconView purposes.
Added a few apis, - GtkCellAreaContext get_preferred_height_for_width & width for height apis and vfuncs, this lets the icon view request the collective (and aligned) height for width for a said row. - gtk_cell_area_copy_context() this creates a duplicate of an already created and requested context, this way the icon view uses a global context to request the widths of all rows and then makes a copy with all the stored alignments and uses a separate copy to calculate the height and alignments of each row separately.
Diffstat (limited to 'gtk/gtkcellareabox.c')
-rw-r--r--gtk/gtkcellareabox.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gtk/gtkcellareabox.c b/gtk/gtkcellareabox.c
index 286c67096d..56a856bf6a 100644
--- a/gtk/gtkcellareabox.c
+++ b/gtk/gtkcellareabox.c
@@ -92,6 +92,8 @@ static void gtk_cell_area_box_get_cell_property (GtkCellArea
GValue *value,
GParamSpec *pspec);
static GtkCellAreaContext *gtk_cell_area_box_create_context (GtkCellArea *area);
+static GtkCellAreaContext *gtk_cell_area_box_copy_context (GtkCellArea *area,
+ GtkCellAreaContext *context);
static GtkSizeRequestMode gtk_cell_area_box_get_request_mode (GtkCellArea *area);
static void gtk_cell_area_box_get_preferred_width (GtkCellArea *area,
GtkCellAreaContext *context,
@@ -273,6 +275,7 @@ gtk_cell_area_box_class_init (GtkCellAreaBoxClass *class)
area_class->get_cell_property = gtk_cell_area_box_get_cell_property;
area_class->create_context = gtk_cell_area_box_create_context;
+ area_class->copy_context = gtk_cell_area_box_copy_context;
area_class->get_request_mode = gtk_cell_area_box_get_request_mode;
area_class->get_preferred_width = gtk_cell_area_box_get_preferred_width;
area_class->get_preferred_height = gtk_cell_area_box_get_preferred_height;
@@ -1301,6 +1304,23 @@ gtk_cell_area_box_create_context (GtkCellArea *area)
return context;
}
+static GtkCellAreaContext *
+gtk_cell_area_box_copy_context (GtkCellArea *area,
+ GtkCellAreaContext *context)
+{
+ GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area);
+ GtkCellAreaBoxPrivate *priv = box->priv;
+ GtkCellAreaContext *copy =
+ (GtkCellAreaContext *)gtk_cell_area_box_context_copy (GTK_CELL_AREA_BOX (area),
+ GTK_CELL_AREA_BOX_CONTEXT (context));
+
+ priv->contexts = g_slist_prepend (priv->contexts, copy);
+
+ g_object_weak_ref (G_OBJECT (copy), (GWeakNotify)context_weak_notify, box);
+
+ return copy;
+}
+
static GtkSizeRequestMode
gtk_cell_area_box_get_request_mode (GtkCellArea *area)
{