2 #include <eris/types.hpp> 3 #include <gtkmm/window.h> 4 #include <gtkmm/notebook.h> 5 #include <gtkmm/grid.h> 6 #include <gtkmm/label.h> 7 #include <gtkmm/scrolledwindow.h> 10 #include <type_traits> 11 #include <unordered_map> 17 namespace creativity {
namespace state {
class State; } }
30 const eris::eris_id_t
id;
33 virtual void refresh(std::shared_ptr<const state::State> state) = 0;
42 InfoWindow(std::shared_ptr<Gtk::Window> main_window, eris::eris_id_t
id,
const std::string &title);
47 template <class T, typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
49 updateValue(code, std::to_string(val));
53 void updateValue(
const std::string &code,
const std::string &val);
59 void updateMatrix(
const std::string &code,
const Eigen::Ref<const Eigen::MatrixXd> &m,
bool lower_triangle =
false);
64 void clearMatrix(
const std::string &code,
const std::string &value =
"");
67 std::unordered_map<std::string, std::pair<Gtk::Label, Gtk::Label>>
fields_;
69 std::unordered_map<std::string, std::vector<std::unique_ptr<Gtk::Label>>>
matrix_;
75 std::list<Gtk::Notebook>
nbs_;
77 std::list<Gtk::ScrolledWindow>
swins_;
85 Gtk::Grid& new_grid();
89 Gtk::Grid& new_tab_grid(Gtk::Notebook ¬ebook,
const std::string &title);
93 void data_at(Gtk::Grid &grid,
const std::string &code,
const std::string &value_name,
int row,
int col,
94 double label_align = 1.0,
double value_align = 0.0);
96 void data_append(Gtk::Grid &grid,
const std::string &code,
const std::string &value_name,
97 double label_align = 1.0,
double value_align = 0.0);
101 void label_at(Gtk::Grid &grid,
const std::string &label,
double alignment,
int row,
int col,
int width,
int height);
105 void labels_at(Gtk::Grid &grid,
const std::string &label1,
const std::string &label2,
int row,
int col);
107 void labels_append(Gtk::Grid &grid,
const std::string &label1,
const std::string &label2);
109 void comment_append(Gtk::Grid &grid,
const std::string &comment,
int cols = 2);
115 void matrix_at(Gtk::Grid &grid,
const std::string &code,
const std::string &name,
int row,
int col,
int nrows,
int ncols);
120 unsigned long t_ = (
unsigned long) -1;
122 bool initial_refresh_ =
true;
std::list< Gtk::Grid > grids_
Grid for the display.
Definition: InfoWindow.hpp:71
std::list< Gtk::Label > labels_
Stored labels that aren't fields (i.e. single labels)
Definition: InfoWindow.hpp:73
Primary namespace for all Creativity library code.
Definition: config.hpp:4
const eris::eris_id_t id
The eris_id of the simulation object about which this dialog is displaying details.
Definition: InfoWindow.hpp:30
std::list< Gtk::ScrolledWindow > swins_
Any scrolled windows used.
Definition: InfoWindow.hpp:77
std::unordered_map< std::string, std::pair< Gtk::Label, Gtk::Label > > fields_
Fields containing a pair of labels: description and value.
Definition: InfoWindow.hpp:67
Gtk dialog for showing reader or book info.
Definition: InfoWindow.hpp:23
std::list< Gtk::Notebook > nbs_
Notebooks for the tabs.
Definition: InfoWindow.hpp:75
std::unordered_map< std::string, std::vector< std::unique_ptr< Gtk::Label > > > matrix_
Field containing a description and a matrix of values.
Definition: InfoWindow.hpp:69
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.
Definition: InfoWindow.hpp:48