]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - contrib/camera/dialogs.cpp
GTK: wrap gtk_widget_set_size_request
[xonotic/netradiant.git] / contrib / camera / dialogs.cpp
index b8f65689020a328a08d822b32c354f9e81919cbb..5bcd984d179cd6a77e8dfb2dd8fcad6cf78703c1 100644 (file)
@@ -70,10 +70,10 @@ static gint ci_new( GtkWidget *widget, gpointer data ){
 
        // create the window
        auto window = ui::Window( ui::window_type::TOP );
-       gtk_window_set_title( GTK_WINDOW( window ), "New Camera" );
+       gtk_window_set_title( window, "New Camera" );
        window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
        window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
-       gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) );
+       gtk_window_set_transient_for( window, g_pCameraInspectorWnd );
 
        g_object_set_data( G_OBJECT( window ), "loop", &loop );
        g_object_set_data( G_OBJECT( window ), "ret", &ret );
@@ -145,7 +145,7 @@ static gint ci_new( GtkWidget *widget, gpointer data ){
 
        // -------------------------- //
 
-       gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
+       gtk_window_set_position( window, GTK_WIN_POS_CENTER );
        window.show();
        gtk_grab_add( window );
 
@@ -363,10 +363,10 @@ static gint ci_rename( GtkWidget *widget, gpointer data ){
 
        // create the window
        auto window = ui::Window( ui::window_type::TOP );
-       gtk_window_set_title( GTK_WINDOW( window ), "Rename Path" );
+       gtk_window_set_title( window, "Rename Path" );
        window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
        window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
-       gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) );
+       gtk_window_set_transient_for( window, g_pCameraInspectorWnd );
 
        g_object_set_data( G_OBJECT( window ), "loop", &loop );
        g_object_set_data( G_OBJECT( window ), "ret", &ret );
@@ -427,7 +427,7 @@ static gint ci_rename( GtkWidget *widget, gpointer data ){
 
        // -------------------------- //
 
-       gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
+       gtk_window_set_position( window, GTK_WIN_POS_CENTER );
        window.show();
        gtk_grab_add( window );
 
@@ -482,10 +482,10 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){
 
        // create the window
        auto window = ui::Window( ui::window_type::TOP );
-       gtk_window_set_title( GTK_WINDOW( window ), "Add Target" );
+       gtk_window_set_title( window, "Add Target" );
        window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
        window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
-       gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) );
+       gtk_window_set_transient_for( window, g_pCameraInspectorWnd );
 
        g_object_set_data( G_OBJECT( window ), "loop", &loop );
        g_object_set_data( G_OBJECT( window ), "ret", &ret );
