![]() |
![]() |
![]() |
Gwyddion Widgets Library Reference Manual | ![]() |
---|
GwyNullStoreGwyNullStore — GtkTreeModel wrapper around nothing |
GwyNullStore; GwyNullStoreClass; GwyNullStore* gwy_null_store_new (guint n); guint gwy_null_store_get_n_rows (GwyNullStore *store); void gwy_null_store_set_n_rows (GwyNullStore *store, guint n); void gwy_null_store_row_changed (GwyNullStore *store, guint i); gboolean gwy_null_store_iter_is_valid (GwyNullStore *store, GtkTreeIter *iter);
GwyNullStore is a very simple class which pretends to be a GtkTreeModel
with one column of type G_TYPE_UINT
whose values are equal to row numbers
(counted from 0). In reality the column is purely virtual and the store
always takes up only a small constant amount of memory.
The purpose of GwyNullStore is to provide a low-overhead GtkTreeModel interface for array-like (and other indexed) data structures.
A new null store can be created with gwy_null_store_new()
, then number of
virtual rows can be controlled with gwy_null_store_set_n_rows()
. For
convenience, a method to emit "row-changed" signal on a row by its index is
provided: gwy_null_store_row_changed()
.
GwyNullStore* gwy_null_store_new (guint n);
Creates a new GtkTreeModel wrapper around nothing.
n : |
The initial number of rows. |
Returns : | The newly created null store. |
guint gwy_null_store_get_n_rows (GwyNullStore *store);
Gets the number of imaginary rows in a null store.
This is a convenience function, the same information can be obtained with
gtk_tree_model_iter_n_children()
.
store : |
A null store. |
Returns : | The number of rows. |
void gwy_null_store_set_n_rows (GwyNullStore *store, guint n);
Sets the number of imaginary rows in a null store.
If the new number of rows is larger than the current one, rows will be sequentially and virtually appended to the end of the store until the requested number of rows is reached.
Similarly, if the new number of rows is smaller then the current one, rows will be sequentially and virtually deleted from the end of the store until the requested number of rows is reached.
Note for radical changes it is usually more useful to disconnect the model from its view(s), change the number of rows, and then reconnect.
store : |
A null store. |
n : |
The new number of rows. |
void gwy_null_store_row_changed (GwyNullStore *store, guint i);
Emits "GtkTreeModel::row-changed" signal on a null store.
This is a convenience method, with a bit more work the same effect can be
achieved with gtk_tree_model_row_changed()
.
store : |
A null store. |
i : |
A row to emit "row-changed" on. |
gboolean gwy_null_store_iter_is_valid (GwyNullStore *store, GtkTreeIter *iter);
Checks if the given iter is a valid iter for this null store.
store : |
A null store. |
iter : |
A GtkTreeIter. |
Returns : | TRUE if the iter is valid, FALSE if the iter is invalid.
|
<< GwyInventoryStore | Widget Utilities >> |