GwyInventoryStore — GtkTreeModel wrapper around GwyInventory
GwyInventoryStore * | gwy_inventory_store_new () |
GwyInventory * | gwy_inventory_store_get_inventory () |
gint | gwy_inventory_store_get_column_by_name () |
gboolean | gwy_inventory_store_get_iter () |
gboolean | gwy_inventory_store_iter_is_valid () |
struct | GwyInventoryStore |
struct | GwyInventoryStoreClass |
GObject ╰── GwyInventoryStore
GwyInventoryStore implements GtkTreeModel.
#include <libgwydgets/gwydgets.h>
GwyInventoryStore is a simple adaptor class that wraps GwyInventory in GtkTreeModel interface. It is list-only and has persistent iterators. It offers no methods to manipulate items, this should be done on the underlying inventory.
GwyInventoryStore maps inventory item traits to virtual GtkTreeModel columns. Zeroth column is always of type
G_TYPE_POINTER
and contains item itself. It exists even if item don't export any traits. Columns from 1 onward
are formed by item traits. You can obtain column id of a named item trait with
gwy_inventory_store_get_column_by_name()
.
GwyInventoryStore *
gwy_inventory_store_new (GwyInventory *inventory
);
Creates a new GtkTreeModel wrapper around a GwyInventory.
inventory |
An inventory. |
The newly created inventory store.
GwyInventory *
gwy_inventory_store_get_inventory (GwyInventoryStore *store
);
Gets the inventory a inventory store wraps.
store |
An inventory store. |
The underlying inventory (its reference count is not increased).
gint gwy_inventory_store_get_column_by_name (GwyInventoryStore *store
,const gchar *name
);
Gets tree model column corresponding to a trait name.
The underlying inventory must support trait names, except for name
"item"
which always works
(and always maps to 0).
store |
An inventory store. |
|
name |
Trait (column) name. |
The underlying inventory (its reference count is not increased).
gboolean gwy_inventory_store_get_iter (GwyInventoryStore *store
,const gchar *name
,GtkTreeIter *iter
);
Initializes a tree iterator to row corresponding to a inventory item.
store |
An inventory store. |
|
name |
Item name. |
|
iter |
Tree iterator to set to point to item named |
TRUE
if iter
is valid, that is the item exists, FALSE
if iter
was not set.
gboolean gwy_inventory_store_iter_is_valid (GwyInventoryStore *store
,GtkTreeIter *iter
);
Checks if the given iter is a valid iter for this inventory store.
store |
An inventory store. |
|
iter |
A GtkTreeIter. |
TRUE
if the iter is valid, FALSE
if the iter is invalid.
struct GwyInventoryStore;
struct GwyInventoryStoreClass { GObjectClass parent_class; void (*reserved1)(void); };
GwyInventory -- the actual data container, GtkListStore, GtkTreeStore -- Gtk+ tree model implementations