ocarina: set window title and icon

I do this from the window init function using default values, rather
than pass it as a parameter to the init function.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-03-10 10:47:11 -05:00 committed by Bryan Schumaker
parent 698d449c34
commit 3c19e4a3d9
2 changed files with 16 additions and 10 deletions

View File

@ -12,6 +12,9 @@ namespace ocarina
void init();
void set_title(string);
void set_icon(string);
}; /* Namespace: window */
/*void window_resize(int, int);
void window_init(string, string);

View File

@ -1,5 +1,6 @@
// Copyright (c) 2011 Bryan Schumaker
#include <version.h>
#include <ocarina/ocarina.h>
#include <ocarina/window.h>
@ -20,16 +21,6 @@ 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);
@ -59,7 +50,19 @@ namespace ocarina
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(win, "destroy", G_CALLBACK(destroy), NULL);
set_title("Ocarina " + vers_str());
set_icon(full_path("images/ocarina.png"));
gtk_widget_show(win);
}
void window::set_title(string title)
{
gtk_window_set_title(GTK_WINDOW(win), title.c_str());
}
void window::set_icon(string path)
{
gtk_window_set_icon_from_file(GTK_WINDOW(win), path.c_str(), NULL);
}
} /* Namespace: ocarina */