/* For the inventory list */ class ModelColumns : public Gtk::TreeModel::ColumnRecord { public: ModelColumns(void) { add(name); add(obj); add(order); } Gtk::TreeModelColumn<Glib::ustring> name; Gtk::TreeModelColumn< Pointer<Object> > obj; Gtk::TreeModelColumn<unsigned int> order; } modelColumns; Gtk::TreeView treeView; Glib::RefPtr<Gtk::TreeStore> treeStore; Gtk::TreeModel::Row weapons, armor, food, potions, scrolls, spellbooks, rings, wands, tools, amulets, gems; Gtk::Window invWindow; Gtk::ScrolledWindow invSWindow;
/* Inventory Window */ treeStore = Gtk::TreeStore::create(modelColumns); treeView.set_model(treeStore); treeView.append_column("Name", modelColumns.name); treeView.get_column(0)->set_sort_column(modelColumns.order); invSWindow.add(treeView); invWindow.add(invSWindow); invWindow.show_all(); invWindow.set_title("Interhack Inventory");
/* Setup basic groups in inventory window */ weapons = *(treeStore->append()); weapons[modelColumns.name] = "Weapons ("; weapons[modelColumns.order] = 0; armor = *(treeStore->append()); armor[modelColumns.name] = "Armor ["; armor[modelColumns.order] = 1;
Gtk::TreeModel::Row row = *(treeStore->append(spellbooks.children()));row[modelColumns.name] = "something";