#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(); }