]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - libs/gtkutil/messagebox.cpp
GTK: wrap gtk_widget_set_size_request
[xonotic/netradiant.git] / libs / gtkutil / messagebox.cpp
index 334c4e78437f11662ed19526400160080db0b4c0..56b401318e169d747674c2a4213bbf76e392cbd1 100644 (file)
@@ -30,7 +30,7 @@
 ui::Widget create_padding( int width, int height ){
        ui::Alignment widget = ui::Alignment( 0.0, 0.0, 0.0, 0.0 );
        widget.show();
-       gtk_widget_set_size_request( widget, width, height );
+       widget.dimensions(width, height);
        return widget;
 }
 
@@ -51,15 +51,13 @@ const char* messagebox_stock_icon( EMessageBoxIcon type ){
        }
 }
 
-EMessageBoxReturn gtk_MessageBox( ui::Widget parent, const char* text, const char* title, EMessageBoxType type, EMessageBoxIcon icon ){
+EMessageBoxReturn gtk_MessageBox( ui::Window parentWindow, const char* text, const char* title, EMessageBoxType type, EMessageBoxIcon icon ){
        ModalDialog dialog;
        ModalDialogButton ok_button( dialog, eIDOK );
        ModalDialogButton cancel_button( dialog, eIDCANCEL );
        ModalDialogButton yes_button( dialog, eIDYES );
        ModalDialogButton no_button( dialog, eIDNO );
 
-       ui::Window parentWindow = ui::Window(parent ? GTK_WINDOW( parent ) : 0);
-
        ui::Window window = create_fixedsize_modal_dialog_window( parentWindow, title, dialog, 400, 100 );
 
        if ( parentWindow ) {
@@ -110,8 +108,8 @@ EMessageBoxReturn gtk_MessageBox( ui::Widget parent, const char* text, const cha
        if ( type == eMB_OK ) {
                auto button = create_modal_dialog_button( "OK", ok_button );
                hbox.pack_start( button, TRUE, FALSE, 0 );
-               gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 );
-               gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 );
+               gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 );
+               gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 );
                widget_make_default( button );
                button.show();
 
@@ -121,7 +119,7 @@ EMessageBoxReturn gtk_MessageBox( ui::Widget parent, const char* text, const cha
                {
                        auto button = create_modal_dialog_button( "OK", ok_button );
                        hbox.pack_start( button, TRUE, FALSE, 0 );
-                       gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 );
+                       gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 );
                        widget_make_default( button );
                        button.show();
                }
@@ -129,7 +127,7 @@ EMessageBoxReturn gtk_MessageBox( ui::Widget parent, const char* text, const cha
                {
                        auto button = create_modal_dialog_button( "OK", cancel_button );
                        hbox.pack_start( button, TRUE, FALSE, 0 );
-                       gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 );
+                       gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 );
                        button.show();
                }