#include <Dialog.h>
Public Member Functions | |
| Dialog (const String &info, const List< String > &button_labels, const DialogFunction func) | |
| ~Dialog () | |
Static Public Member Functions | |
| void | generate_result (GtkWidget *widget, result_t *result_p) |
Private Attributes | |
| GtkWidget * | window_p |
|
||||||||||||||||
|
Definition at line 32 of file Dialog.cc. References String::chars(), List< T >::first(), generate_result(), gpointer, GtkWidget, ListIterator< T >::ok(), and window_p. 00034 {
00035 // The window
00036
00037 window_p = gtk_window_new( GTK_WINDOW_TOPLEVEL );
00038 gtk_window_set_title( GTK_WINDOW( window_p ), "RealTimeBattle" );
00039 gtk_widget_set_name( window_p, "RTB Dialog" );
00040 gtk_window_set_policy( GTK_WINDOW( window_p ), FALSE, FALSE, FALSE );
00041 gtk_window_position( GTK_WINDOW( window_p ), GTK_WIN_POS_CENTER );
00042 gtk_container_border_width( GTK_CONTAINER( window_p ), 12 );
00043 gtk_signal_connect( GTK_OBJECT( window_p ), "delete_event",
00044 (GtkSignalFunc) gtk_widget_destroy,
00045 (gpointer) NULL );
00046
00047 // Main box
00048
00049 GtkWidget* vbox = gtk_vbox_new( FALSE, 10 );
00050 gtk_container_add( GTK_CONTAINER( window_p ), vbox );
00051 gtk_widget_show( vbox );
00052
00053 // The info text
00054
00055 GtkWidget* label = gtk_label_new( info.chars() );
00056 gtk_box_pack_start( GTK_BOX( vbox ), label, TRUE, TRUE, 0 );
00057 gtk_widget_show( label );
00058
00059 // The buttons
00060
00061 GtkWidget* hbox = gtk_hbox_new( FALSE, 10 );
00062 gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, TRUE, 0 );
00063 gtk_widget_show( hbox );
00064
00065 ListIterator<String> li;
00066 String* str;
00067 GtkWidget* button_w;
00068 int list_nr = 0;
00069 for( button_labels.first(li); li.ok(); li++ )
00070 {
00071 list_nr++;
00072 str = li();
00073 button_w = gtk_button_new_with_label( str->chars() );
00074 gtk_signal_connect( GTK_OBJECT( button_w ), "clicked",
00075 (GtkSignalFunc) Dialog::generate_result,
00076 (gpointer) new result_t( list_nr, func, window_p ) );
00077 gtk_box_pack_start( GTK_BOX( hbox ), button_w, TRUE, TRUE, 0 );
00078 gtk_widget_show( button_w );
00079 }
00080
00081 gtk_widget_show( window_p );
00082 }
|
Here is the call graph for this function:

|
|
Definition at line 55 of file Dialog.h. 00055 {}
|
|
||||||||||||
|
Definition at line 85 of file Dialog.cc. References Dialog::result_t::function, Dialog::result_t::result, and Dialog::result_t::widget. Referenced by Dialog(). 00086 {
00087 (*(result_p->function))(result_p->result);
00088 gtk_widget_destroy( result_p->widget );
00089 }
|
|
|
Definition at line 61 of file Dialog.h. Referenced by Dialog(). |
1.3.9.1