| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- #include <gtkmm/widget.h>
- #include <gtkmm/button.h>
- #include <gtkmm/window.h>
- #include <gtkmm/box.h>
- #include <gtkmm/frame.h>
- #include <gtkmm/orientable.h>
- #include <gtkmm/widget.h>
- #include <iostream>
- #include "strings.hpp"
- #include "config.hpp"
- #include "core_window.hpp"
- #include "lights_list.hpp"
- #include "light_adder.hpp"
- namespace cx_light {
- core_window::core_window() {
- this->current_visible = NULL;
- this->set_title(__(WINDOW_TITLE));
- this->set_default_size(400, 200);
- this->init_default();
- }
- core_window::~core_window() {
- delete this->center;
- delete this->current;
- delete this->lights;
- delete this->adder;
- }
- void core_window::init_default() {
- this->center = new Gtk::Box();
- this->center->set_orientation(Gtk::Orientation::HORIZONTAL);
- this->set_child(*this->center);
- this->current = new Gtk::Box();
- this->current->set_margin(DEFAULT_MARGIN);
- this->current_frame = new Gtk::Frame();
- this->current_frame->set_margin(DEFAULT_MARGIN);
- this->current_frame->set_child(*this->current);
- this->create_lights_list();
- this->center->append(*this->current_frame);
- this->create_light_adder();
- }
- void core_window::create_lights_list() {
- this->lights = new lights_list();
- this->center->append(*this->lights);
- }
- void core_window::create_light_adder() {
- this->adder = new light_adder();
- this->set_view(this->adder);
- }
- void core_window::set_view(Gtk::Widget *target) {
- if (this->current_visible != NULL) {
- this->current->remove(*this->current_visible);
- }
- this->current_visible = target;
- this->current->append(*target);
- }
- }
|