1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
#include "gui_ex.h"
Gui_Ex::Gui_Ex()
:
m_adjustment( Gtk::Adjustment::create(1.0, 1.0, 5.0, 1.0, 5.0, 0.0) ),
m_VBox(Gtk::ORIENTATION_VERTICAL),
m_label2("label2"),
m_label3("label3"),
m_button3("Connect"),
m_button4("Quit"),
m_spin(m_adjustment),
m_label("Choose the number of clients")
{
set_title("Grid");
set_border_width(16);
add(m_VBox);
m_VBox.pack_start(m_grid);
m_grid.attach(m_label, 0,0,2,1); //column, row, width (# col span), height (# row span). starts at 0
m_grid.attach(m_spin, 2,0,1,1);
m_grid.attach(m_label2, 0,1,2,1);
m_grid.attach(m_label3, 2,1,1,1);
m_grid.attach(m_button3, 0,2,2,1);
m_grid.attach(m_button4, 2,2,1,1);
m_spin.set_wrap();
m_spin.set_numeric(true);
m_button3.set_sensitive(true);
m_button4.set_sensitive(false);
m_button3.signal_clicked().connect(sigc::mem_fun(*this, &Gui_Ex::on_connect_click));
m_button4.signal_clicked().connect(sigc::mem_fun(*this, &Gui_Ex::on_quit));
show_all_children();
}
Gui_Ex::~Gui_Ex()
{
}
void Gui_Ex::on_quit(){
bool running = false;
m_spin.set_sensitive(true);
m_button3.set_sensitive(true);
}
void Gui_Ex::on_connect_click()
{
int BACKLOG = m_spin.get_value_as_int();
m_spin.set_sensitive(false);
m_button4.set_sensitive(true);
}
|