Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/gui/guicc/orxonox_gui.cc @ 1893

Last change on this file since 1893 was 1893, checked in by bensch, 20 years ago

orxonox/branches/gui: added guicc: a c++ version of the gui, that should be object-oriented

File size: 1.3 KB
Line 
1#include "orxonox_gui.h"
2
3int 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
14Window::Window (void)
15{
16  widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
17  gtk_window_set_policy(GTK_WINDOW(widget), TRUE, TRUE, TRUE);
18}
19
20Window::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
30Window::~Window ()
31{}
32
33void Window::show ()
34{
35  gtk_widget_show_all  (widget);
36}
37
38void Window::setTitle (char* title)
39{
40  gtk_window_set_title (GTK_WINDOW (widget), title);
41}
42
43void 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
49gint orxonox_gui_quit ( GtkWidget *widget, GdkEvent *event, gpointer data)
50{
51  gtk_main_quit();
52  return FALSE;
53}
Note: See TracBrowser for help on using the repository browser.