@@ -574,7 +574,7 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){
 
        // -------------------------- //
 
-       gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
+       gtk_window_set_position( window, GTK_WIN_POS_CENTER );
        window.show();
        gtk_grab_add( window );
 
@@ -611,7 +611,7 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){
 
                                // Select the last item in the listbox
                                li = g_list_last( GTK_LIST( GTK_COMBO( g_pPathListCombo )->list )->children );
-                               gtk_list_select_child( GTK_LIST( GTK_COMBO( g_pPathListCombo )->list ), GTK_WIDGET( li->data ) );
+                               gtk_list_select_child( GTK_LIST( GTK_COMBO( g_pPathListCombo )->list ), li->data  );
 
                                // If this was the first one, refresh the event list
                                if ( GetCurrentCam()->GetCam()->numTargets() == 1 ) {
@@ -675,7 +675,7 @@ void RefreshCamListCombo( void ){
                combo_cam = firstCam;
                while ( li && combo_cam ) {
                        if ( combo_cam == GetCurrentCam() ) {
-                               gtk_list_select_child( GTK_LIST( GTK_COMBO( g_pCamListCombo )->list ), GTK_WIDGET( li->data ) );
+                               gtk_list_select_child( GTK_LIST( GTK_COMBO( g_pCamListCombo )->list ), li->data  );
                                break;
                        }
                        li = li->next;
@@ -830,10 +830,10 @@ static gint ci_add( GtkWidget *widget, gpointer data ){
 
        // create the window
        auto window = ui::Window( ui::window_type::TOP );
-       gtk_window_set_title( GTK_WINDOW( window ), "Add Event" );
+       gtk_window_set_title( window, "Add Event" );
        window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
        window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
-       gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) );
+       gtk_window_set_transient_for( window, g_pCameraInspectorWnd );
 
        g_object_set_data( G_OBJECT( window ), "loop", &loop );
        g_object_set_data( G_OBJECT( window ), "ret", &ret );
@@ -914,7 +914,7 @@ static gint ci_add( GtkWidget *widget, gpointer data ){
 
        // -------------------------- //
 
-       gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
+       gtk_window_set_position( window, GTK_WIN_POS_CENTER );
        window.show();
        gtk_grab_add( window );
 
@@ -996,11 +996,11 @@ GtkWidget *CreateCameraInspectorDialog( void ){
 
        // create the window
        auto window = ui::Window( ui::window_type::TOP );
-       gtk_window_set_title( GTK_WINDOW( window ), "Camera Inspector" );
+       gtk_window_set_title( window, "Camera Inspector" );
        window.connect( "delete_event", G_CALLBACK( ci_close ), NULL );
        window.connect( "expose_event", G_CALLBACK( ci_expose ), NULL );
        //  window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
-       gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pRadiantWnd ) );
+       gtk_window_set_transient_for( window, g_pRadiantWnd );
 
        // don't use show, as you don't want to have it displayed on startup ;-)
        gtk_widget_realize( window );
@@ -1014,17 +1014,15 @@ GtkWidget *CreateCameraInspectorDialog( void ){
        table.show();
        window.add(table);
        gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
-       gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
-       gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
+    gtk_table_set_row_spacings(table, 5);
+    gtk_table_set_col_spacings(table, 5);
 
        // the properties column
        // -------------------------- //
 
        vbox = ui::VBox( FALSE, 5 );
        vbox.show();
-       gtk_table_attach( GTK_TABLE( table ), vbox, 0, 1, 0, 1,
-                                         (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
-                                         (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
+       table.attach(vbox, {0, 1, 0, 1}, {GTK_EXPAND | GTK_FILL, GTK_FILL});
 
        // -------------------------- //
 
@@ -1072,9 +1070,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){
 
        auto frame = ui::Frame( "Path and Target editing" );
        frame.show();
-       gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 1, 2,
-                                         (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
-                                         (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
+       table.attach(frame, {0, 1, 1, 2}, {GTK_EXPAND | GTK_FILL, GTK_FILL});
 
        auto vbox = ui::VBox( FALSE, 5 );
        frame.add(vbox);
@@ -1166,9 +1162,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){
 
        frame = ui::Frame( "Time" );
        frame.show();
-       gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 2, 3,
-                                         (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
-                                         (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
+       table.attach(frame, {0, 1, 2, 3}, {GTK_EXPAND | GTK_FILL, GTK_FILL});
 
        vbox = ui::VBox( FALSE, 5 );
        frame.add(vbox);
@@ -1253,7 +1247,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){
        hbox.show();
 
        auto scr = w = ui::ScrolledWindow();
-       gtk_widget_set_size_request( w, 0, 150 );
+       w.dimensions( 0, 150 );
        gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( w ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
        hbox.pack_start( w, TRUE, TRUE, 0 );
        w.show();
@@ -1295,9 +1289,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){
 
        vbox = gtk_vbox_new( FALSE, 5 );
        vbox.show();
-       gtk_table_attach( GTK_TABLE( table ), vbox, 1, 2, 0, 1,
-                                         (GtkAttachOptions) ( GTK_FILL ),
-                                         (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
+       table.attach(vbox, {1, 2, 0, 1}, {GTK_FILL, GTK_FILL});
 
        w = gtk_button_new_with_label( "New..." );
        vbox.pack_start( w, FALSE, FALSE, 0 );
@@ -1313,9 +1305,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){
 
        vbox = gtk_vbox_new( FALSE, 5 );
        vbox.show();
-       gtk_table_attach( GTK_TABLE( table ), vbox, 1, 2, 1, 2,
-                                         (GtkAttachOptions) ( GTK_FILL ),
-                                         (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
+       table.attach( vbox, {1, 2, 1, 2}, {GTK_FILL, GTK_FILL});
 
        w = gtk_button_new_with_label( "Save..." );
        vbox.pack_start( w, FALSE, FALSE, 0 );
@@ -1345,9 +1335,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){
 
        vbox = gtk_vbox_new( FALSE, 5 );
        vbox.show();
-       gtk_table_attach( GTK_TABLE( table ), vbox, 1, 2, 2, 3,
-                                         (GtkAttachOptions) ( GTK_FILL ),
-                                         (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
+       table.attach(vbox, {1, 2, 2, 3}, {GTK_FILL, GTK_FILL});
 
        hbox = gtk_hbox_new( FALSE, 5 );
        vbox.pack_start( hbox, TRUE, TRUE, 0 );