creativity
v1.3.0
Agent-based model of creativity and piracy
|
InfoWindow subclass for displaying the details of a reader/author. More...
#include <creativity/gui/ReaderInfoWindow.hpp>
Public Member Functions | |
ReaderInfoWindow (std::shared_ptr< const state::State > state, std::shared_ptr< Gtk::Window > main_window, eris::eris_id_t reader_id, std::function< void(eris::eris_id_t)> open_info_dialog) | |
Constructs a new InfoWindow displaying reader information. More... | |
virtual void | refresh (std::shared_ptr< const state::State > state) override |
Refresh the information in the dialog using the given simulation state. More... | |
![]() | |
InfoWindow ()=delete | |
No default constructor. | |
Additional Inherited Members | |
![]() | |
const eris::eris_id_t | id |
The eris_id of the simulation object about which this dialog is displaying details. | |
![]() | |
InfoWindow (std::shared_ptr< Gtk::Window > main_window, eris::eris_id_t id, const std::string &title) | |
Creates a new InfoWindow, setting up the dialog window. More... | |
template<class T , typename = typename std::enable_if<std::is_arithmetic<T>::value>::type> | |
void | updateValue (const std::string &code, const T &val) |
Updates a single value Gtk::Label text with the given value by passing it to std::to_string. | |
void | updateValue (const std::string &code, const std::string &val) |
Updates a single value Gtk::Label text with the given string. | |
void | updateMatrix (const std::string &code, const Eigen::Ref< const Eigen::MatrixXd > &m, bool lower_triangle=false) |
Updates a matrix set up with matrix_at with the values of the given matrix. More... | |
void | clearMatrix (const std::string &code, const std::string &value="") |
Clears all values of a matrix set up with matrix_at, setting all values to the given value (defaulting to an empty string). | |
Gtk::Grid & | new_grid () |
Create a new grid, store it, return a reference to it (but don't add to any element) | |
Gtk::Grid & | new_tab_grid (Gtk::Notebook ¬ebook, const std::string &title) |
Create a new grid and adds it as the content of new tab "title" on notebook , returns a reference to it. | |
void | data_at (Gtk::Grid &grid, const std::string &code, const std::string &value_name, int row, int col, double label_align=1.0, double value_align=0.0) |
Creates a "value: data" label pair with labels stored in fields_ that can be updated later. More... | |
void | data_append (Gtk::Grid &grid, const std::string &code, const std::string &value_name, double label_align=1.0, double value_align=0.0) |
Calls data_at to put the label at (gpos_ , 0), then increments gpos_. | |
void | label_at (Gtk::Grid &grid, const std::string &label, double alignment, int row, int col, int width, int height) |
Creates a label at the given location, taking up the given number of rows and columns, with horizontal alignment as given (0-1). More... | |
void | labels_at (Gtk::Grid &grid, const std::string &label1, const std::string &label2, int row, int col) |
Creates a pair of single-cell labels at the given (row,col) and (row,col+1). More... | |
void | labels_append (Gtk::Grid &grid, const std::string &label1, const std::string &label2) |
Creates a pair of static labels at the current (gpos_) row, first two columns. | |
void | comment_append (Gtk::Grid &grid, const std::string &comment, int cols=2) |
Creates a static, wrapping, multi-column label, at the current (gpos_) row. | |
void | matrix_at (Gtk::Grid &grid, const std::string &code, const std::string &name, int row, int col, int nrows, int ncols) |
Creates labels for a matrix of the given size in the grid with [0,0] element at (row+1 ,col+1 ), storing the labels in row-major order in matrix_. More... | |
![]() | |
std::unordered_map< std::string, std::pair< Gtk::Label, Gtk::Label > > | fields_ |
Fields containing a pair of labels: description and value. | |
std::unordered_map< std::string, std::vector< std::unique_ptr< Gtk::Label > > > | matrix_ |
Field containing a description and a matrix of values. | |
std::list< Gtk::Grid > | grids_ |
Grid for the display. | |
std::list< Gtk::Label > | labels_ |
Stored labels that aren't fields (i.e. single labels) | |
std::list< Gtk::Notebook > | nbs_ |
Notebooks for the tabs. | |
std::list< Gtk::ScrolledWindow > | swins_ |
Any scrolled windows used. | |
int | gpos_ = 0 |
The global label position, used during setup. | |
unsigned long | t_ = (unsigned long) -1 |
The time currently being shown (don't need to do anything in refresh() if this doesn't change. | |
bool | initial_refresh_ = true |
On the initial refresh, don't replace the book model. | |
InfoWindow subclass for displaying the details of a reader/author.
creativity::gui::ReaderInfoWindow::ReaderInfoWindow | ( | std::shared_ptr< const state::State > | state, |
std::shared_ptr< Gtk::Window > | main_window, | ||
eris::eris_id_t | reader_id, | ||
std::function< void(eris::eris_id_t)> | open_info_dialog | ||
) |
Constructs a new InfoWindow displaying reader information.
state | the state at which to display the information for the initial refresh() |
main_window | the main window to which this dialog will be attached |
reader_id | the reader id to display, or 0 to display a book |
open_info_dialog | a callable object that takes an ID and opens an info dialog (used to open authored book dialogs). |
std::out_of_range | if the reader or book doesn't exist in the passed-in state. |
|
overridevirtual |
Refresh the information in the dialog using the given simulation state.
Implements creativity::gui::InfoWindow.