summaryrefslogtreecommitdiff
path: root/gtk/gtktreeviewcolumn.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2011-06-10 00:09:25 -0400
committerMatthias Clasen <mclasen@redhat.com>2011-06-10 00:17:56 -0400
commiteeca20a800be92ef322473d1a065d5d1f8351449 (patch)
tree7ac904de7046b10fb9660fd5046bc940bd79acfb /gtk/gtktreeviewcolumn.c
parent9e5d6544ba3703a63a7dfc40ca9bd1590dda5c42 (diff)
downloadgtk+-eeca20a800be92ef322473d1a065d5d1f8351449.tar.gz
Add API to get x position of treeview columns
Their width was already available.
Diffstat (limited to 'gtk/gtktreeviewcolumn.c')
-rw-r--r--gtk/gtktreeviewcolumn.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c
index bd8cebe18e..c97f8e55d3 100644
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@ -142,6 +142,7 @@ struct _GtkTreeViewColumnPrivate
GtkTreeViewColumnSizing column_type;
gint padding;
gint resized_width;
+ gint x_offset;
gint width;
gint fixed_width;
gint min_width;
@@ -183,6 +184,7 @@ enum
PROP_0,
PROP_VISIBLE,
PROP_RESIZABLE,
+ PROP_X_OFFSET,
PROP_WIDTH,
PROP_SPACING,
PROP_SIZING,
@@ -257,6 +259,16 @@ gtk_tree_view_column_class_init (GtkTreeViewColumnClass *class)
GTK_PARAM_READWRITE));
g_object_class_install_property (object_class,
+ PROP_X_OFFSET,
+ g_param_spec_int ("x-offset",
+ P_("X position"),
+ P_("Current X position of the column"),
+ -G_MAXINT,
+ G_MAXINT,
+ 0,
+ GTK_PARAM_READABLE));
+
+ g_object_class_install_property (object_class,
PROP_WIDTH,
g_param_spec_int ("width",
P_("Width"),
@@ -687,6 +699,11 @@ gtk_tree_view_column_get_property (GObject *object,
gtk_tree_view_column_get_resizable (tree_column));
break;
+ case PROP_X_OFFSET:
+ g_value_set_int (value,
+ gtk_tree_view_column_get_x_offset (tree_column));
+ break;
+
case PROP_WIDTH:
g_value_set_int (value,
gtk_tree_view_column_get_width (tree_column));
@@ -2049,6 +2066,24 @@ gtk_tree_view_column_get_width (GtkTreeViewColumn *tree_column)
return tree_column->priv->width;
}
+/**
+ * gtk_tree_view_column_get_x_offset:
+ * @tree_column: A #GtkTreeViewColumn.
+ *
+ * Returns the current X offset of @tree_column in pixels.
+ *
+ * Return value: The current X offset of @tree_column.
+ *
+ * Since: 3.2
+ */
+gint
+gtk_tree_view_column_get_x_offset (GtkTreeViewColumn *tree_column)
+{
+ g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), 0);
+
+ return tree_column->priv->x_offset;
+}
+
gint
_gtk_tree_view_column_request_width (GtkTreeViewColumn *tree_column)
{
@@ -2113,6 +2148,7 @@ _gtk_tree_view_column_allocate (GtkTreeViewColumn *tree_column,
if (priv->width != width)
gtk_widget_queue_draw (priv->tree_view);
+ priv->x_offset = x_offset;
priv->width = width;
gtk_cell_area_context_allocate (priv->cell_area_context, priv->width - priv->padding, -1);
@@ -2136,6 +2172,7 @@ _gtk_tree_view_column_allocate (GtkTreeViewColumn *tree_column,
TREE_VIEW_DRAG_WIDTH, allocation.height);
}
+ g_object_notify (G_OBJECT (tree_column), "x-offset");
g_object_notify (G_OBJECT (tree_column), "width");
}