1 | #include "orxonox_gui.h" |
---|
2 | |
---|
3 | int main( int argc, char *argv[] ) |
---|
4 | { |
---|
5 | gtk_init (&argc, &argv); |
---|
6 | Window* orxonoxGUI = new Window("Graphical Orxonox Launcher"); |
---|
7 | orxonoxGUI->connectSignal (orxonoxGUI, "destroy", orxonox_gui_quit); |
---|
8 | orxonoxGUI->show (); |
---|
9 | |
---|
10 | gtk_main(); |
---|
11 | return 0; |
---|
12 | } |
---|
13 | |
---|
14 | Window::Window (void) |
---|
15 | { |
---|
16 | widget = gtk_window_new (GTK_WINDOW_TOPLEVEL); |
---|
17 | gtk_window_set_policy(GTK_WINDOW(widget), TRUE, TRUE, TRUE); |
---|
18 | } |
---|
19 | |
---|
20 | Window::Window (char* windowName) |
---|
21 | { |
---|
22 | widget = gtk_window_new (GTK_WINDOW_TOPLEVEL); |
---|
23 | gtk_window_set_policy(GTK_WINDOW(widget), TRUE, TRUE, TRUE); |
---|
24 | this->setTitle(windowName); |
---|
25 | // g_signal_connect (G_OBJECT (widget), "delete_event", G_CALLBACK (gtk_main_quit), NULL); |
---|
26 | // g_signal_connect (G_OBJECT (widget), "destroy", G_CALLBACK (orxonox_gui_quit), orxonox_settings); |
---|
27 | // gtk_container_set_border_width (GTK_CONTAINER (widget), 5); |
---|
28 | } |
---|
29 | |
---|
30 | Window::~Window () |
---|
31 | {} |
---|
32 | |
---|
33 | void Window::show () |
---|
34 | { |
---|
35 | gtk_widget_show_all (widget); |
---|
36 | } |
---|
37 | |
---|
38 | void Window::setTitle (char* title) |
---|
39 | { |
---|
40 | gtk_window_set_title (GTK_WINDOW (widget), title); |
---|
41 | } |
---|
42 | |
---|
43 | void Widget::connectSignal (Widget* thisWidget, char* event, gint ( *signal)( GtkWidget*, GdkEvent*, void *)) |
---|
44 | { |
---|
45 | g_signal_connect (G_OBJECT (thisWidget->widget), event, G_CALLBACK (signal), NULL); |
---|
46 | } |
---|
47 | |
---|
48 | |
---|
49 | gint orxonox_gui_quit ( GtkWidget *widget, GdkEvent *event, gpointer data) |
---|
50 | { |
---|
51 | gtk_main_quit(); |
---|
52 | return FALSE; |
---|
53 | } |
---|