
#include <string>
using namespace std;

#include <ocarina/gtk.h>
#include <ocarina/ocarina.h>
#include <ocarina/window.h>

static GtkWidget *window;

void destroy_window(GtkWidget *widget, GdkEvent *event, gpointer data)
{
	ocarina::quit();
}

void window_resize(int w, int h)
{
	gtk_window_resize(GTK_WINDOW(window), w, h);
}

void window_title(string title)
{
	gtk_window_set_title(GTK_WINDOW(window), title.c_str());
}

void window_icon(string file)
{
	gtk_window_set_icon_from_file(GTK_WINDOW(window), file.c_str(), NULL);
}

void window_init(string title, string icon)
{
	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	GTK_CONNECT(window, "destroy", destroy_window, NULL);
	window_resize(800, 600);
	gtk_widget_show(window);
	window_title(title);
	window_icon(icon);
}

void window_add(GtkWidget *widget)
{
	container_add(window, widget);
}
