11.81Class GtkListStore

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
appendAppends a new row to list_store.
clearRemoves all rows from the list store.
insertCreates a new row at position.
insert_afterInserts a new row after sibling.
insert_beforeInserts a new row before sibling.
insert_with_valuesCreates a new row at position.
iter_is_validChecks if the given iter is a valid iter for this GtkListStore.
move_afterMoves iter in store to the position after position.
move_beforeMoves iter in store to the position before position.
prependPrepends a new row to list_store.
removeRemoves the given row from the list store.
reorderReorders store to follow the order indicated by new_order.
setSets the value of one or more cells in the row referenced by iter.
set_column_typesSets the column types.
set_valueSets the data in the cell specified by iter and column.
swapSwaps a and b in store. Note that this function only works with unsorted stores.

Methods

append

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().

clear

Removes all rows from the list store.

GtkListStore.clear()

insert

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().

insert_after

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().

insert_before

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().

insert_with_values

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.

iter_is_valid

Checks if the given iter is a valid iter for this GtkListStore.

GtkListStore.iter_is_valid( iter )
iter a GtkTreeIter
ReturnTRUE 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.

move_after

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.

move_before

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.

prepend

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().

remove

Removes the given row from the list store.

GtkListStore.remove( iter )
iter A valid GtkTreeIter
ReturnTRUE 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.

reorder

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.

set

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" ] ).

set_column_types

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.

set_value

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.

swap

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.
Made with http://www.falconpl.org