2011-08-15 07:53:25 -04:00
|
|
|
|
2011-08-21 15:15:40 -04:00
|
|
|
#include <string>
|
|
|
|
using namespace std;
|
|
|
|
|
2011-08-20 11:36:29 -04:00
|
|
|
#include <ocarina/gtk.h>
|
2011-08-15 07:53:25 -04:00
|
|
|
#include <ocarina/ocarina.h>
|
|
|
|
#include <ocarina/window.h>
|
|
|
|
|
|
|
|
static GtkWidget *window;
|
|
|
|
|
|
|
|
void destroy_window(GtkWidget *widget, GdkEvent *event, gpointer data)
|
|
|
|
{
|
2011-10-29 15:47:00 -04:00
|
|
|
ocarina::quit();
|
2011-08-15 07:53:25 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void window_resize(int w, int h)
|
|
|
|
{
|
|
|
|
gtk_window_resize(GTK_WINDOW(window), w, h);
|
|
|
|
}
|
|
|
|
|
2011-08-21 15:15:40 -04:00
|
|
|
void window_title(string title)
|
|
|
|
{
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window), title.c_str());
|
|
|
|
}
|
|
|
|
|
2011-08-21 15:19:56 -04:00
|
|
|
void window_icon(string file)
|
|
|
|
{
|
|
|
|
gtk_window_set_icon_from_file(GTK_WINDOW(window), file.c_str(), NULL);
|
|
|
|
}
|
|
|
|
|
2011-10-22 08:55:32 -04:00
|
|
|
void window_init(string title, string icon)
|
2011-08-15 07:53:25 -04:00
|
|
|
{
|
|
|
|
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
2011-08-20 11:47:26 -04:00
|
|
|
GTK_CONNECT(window, "destroy", destroy_window, NULL);
|
2011-09-09 08:23:43 -04:00
|
|
|
window_resize(800, 600);
|
2011-08-15 07:53:25 -04:00
|
|
|
gtk_widget_show(window);
|
2011-10-22 08:55:32 -04:00
|
|
|
window_title(title);
|
|
|
|
window_icon(icon);
|
2011-08-15 07:53:25 -04:00
|
|
|
}
|
2011-08-18 08:20:56 -04:00
|
|
|
|
|
|
|
void window_add(GtkWidget *widget)
|
|
|
|
{
|
2011-08-20 11:36:29 -04:00
|
|
|
container_add(window, widget);
|
2011-08-18 08:20:56 -04:00
|
|
|
}
|