3 This file is part of R²C²
4 Copyright © 2011 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
13 MainPanel::MainPanel(Remote &r, R2C2::Client &c):
17 client.signal_power_changed.connect(sigc::mem_fun(this, &MainPanel::power_changed));
18 client.signal_halt_changed.connect(sigc::mem_fun(this, &MainPanel::halt_changed));
19 client.signal_emergency.connect(sigc::mem_fun(this, &MainPanel::emergency));
21 Gtk::HBox *hbox = new Gtk::HBox(false, 5);
22 pack_start(*manage(hbox), false, true);
24 hbox->pack_start(*manage(chk_power = new Gtk::CheckButton("Power")), false, true);
25 chk_power->signal_toggled().connect(sigc::mem_fun(this, &MainPanel::ui_power_changed));
27 hbox->pack_start(*manage(chk_halt = new Gtk::CheckButton("Halt")), false, true);
28 chk_halt->signal_toggled().connect(sigc::mem_fun(this, &MainPanel::ui_power_changed));
30 pack_start(*manage(lbl_status = new Gtk::Label), false, true);
35 void MainPanel::power_changed(bool p)
37 chk_power->set_active(p);
40 void MainPanel::halt_changed(bool h)
42 chk_halt->set_active(h);
44 lbl_status->set_text(string());
47 void MainPanel::emergency(const string &msg)
49 lbl_status->set_text(msg);
52 void MainPanel::ui_power_changed()
54 client.set_power(chk_power->get_active());
57 void MainPanel::ui_halt_changed()
59 client.set_halt(chk_halt->get_active());