summaryrefslogtreecommitdiffstats
path: root/Window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Window.cpp')
-rw-r--r--Window.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/Window.cpp b/Window.cpp
new file mode 100644
index 0000000..7e4dd63
--- /dev/null
+++ b/Window.cpp
@@ -0,0 +1,55 @@
+#include "Window.h"
+#include "WindowManager.h"
+#include "ui.h"
+#include "edit.h"
+
+
+gboolean Window::deleteEvent(GtkWidget *widget, GdkEvent *event, Window *window) {
+ gtk_widget_hide(widget);
+
+ window->manager->windowClosed(window);
+
+ return TRUE;
+}
+
+Window::Window(GdkGLConfig *glconfig, WindowManager *manager)
+ : editor(this), drawer(this, glconfig), sidebar(&editor)
+{
+ this->manager = manager;
+ setLevel(&level);
+
+ window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_default_size(GTK_WINDOW(window), 640, 480);
+ g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK(deleteEvent), this);
+
+ GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
+ gtk_container_add(GTK_CONTAINER(window), vbox);
+
+ gtk_box_pack_start(GTK_BOX(vbox), getMenu(), FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), getToolbar(), FALSE, FALSE, 0);
+
+ gtk_window_add_accel_group(GTK_WINDOW(window), getAccels());
+
+ GtkWidget *hPaned = gtk_hpaned_new();
+ gtk_box_pack_end(GTK_BOX(vbox), hPaned, TRUE, TRUE, 0);
+
+ gtk_paned_pack1(GTK_PANED(hPaned), drawer.getWidget(), TRUE, TRUE);
+
+ gtk_paned_pack2(GTK_PANED(hPaned), sidebar.getWidget(), FALSE, TRUE);
+ sidebar.update();
+
+ gtk_widget_show_all(vbox);
+}
+
+Window::~Window() {
+ gtk_widget_destroy(window);
+}
+
+void Window::show() {
+ gtk_widget_show(window);
+}
+
+void Window::update() {
+ drawer.update();
+ sidebar.update();
+}