A list-like data structure that can be used with the GtkTreeView
Class GtkListStore( types )
types | an array of GType |
The GtkListStore object is a list model for use with a GtkTreeView widget. It implements the GtkTreeModel interface, and consequentialy, can use all of the methods available there. It also implements the GtkTreeSortable interface so it can be sorted by the view. Finally, it also implements the tree drag and drop interfaces.
The GtkListStore can accept most GObject types as a column type, though it can't accept all custom types. Internally, it will keep a copy of data passed in (such as a string or a boxed pointer). Columns that accept GObject s are handled a little differently. The GtkListStore will keep a reference to the object instead of copying the value. As a result, if the object is modified, it is up to the application writer to call gtk_tree_model_row_changed to emit the "row_changed" signal. This most commonly affects lists with GdkPixbufs stored.
[...]
Methods | |
append | Appends a new row to list_store. |
clear | Removes all rows from the list store. |
insert | Creates a new row at position. |
insert_after | Inserts a new row after sibling. |
insert_before | Inserts a new row before sibling. |
insert_with_values | Creates a new row at position. |
iter_is_valid | Checks if the given iter is a valid iter for this GtkListStore. |
move_after | Moves iter in store to the position after position. |
move_before | Moves iter in store to the position before position. |
prepend | Prepends a new row to list_store. |
remove | Removes the given row from the list store. |
reorder | Reorders store to follow the order indicated by new_order. |
set | Sets the value of one or more cells in the row referenced by iter. |
set_column_types | Sets the column types. |
set_value | Sets the data in the cell specified by iter and column. |
swap | Swaps a and b in store. Note that this function only works with unsorted stores. |
Appends a new row to list_store.
GtkListStore.append()
iter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call gtk_list_store_set() or gtk_list_store_set_value().
Removes all rows from the list store.
GtkListStore.clear()
Creates a new row at position.
GtkListStore.insert( iter, position )
iter | An unset GtkTreeIter to set to the new row |
position | position to insert the new row |
iter will be changed to point to this new row. If position is larger than the number of rows on the list, then the new row will be appended to the list. The row will be empty after this function is called. To fill in values, you need to call gtk_list_store_set() or gtk_list_store_set_value().
Inserts a new row after sibling.
GtkListStore.insert_after( iter, sibling )
iter | An unset GtkTreeIter to set to the new row |
sibling | A valid GtkTreeIter, or NULL. |
If sibling is NULL, then the row will be prepended to the beginning of the list. iter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call gtk_list_store_set() or gtk_list_store_set_value().
Inserts a new row before sibling.
GtkListStore.insert_before( iter, sibling )
iter | An unset GtkTreeIter to set to the new row |
sibling | A valid GtkTreeIter, or NULL. |
If sibling is NULL, then the row will be appended to the end of the list. iter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call gtk_list_store_set() or gtk_list_store_set_value().
Creates a new row at position.
GtkListStore.insert_with_values( iter, pos, values )
iter | An unset GtkTreeIter to set to the new row, or NULL. |
pos | position to insert the new row |
values | an array of pairs [ column index, column value, ... ] |
iter will be changed to point to this new row. If position is larger than the number of rows on the list, then the new row will be appended to the list. The row will be filled with the values given to this function.
Checks if the given iter is a valid iter for this GtkListStore.
GtkListStore.iter_is_valid( iter )
iter | a GtkTreeIter |
Return | TRUE if the iter is valid, FALSE if the iter is invalid. |
Warning: This function is slow. Only use it for debugging and/or testing purposes.
Moves iter in store to the position after position.
GtkListStore.move_after( iter, position )
iter | A GtkTreeIter. |
position | A GtkTreeIter, or NULL. |
Note that this function only works with unsorted stores. If position is NULL, iter will be moved to the start of the list.
Moves iter in store to the position before position.
GtkListStore.move_before( iter, position )
iter | A GtkTreeIter. |
position | A GtkTreeIter, or NULL. |
Note that this function only works with unsorted stores. If position is NULL, iter will be moved to the end of the list.
Prepends a new row to list_store.
GtkListStore.prepend( iter )
iter | An unset GtkTreeIter to set to the prepend row |
iter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call gtk_list_store_set() or gtk_list_store_set_value().
Removes the given row from the list store.
GtkListStore.remove( iter )
iter | A valid GtkTreeIter |
Return | TRUE if iter is valid, FALSE if not. |
After being removed, iter is set to be the next valid row, or invalidated if it pointed to the last row in list_store.
Reorders store to follow the order indicated by new_order.
GtkListStore.reorder( new_order )
new_order | an array of integers mapping the new position of each child to its old position before the re-ordering, i.e. new_order[newpos] = oldpos. |
Note that this function only works with unsorted stores.
Sets the value of one or more cells in the row referenced by iter.
GtkListStore.set( iter, values )
iter | row iterator (GtkTreeIter) |
values | an array of pairs [ column index, column value, ... ] |
The array should contain integer column numbers, each column number followed by the value to be set. For example, to set column 0 with type G_TYPE_STRING to "Foo", you would write gtk_list_store_set ( iter, [ 0, "Foo" ] ).
Sets the column types.
GtkListStore.set_column_types( types )
types | an array of GType |
This function is meant primarily for GObjects that inherit from GtkListStore, and should only be used when constructing a new GtkListStore.
It will not function after a row has been added, or a method on the GtkTreeModel interface is called.
Sets the data in the cell specified by iter and column.
GtkListStore.set_value( iter, column, value )
iter | A valid GtkTreeIter for the row being modified |
column | column number to modify |
value | new value for the cell |
The type of value must be convertible to the type of the column.
Swaps a and b in store. Note that this function only works with unsorted stores.
GtkListStore.swap( a, b )
a | A GtkTreeIter. |
b | Another GtkTreeIter. |