// File: GUILifeBoard.h // Adapted from "Programming with GTKmm": // // #ifndef _GUILIFEBOARD_H_ #define _GUILIFEBOARD_H_ #include #include #include #include "LifeBoard.h" // Game of Life classes using namespace std ; class GUILifeBoard : public Gtk::Window { public: GUILifeBoard(); GUILifeBoard(unsigned int r, unsigned int c, bool *b = NULL) ; virtual ~GUILifeBoard(); protected: // Signal handlers: these are the functiosn that get called // when the corresponding button is clicked. virtual void on_button_start(); virtual void on_button_stop(); virtual void on_button_step1(); virtual void on_button_step10(); virtual void on_button_step100(); virtual void on_button_quit(); // // Child widgets: GUI elements to placed in the window // // Stacks widgets in a column // Gtk::VBox m_VBox; // A sub-window with scrollbars // Gtk::ScrolledWindow m_ScrolledWindow; // Someplace to write some text // Gtk::TextView m_TextView; Glib::RefPtr m_refTextBuffer ; // Something to hold the buttons // Gtk::HButtonBox m_ButtonBox; // The actual buttons // Gtk::Button m_ButtonStart, m_ButtonStop ; Gtk::Button m_ButtonStep1, m_ButtonStep10, m_ButtonStep100 ; Gtk::Button m_ButtonQuit ; // Plain text Game of Life board // LifeBoard B ; // Data members involved in running the simulation // bool keepRunning ; // are we on? unsigned int runSteps ; // how many more steps to run? unsigned int stepsTaken ; // # of steps we have simulated private: // This is what we do every 0.1 secconds (e.g., update // the board and display new board, if we are running). // bool on_timeout() ; }; #endif