#include #include #include "strings.hpp" #include "config.hpp" #include "core_window.hpp" #include "buttons.hpp" namespace cx_light { core_window::core_window() { this->set_title(__(WINDOW_TITLE)); this->set_default_size(400, 200); this->init_default(); this->show_all(); } core_window::~core_window() { delete this->add_light; delete this->lights_list; delete this->lights_list_frame; delete this->content; } void core_window::init_default() { this->create_lights_list(); this->content = new Gtk::Grid(); this->content->attach(*this->lights_list_frame, 0, 0); this->add(*this->content); } void core_window::create_lights_list() { this->add_light = new add_light_button(); this->lights_list_frame = new Gtk::Frame(); this->lights_list_frame->set_label(__(LIGHTS_LIST)); this->set_margin(this->lights_list_frame, DEFAULT_MARGIN); this->lights_list = new Gtk::ListBox(); this->set_margin(this->lights_list, DEFAULT_MARGIN); this->lights_list_frame->add(*this->lights_list); this->lights_list->append(*this->add_light); } void core_window::set_margin(Gtk::Widget *target, unsigned int margin) { target->set_margin_top(margin); target->set_margin_left(margin); target->set_margin_right(margin); target->set_margin_bottom(margin); } void core_window::set_margin( Gtk::Widget *target, unsigned int margin_top, unsigned int margin_side ) { target->set_margin_top(margin_top); target->set_margin_left(margin_side); target->set_margin_right(margin_side); target->set_margin_bottom(margin_top); } }