2 #include <eris/types.hpp> 3 #include "creativity/gui/MemberStore.hpp" 4 #include "creativity/state/State.hpp" 8 #include <glibmm/object.h> 9 #include <glibmm/refptr.h> 10 #include <gtkmm/enums.h> 11 #include <gtkmm/treemodel.h> 12 #include <gtkmm/treemodelcolumn.h> 13 #include <gtkmm/treepath.h> 14 namespace Glib {
class ValueBase; }
15 namespace Gtk {
class TreeView; }
28 static Glib::RefPtr<ReaderStore> create(std::shared_ptr<const state::State> state);
34 class ColRec :
public Gtk::TreeModel::ColumnRecord {
36 Gtk::TreeModelColumn<eris::eris_id_t>
id;
37 Gtk::TreeModelColumn<double> pos_x,
43 Gtk::TreeModelColumn<std::string>
pos_str;
44 Gtk::TreeModelColumn<size_t> books_owned,
56 add(
id); add(pos_x); add(pos_y); add(pos_str); add(u); add(u_lifetime);
57 add(creation_shape); add(creation_scale); add(num_friends);
58 add(books_owned); add(books_purchased); add(books_pirated);
59 add(books_new); add(books_new_purchased); add(books_new_pirated);
60 add(books_written); add(last_book_age);
71 void appendColumnsTo(Gtk::TreeView &v)
const override;
75 ReaderStore(std::shared_ptr<const state::State> &&state);
82 virtual GType get_column_type_vfunc(
int index)
const override;
85 virtual int get_n_columns_vfunc()
const override;
94 virtual void get_value_vfunc(
const iterator &iter,
int column, Glib::ValueBase &value)
const override;
109 virtual void set_sort_column_id_vfunc(
int sort_column_id, Gtk::SortType order)
override;
114 #define LESS_GREATER_METHODS(col) \ 115 static bool less_##col(const state::ReaderState &a, const state::ReaderState &b); \ 116 static bool greater_##col(const state::ReaderState &a, const state::ReaderState &b); 117 LESS_GREATER_METHODS(
id)
118 LESS_GREATER_METHODS(pos_x)
119 LESS_GREATER_METHODS(pos_y)
120 LESS_GREATER_METHODS(pos_str)
121 LESS_GREATER_METHODS(u)
122 LESS_GREATER_METHODS(u_lifetime)
123 LESS_GREATER_METHODS(creation_shape)
124 LESS_GREATER_METHODS(creation_scale)
125 LESS_GREATER_METHODS(books_owned)
126 LESS_GREATER_METHODS(books_purchased)
128 LESS_GREATER_METHODS(books_new)
129 LESS_GREATER_METHODS(books_new_purchased)
130 LESS_GREATER_METHODS(books_new_pirated)
131 LESS_GREATER_METHODS(books_written)
132 LESS_GREATER_METHODS(num_friends)
133 #undef LESS_GREATER_METHODS Definition: BookStore.hpp:14
Records the various variables associated with a reader.
Definition: ReaderState.hpp:18
Primary namespace for all Creativity library code.
Definition: config.hpp:4
Definition: BookInfoWindow.hpp:6
Base class for a flat list of simulation members.
Definition: MemberStore.hpp:21
Gtk::TreeModelColumn< size_t > num_friends
Number of friends of this reader.
Definition: ReaderStore.hpp:44
Gtk::TreeModelColumn< double > u_lifetime
Cumulative lifetime utility of the reader.
Definition: ReaderStore.hpp:37
Gtk::TreeModelColumn< eris::eris_id_t > id
ID of the reader.
Definition: ReaderStore.hpp:36
Gtk::TreeModelColumn< std::string > pos_str
position of the book as a string such as (-7.16,0.440)
Definition: ReaderStore.hpp:43
double books_pirated(const state::Storage &cs, eris::eris_time_t from, eris::eris_time_t to)
Average number of books pirated per reader per period.
Gtk::TreeModel::ColumnRecord subclass for handling Reader information in the list of readers in the m...
Definition: ReaderStore.hpp:22
ColumnRecord object for a ReaderStore.
Definition: ReaderStore.hpp:34
ColRec columns
The columns of this ReaderStore.
Definition: ReaderStore.hpp:68