Commit fb598354 authored by Kristian Rietveld's avatar Kristian Rietveld Committed by Kristian Rietveld

add getter/setter for show-expanders property, queue a redraw when this

2006-10-08  Kristian Rietveld  <kris@gtk.org>

	* gtk/gtktreeview.[ch] (gtk_tree_view_set_property),
	(gtk_tree_view_set_show_expanders),
	(gtk_tree_view_get_show_expanders): add getter/setter for
	show-expanders property, queue a redraw when this property
	is toggled (#351167, Martin Ejdestig),
	(gtk_tree_view_set_level_indentation),
	(gtk_tree_view_get_level_indentation): also add getter/setter
	and docs for level-indentation property.
parent 7d5ca7dd
2006-10-08 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.[ch] (gtk_tree_view_set_property),
(gtk_tree_view_set_show_expanders),
(gtk_tree_view_get_show_expanders): add getter/setter for
show-expanders property, queue a redraw when this property
is toggled (#351167, Martin Ejdestig),
(gtk_tree_view_set_level_indentation),
(gtk_tree_view_get_level_indentation): also add getter/setter
and docs for level-indentation property.
2006-10-08 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkradiobutton.c (gtk_radio_button_focus): Don't
......
......@@ -1370,10 +1370,7 @@ gtk_tree_view_set_property (GObject *object,
tree_view->priv->hover_expand = g_value_get_boolean (value);
break;
case PROP_SHOW_EXPANDERS:
if (g_value_get_boolean (value))
GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_SHOW_EXPANDERS);
else
GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_SHOW_EXPANDERS);
gtk_tree_view_set_show_expanders (tree_view, g_value_get_boolean (value));
break;
case PROP_LEVEL_INDENTATION:
tree_view->priv->level_indentation = g_value_get_int (value);
......@@ -14743,5 +14740,102 @@ gtk_tree_view_set_enable_tree_lines (GtkTreeView *tree_view,
}
}
/**
* gtk_tree_view_set_show_expanders:
* @tree_view: a #GtkTreeView
* @enabled: %TRUE to enable expander drawing, %FALSE otherwise.
*
* Sets whether to draw and enable expanders and indent child rows in
* @tree_view. When disabled there will be no expanders visible in trees
* and there will be no way to expand and collapse rows by default. Also
* note that hiding the expanders will disable the default indentation. You
* can set a custom indentation in this case using
* gtk_tree_view_set_level_indentation().
* This does not have any visible effects for lists.
*
* Since: 2.12
*/
void
gtk_tree_view_set_show_expanders (GtkTreeView *tree_view,
gboolean enabled)
{
gboolean was_enabled;
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
enabled = enabled != FALSE;
was_enabled = GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_SHOW_EXPANDERS);
if (enabled)
GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_SHOW_EXPANDERS);
else
GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_SHOW_EXPANDERS);
if (was_enabled != was_enabled)
gtk_widget_queue_draw (GTK_WIDGET (tree_view));
}
/**
* gtk_tree_view_get_show_expanders:
* @tree_view: a #GtkTreeView.
*
* Returns whether or not expanders are drawn in @tree_view.
*
* Return value: %TRUE if expanders are drawn in @tree_view, %FALSE
* otherwise.
*
* Since: 2.12
*/
gboolean
gtk_tree_view_get_show_expanders (GtkTreeView *tree_view)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), FALSE);
return GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_SHOW_EXPANDERS);
}
/**
* gtk_tree_view_set_level_indentation:
* @tree_view: a #GtkTreeView
* @indentation: the amount, in pixels, of extra indentation in @tree_view.
*
* Sets the amount of extra indentation for child levels to use in @tree_view
* in addition to the default indentation. The value should be specified in
* pixels, a value of 0 disables this feature and in this case only the default
* indentation will be used.
* This does not have any visible effects for lists.
*
* Since: 2.12
*/
void
gtk_tree_view_set_level_indentation (GtkTreeView *tree_view,
gint indentation)
{
tree_view->priv->level_indentation = indentation;
gtk_widget_queue_draw (GTK_WIDGET (tree_view));
}
/**
* gtk_tree_view_get_level_indentation:
* @tree_view: a #GtkTreeView.
*
* Returns the amount, in pixels, of extra indentation for child levels
* in @tree_view.
*
* Return value: the amount of extra indentation for child levels in
* @tree_view. A return value of 0 means that this feature is disabled.
*
* Since: 2.12
*/
gint
gtk_tree_view_get_level_indentation (GtkTreeView *tree_view)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), 0);
return tree_view->priv->level_indentation;
}
#define __GTK_TREE_VIEW_C__
#include "gtkaliasdef.c"
......@@ -358,6 +358,12 @@ void gtk_tree_view_set_grid_lines (GtkTreeView
gboolean gtk_tree_view_get_enable_tree_lines (GtkTreeView *tree_view);
void gtk_tree_view_set_enable_tree_lines (GtkTreeView *tree_view,
gboolean enabled);
void gtk_tree_view_set_show_expanders (GtkTreeView *tree_view,
gboolean enabled);
gboolean gtk_tree_view_get_show_expanders (GtkTreeView *tree_view);
void gtk_tree_view_set_level_indentation (GtkTreeView *tree_view,
gint indentation);
gint gtk_tree_view_get_level_indentation (GtkTreeView *tree_view);
G_END_DECLS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment