|
|
@@ -2,17 +2,22 @@
|
|
|
#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);
|
|
|
|
|
|
@@ -21,6 +26,9 @@ core_window::core_window() {
|
|
|
|
|
|
core_window::~core_window() {
|
|
|
delete this->center;
|
|
|
+ delete this->current;
|
|
|
+ delete this->lights;
|
|
|
+ delete this->adder;
|
|
|
}
|
|
|
|
|
|
void core_window::init_default() {
|
|
|
@@ -28,7 +36,17 @@ void core_window::init_default() {
|
|
|
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() {
|
|
|
@@ -36,6 +54,20 @@ void core_window::create_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);
|
|
|
+}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|