New function to set the active row by iter.

Tue Oct 14 16:10:21 2003  Jonathan Blandford  <jrb@redhat.com>

	* gtk/gtkcombobox.c (gtk_combo_box_set_active_iter): New function
	to set the active row by iter.

	* gtk/gtkcombobox.c (gtk_combo_box_get_active_iter): New function
	to get the active row by iter.
This commit is contained in:
Jonathan Blandford 2003-10-14 20:09:39 +00:00 committed by Jonathan Blandford
parent e246918d1b
commit 87a1e40eb8
7 changed files with 103 additions and 0 deletions

View File

@ -1,3 +1,11 @@
Tue Oct 14 16:10:21 2003 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcombobox.c (gtk_combo_box_set_active_iter): New function
to set the active row by iter.
* gtk/gtkcombobox.c (gtk_combo_box_get_active_iter): New function
to get the active row by iter.
2003-10-13 Federico Mena Quintero <federico@ximian.com>
* gtk/gtktreeview.c (gtk_tree_view_real_collapse_row): Don't do

View File

@ -1,3 +1,11 @@
Tue Oct 14 16:10:21 2003 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcombobox.c (gtk_combo_box_set_active_iter): New function
to set the active row by iter.
* gtk/gtkcombobox.c (gtk_combo_box_get_active_iter): New function
to get the active row by iter.
2003-10-13 Federico Mena Quintero <federico@ximian.com>
* gtk/gtktreeview.c (gtk_tree_view_real_collapse_row): Don't do

View File

@ -1,3 +1,11 @@
Tue Oct 14 16:10:21 2003 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcombobox.c (gtk_combo_box_set_active_iter): New function
to set the active row by iter.
* gtk/gtkcombobox.c (gtk_combo_box_get_active_iter): New function
to get the active row by iter.
2003-10-13 Federico Mena Quintero <federico@ximian.com>
* gtk/gtktreeview.c (gtk_tree_view_real_collapse_row): Don't do

View File

@ -1,3 +1,11 @@
Tue Oct 14 16:10:21 2003 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcombobox.c (gtk_combo_box_set_active_iter): New function
to set the active row by iter.
* gtk/gtkcombobox.c (gtk_combo_box_get_active_iter): New function
to get the active row by iter.
2003-10-13 Federico Mena Quintero <federico@ximian.com>
* gtk/gtktreeview.c (gtk_tree_view_real_collapse_row): Don't do

View File

@ -1,3 +1,11 @@
Tue Oct 14 16:10:21 2003 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcombobox.c (gtk_combo_box_set_active_iter): New function
to set the active row by iter.
* gtk/gtkcombobox.c (gtk_combo_box_get_active_iter): New function
to get the active row by iter.
2003-10-13 Federico Mena Quintero <federico@ximian.com>
* gtk/gtktreeview.c (gtk_tree_view_real_collapse_row): Don't do

View File

@ -2392,6 +2392,65 @@ gtk_combo_box_set_active (GtkComboBox *combo_box,
g_signal_emit_by_name (combo_box, "changed", NULL, NULL);
}
/**
* gtk_combo_box_get_active_iter:
* @combo_box: A #GtkComboBox
* @iter: The uninitialized #GtkTreeIter.
*
* Set @iter to point to the current active item, if it exists.
*
* Return value: %TRUE, if @iter was set
*
* Since: 2.4
**/
gboolean
gtk_combo_box_get_active_iter (GtkComboBox *combo_box,
GtkTreeIter *iter)
{
GtkTreePath *path;
gint active;
gboolean retval;
g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), FALSE);
active = gtk_combo_box_get_active (combo_box);
if (active < 0)
return FALSE;
path = gtk_tree_path_new_from_indices (active, -1);
retval = gtk_tree_model_get_iter (gtk_combo_box_get_model (combo_box),
iter, path);
gtk_tree_path_free (path);
return retval;
}
/**
* gtk_combo_box_set_active_iter:
* @combo_box: A #GtkComboBox
* @iter: The #GtkTreeIter.
*
* Sets the current active item to be the one referenced by @iter.
*
* Since: 2.4
**/
void
gtk_combo_box_set_active_iter (GtkComboBox *combo_box,
GtkTreeIter *iter)
{
GtkTreePath *path;
g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
path = gtk_tree_model_get_path (gtk_combo_box_get_model (combo_box), iter);
g_return_if_fail (path != NULL);
g_return_if_fail (gtk_tree_path_get_depth (path) != 1);
gtk_combo_box_set_active (combo_box, gtk_tree_path_get_indices (path)[0]);
gtk_tree_path_free (path);
}
/**
* gtk_combo_box_get_model
* @combo_box: A #GtkComboBox.

View File

@ -70,6 +70,10 @@ void gtk_combo_box_set_column_span_column (GtkComboBox *combo_box,
gint gtk_combo_box_get_active (GtkComboBox *combo_box);
void gtk_combo_box_set_active (GtkComboBox *combo_box,
gint index);
gboolean gtk_combo_box_get_active_iter (GtkComboBox *combo_box,
GtkTreeIter *iter);
void gtk_combo_box_set_active_iter (GtkComboBox *combo_box,
GtkTreeIter *iter);
/* getters and setters */
GtkTreeModel *gtk_combo_box_get_model (GtkComboBox *combo_box);