2 #include "creativity/gui/MemberStore.hpp" 3 #include "creativity/state/BookState.hpp" 4 #include <eris/types.hpp> 5 #include <glibmm/object.h> 6 #include <glibmm/refptr.h> 7 #include <gtkmm/enums.h> 8 #include <gtkmm/treemodel.h> 9 #include <gtkmm/treemodelcolumn.h> 10 #include <gtkmm/treepath.h> 14 namespace Glib {
class ValueBase; }
15 namespace Gtk {
class TreeView; }
16 namespace creativity {
namespace state {
class State; } }
59 static Glib::RefPtr<BookStore> create(std::shared_ptr<const state::State> state, eris::eris_id_t author = 0);
65 class ColRec :
public Gtk::TreeModel::ColumnRecord {
67 Gtk::TreeModelColumn<eris::eris_id_t>
71 Gtk::TreeModelColumn<double>
79 Gtk::TreeModelColumn<std::string>
83 Gtk::TreeModelColumn<bool>
88 Gtk::TreeModelColumn<unsigned int>
92 sales_lifetime_private,
103 add(
id); add(author);
104 add(pos_x); add(pos_y); add(quality); add(price); add(revenue); add(revenue_lifetime);
106 add(market_private); add(market_public); add(market_any); add(market_str);
107 add(age); add(created); add(sales); add(sales_lifetime_private); add(sales_lifetime_public);
108 add(sales_lifetime); add(pirated); add(pirated_lifetime);
109 add(copies); add(copies_lifetime); add(lifetime_private);
117 std::unique_ptr<ColRec> columns{
new ColRec};
120 virtual void appendColumnsTo(Gtk::TreeView &v)
const override;
124 BookStore(std::shared_ptr<const state::State> &&state, eris::eris_id_t author);
127 BookStore(std::shared_ptr<const state::State> &&state, eris::eris_id_t author, std::unique_ptr<ColRec> &&cols);
133 BookStore(std::shared_ptr<const state::State> &&state, std::unique_ptr<ColRec> &&cols);
140 void initializeBooks();
143 virtual int get_n_columns_vfunc()
const override;
150 virtual GType get_column_type_vfunc(
int index)
const override;
159 virtual void get_value_vfunc(
const iterator &iter,
int column, Glib::ValueBase &value)
const override;
174 virtual void set_sort_column_id_vfunc(
int sort_column_id, Gtk::SortType order)
override;
180 const eris::eris_id_t author_ = 0;
183 #define LESS_GREATER_METHODS(col) \ 184 static bool less_##col(const state::BookState &a, const state::BookState &b); \ 185 static bool greater_##col(const state::BookState &a, const state::BookState &b); 186 LESS_GREATER_METHODS(
id)
187 LESS_GREATER_METHODS(author)
188 LESS_GREATER_METHODS(pos_x)
189 LESS_GREATER_METHODS(pos_y)
190 LESS_GREATER_METHODS(quality)
191 LESS_GREATER_METHODS(price)
192 LESS_GREATER_METHODS(revenue)
193 LESS_GREATER_METHODS(revenue_lifetime)
194 LESS_GREATER_METHODS(pos_str)
195 LESS_GREATER_METHODS(market_str)
196 LESS_GREATER_METHODS(market_private)
197 LESS_GREATER_METHODS(market_public)
198 LESS_GREATER_METHODS(market_any)
199 LESS_GREATER_METHODS(age)
200 LESS_GREATER_METHODS(created)
201 LESS_GREATER_METHODS(sales)
202 LESS_GREATER_METHODS(sales_lifetime_private)
203 LESS_GREATER_METHODS(sales_lifetime_public)
204 LESS_GREATER_METHODS(sales_lifetime)
205 LESS_GREATER_METHODS(pirated)
206 LESS_GREATER_METHODS(pirated_lifetime)
207 LESS_GREATER_METHODS(copies)
208 LESS_GREATER_METHODS(copies_lifetime)
209 LESS_GREATER_METHODS(lifetime_private)
210 #undef LESS_GREATER_METHODS Gtk::TreeModel::ColumnRecord subclass for handling Book information in the list of books in the main ...
Definition: BookStore.hpp:24
Definition: BookStore.hpp:14
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< bool > market_public
True if on the market and that market is public.
Definition: BookStore.hpp:84
Gtk::TreeModelColumn< std::string > pos_str
position of the book as a string such as (-7.16,0.440)
Definition: BookStore.hpp:80
Gtk::TreeModelColumn< unsigned int > sales_lifetime_public
Lifetime copies sold on the public market.
Definition: BookStore.hpp:89
ColumnRecord object for a BookStore.
Definition: BookStore.hpp:65
Gtk::TreeModelColumn< double > revenue_lifetime
Cumulative revenue of the book since its creation.
Definition: BookStore.hpp:72
Gtk::TreeModelColumn< eris::eris_id_t > id
Book ID.
Definition: BookStore.hpp:68