#include #include #include #include #include #include #include #include "light_on_list.hpp" namespace cx_light { light_on_list::light_on_list(light target) { this->target = target.copy(); this->show_callback = [] (light *target) {}; this->edit_callback = [] (light *target) {}; this->center = new Gtk::Box(); this->center->set_margin(5); this->center->set_spacing(10); this->center->set_orientation(Gtk::Orientation::HORIZONTAL); this->center->set_homogeneous(); this->set_margin_bottom(5); this->set_child(*this->center); this->title = new Gtk::Label(this->target->get_name()); this->center->append(*this->title); this->show = new Gtk::Button("Show"); this->center->append(*this->show); this->show->signal_clicked().connect([&] () { this->show_callback(this->target); }); this->edit = new Gtk::Button("Edit"); this->center->append(*this->edit); this->edit->signal_clicked().connect([&] () { this->edit_callback(this->target); }); } light_on_list::~light_on_list() { delete this->center; delete this->title; delete this->show; delete this->edit; delete this->target; } int light_on_list::width() { return 200; } int light_on_list::height() { return 40; } void light_on_list::set_edit_callback(std::function target) { this->edit_callback = target; } void light_on_list::set_show_callback(std::function target) { this->show_callback = target; } }