Changeset 1894 in orxonox.OLD for orxonox/branches
- Timestamp:
- May 18, 2004, 11:02:07 AM (21 years ago)
- Location:
- orxonox/branches/gui/guicc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/gui/guicc/orxonox_gui.cc
r1893 r1894 5 5 gtk_init (&argc, &argv); 6 6 Window* orxonoxGUI = new Window("Graphical Orxonox Launcher"); 7 orxonoxGUI->connectSignal (orxonoxGUI, "destroy", orxonox_gui_quit); 8 orxonoxGUI->show (); 7 orxonoxGUI->connectSignal ("destroy", orxonoxGUI->orxonox_gui_quit); 8 orxonoxGUI->connectSignal ("delete_event", orxonoxGUI->orxonox_gui_quit); 9 10 Frame* Frametest = new Frame ("Test"); 11 orxonoxGUI->fill(Frametest); 12 //Frame test = orxonoxGUI->down; 13 //test.setTitle("shit"); 14 orxonoxGUI->showall (); 9 15 10 16 gtk_main(); 11 17 return 0; 12 18 } 19 20 21 /* WIDGET */ 22 void Widget::show() 23 { 24 gtk_widget_show (widget); 25 } 26 27 void Widget::connectSignal (char* event, gint ( *signal)( GtkWidget*, GdkEvent*, void *)) 28 { 29 g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), NULL); 30 } 31 32 /* CONTAINERS*/ 33 34 void Container::fill (Widget *lowerWidget) 35 { 36 gtk_container_add (GTK_CONTAINER(this->widget), lowerWidget->widget); 37 this->down = lowerWidget; 38 } 39 40 // gtk_container_set_border_width (GTK_CONTAINER (widget), 5); 41 42 /* WINDOW */ 13 43 14 44 Window::Window (void) … … 23 53 gtk_window_set_policy(GTK_WINDOW(widget), TRUE, TRUE, TRUE); 24 54 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 55 } 29 56 … … 31 58 {} 32 59 33 void Window::show ()60 void Window::showall () 34 61 { 35 62 gtk_widget_show_all (widget); … … 41 68 } 42 69 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 70 48 71 49 gint orxonox_gui_quit ( GtkWidget *widget, GdkEvent *event, gpointer data)72 gint Window::orxonox_gui_quit ( GtkWidget *widget, GdkEvent *event, gpointer data) 50 73 { 51 74 gtk_main_quit(); 52 75 return FALSE; 53 76 } 77 78 79 /* FRAME */ 80 81 Frame::Frame (void) 82 { 83 widget = gtk_frame_new (""); 84 } 85 Frame::Frame (char* title) 86 { 87 widget = gtk_frame_new (title); 88 } 89 Frame::~Frame () 90 {} 91 92 void Frame::setTitle (char* title) 93 { 94 gtk_frame_set_label (GTK_FRAME (widget), title); 95 } -
orxonox/branches/gui/guicc/orxonox_gui.h
r1893 r1894 5 5 #include <stdlib.h> 6 6 #include <string.h> 7 #include <gtk/gtk.h> 7 #include <gtk/gtkmain.h> 8 #include <gtk/gtkwindow.h> 9 #include <gtk/gtkframe.h> 8 10 9 11 … … 13 15 14 16 Widget* next; 15 17 protected: 16 18 17 19 public: 18 GtkWidget* widget; 20 GtkWidget* widget; 21 19 22 //virtual void create (); 20 virtual void show () = 0;21 23 // void addWidget (); 22 static void connectSignal (Widget* thisWidget, char* event, gint (*signal)(GtkWidget*, GdkEvent*, void *)); 24 void connectSignal (char* event, gint (*signal)(GtkWidget*, GdkEvent*, void *)); 25 void show (); 23 26 }; 24 27 … … 31 34 int policy; 32 35 char* label; 33 Widget* down; 36 34 37 35 38 public: 39 Widget* down; 36 40 void setBorderWidth (int borderwidth); 37 41 virtual void setTitle (char* title) = 0; 42 void fill (Widget *lowerWidget); 38 43 }; 39 44 … … 49 54 ~Window (); 50 55 void setTitle (char* title); 51 void show (); 56 void showall (); 57 static gint orxonox_gui_quit ( GtkWidget *widget, GdkEvent *event, gpointer data); 58 59 }; 60 61 class Frame :public Container 62 { 63 private: 64 65 public: 66 Frame (char* frameName); 67 Frame (void); 68 ~Frame (); 69 void setTitle (char* title); 52 70 53 71 }; … … 58 76 }; 59 77 60 gint orxonox_gui_quit ( GtkWidget *widget, GdkEvent *event, gpointer data);78 //gint orxonox_gui_quit ( GtkWidget *widget, GdkEvent *event, gpointer data); 61 79 62 80 #endif /* _ORXONOX_GUI_H */
Note: See TracChangeset
for help on using the changeset viewer.