]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/surfacedialog.cpp
Prevent implicit Widget construction
[xonotic/netradiant.git] / radiant / surfacedialog.cpp
index 438498e0ead93fd998d609bd0041128e70d31494..b6437186bc0b7e796d62ea80389bb1aadee74a2a 100644 (file)
@@ -27,6 +27,8 @@
 
 #include "surfacedialog.h"
 
+#include <gtk/gtk.h>
+
 #include "debugging/debugging.h"
 #include "warnings.h"
 
@@ -35,7 +37,6 @@
 #include "iundo.h"
 #include "iselection.h"
 
-#include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 
 #include "signal/isignal.h"
@@ -120,8 +121,8 @@ class Increment
 float& m_f;
 public:
 GtkSpinButton* m_spin;
-GtkEntry* m_entry;
-Increment( float& f ) : m_f( f ), m_spin( 0 ), m_entry( 0 ){
+ui::Entry m_entry;
+Increment( float& f ) : m_f( f ), m_spin( 0 ), m_entry( ui::null ){
 }
 void cancel(){
        entry_set_float( m_entry, m_f );
@@ -158,7 +159,7 @@ GtkCheckButton* m_surfaceFlags[32];
 GtkCheckButton* m_contentFlags[32];
 
 NonModalEntry m_valueEntry;
-GtkEntry* m_valueEntryWidget;
+ui::Entry m_valueEntryWidget{ui::null};
 public:
 WindowPositionTracker m_positionTracker;
 WindowPositionTrackerImportStringCaller m_importPosition;
@@ -173,7 +174,7 @@ Increment m_vshiftIncrement;
 Increment m_hscaleIncrement;
 Increment m_vscaleIncrement;
 Increment m_rotateIncrement;
-GtkEntry* m_texture;
+ui::Entry m_texture{ui::null};
 
 SurfaceInspector() :
        m_textureEntry( ApplyShaderCaller( *this ), UpdateCaller( *this ) ),
@@ -209,8 +210,8 @@ void constructWindow( ui::Window main_window ){
 void destroyWindow(){
        Destroy();
 }
-bool visible() const {
-       return gtk_widget_get_visible( GetWidget() );
+bool visible() {
+       return GetWidget().visible();
 }
 void queueDraw(){
        if ( visible() ) {
@@ -593,23 +594,23 @@ ui::Window SurfaceInspector::BuildDialog(){
        {
                // replaced by only the vbox:
                ui::Widget vbox = ui::VBox( FALSE, 5 );
-               gtk_widget_show( vbox );
-               gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) );
+               vbox.show();
+               window.add(vbox);
                gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
 
                {
                        ui::Widget hbox2 = ui::HBox( FALSE, 5 );
-                       gtk_widget_show( hbox2 );
+                       hbox2.show();
                        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox2 ), FALSE, FALSE, 0 );
 
                        {
                                ui::Widget label = ui::Label( "Texture" );
-                               gtk_widget_show( label );
+                               label.show();
                                gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 );
                        }
                        {
-                               GtkEntry* entry = ui::Entry();
-                               gtk_widget_show( GTK_WIDGET( entry ) );
+                               auto entry = ui::Entry(ui::New);
+                               entry.show();
                                gtk_box_pack_start( GTK_BOX( hbox2 ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
                                m_texture = entry;
                                m_textureEntry.connect( entry );
@@ -620,23 +621,23 @@ ui::Window SurfaceInspector::BuildDialog(){
 
                {
                        ui::Widget table = ui::Table( 6, 4, FALSE );
-                       gtk_widget_show( table );
+                       table.show();
                        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( table ), FALSE, FALSE, 0 );
                        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
                        gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
                        {
                                ui::Widget label = ui::Label( "Horizontal shift" );
-                               gtk_widget_show( label );
+                               label.show();
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 );
+                               auto spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 );
                                m_hshiftIncrement.m_spin = spin;
                                m_hshiftSpinner.connect( spin );
-                               gtk_widget_show( GTK_WIDGET( spin ) );
+                               spin.show();
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 0, 1,
                                                                  (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
@@ -644,15 +645,15 @@ ui::Window SurfaceInspector::BuildDialog(){
                        }
                        {
                                ui::Widget label = ui::Label( "Step" );
-                               gtk_widget_show( label );
+                               label.show();
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkEntry* entry = ui::Entry();
-                               gtk_widget_show( GTK_WIDGET( entry ) );
+                               auto entry = ui::Entry(ui::New);
+                               entry.show();
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 0, 1,
                                                                  (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
@@ -662,17 +663,17 @@ ui::Window SurfaceInspector::BuildDialog(){
                        }
                        {
                                ui::Widget label = ui::Label( "Vertical shift" );
-                               gtk_widget_show( label );
+                               label.show();
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 );
+                               auto spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 );
                                m_vshiftIncrement.m_spin = spin;
                                m_vshiftSpinner.connect( spin );
-                               gtk_widget_show( GTK_WIDGET( spin ) );
+                               spin.show();
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 1, 2,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
@@ -680,15 +681,15 @@ ui::Window SurfaceInspector::BuildDialog(){
                        }
                        {
                                ui::Widget label = ui::Label( "Step" );
-                               gtk_widget_show( label );
+                               label.show();
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkEntry* entry = ui::Entry();
-                               gtk_widget_show( GTK_WIDGET( entry ) );
+                               auto entry = ui::Entry(ui::New);
+                               entry.show();
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 1, 2,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
@@ -698,17 +699,17 @@ ui::Window SurfaceInspector::BuildDialog(){
                        }
                        {
                                ui::Widget label = ui::Label( "Horizontal stretch" );
-                               gtk_widget_show( label );
+                               label.show();
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 5 );
+                               auto spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 5 );
                                m_hscaleIncrement.m_spin = spin;
                                m_hscaleSpinner.connect( spin );
-                               gtk_widget_show( GTK_WIDGET( spin ) );
+                               spin.show();
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 2, 3,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
@@ -716,15 +717,15 @@ ui::Window SurfaceInspector::BuildDialog(){
                        }
                        {
                                ui::Widget label = ui::Label( "Step" );
-                               gtk_widget_show( label );
+                               label.show();
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 2, 3 );
                        }
                        {
-                               GtkEntry* entry = ui::Entry();
-                               gtk_widget_show( GTK_WIDGET( entry ) );
+                               auto entry = ui::Entry(ui::New);
+                               entry.show();
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 2, 3,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 2, 3 );
@@ -734,17 +735,17 @@ ui::Window SurfaceInspector::BuildDialog(){
                        }
                        {
                                ui::Widget label = ui::Label( "Vertical stretch" );
-                               gtk_widget_show( label );
+                               label.show();
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 3, 4,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 5 );
+                               auto spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 5 );
                                m_vscaleIncrement.m_spin = spin;
                                m_vscaleSpinner.connect( spin );
-                               gtk_widget_show( GTK_WIDGET( spin ) );
+                               spin.show();
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 3, 4,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
@@ -752,15 +753,15 @@ ui::Window SurfaceInspector::BuildDialog(){
                        }
                        {
                                ui::Widget label = ui::Label( "Step" );
-                               gtk_widget_show( label );
+                               label.show();
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 3, 4,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkEntry* entry = ui::Entry();
-                               gtk_widget_show( GTK_WIDGET( entry ) );
+                               auto entry = ui::Entry(ui::New);
+                               entry.show();
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 3, 4,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
@@ -770,17 +771,17 @@ ui::Window SurfaceInspector::BuildDialog(){
                        }
                        {
                                ui::Widget label = ui::Label( "Rotate" );
-                               gtk_widget_show( label );
+                               label.show();
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 4, 5,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 );
+                               auto spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 );
                                m_rotateIncrement.m_spin = spin;
                                m_rotateSpinner.connect( spin );
-                               gtk_widget_show( GTK_WIDGET( spin ) );
+                               spin.show();
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 4, 5,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
@@ -789,15 +790,15 @@ ui::Window SurfaceInspector::BuildDialog(){
                        }
                        {
                                ui::Widget label = ui::Label( "Step" );
-                               gtk_widget_show( label );
+                               label.show();
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 4, 5,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkEntry* entry = ui::Entry();
-                               gtk_widget_show( GTK_WIDGET( entry ) );
+                               auto entry = ui::Entry(ui::New);
+                               entry.show();
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 4, 5,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
@@ -808,116 +809,116 @@ ui::Window SurfaceInspector::BuildDialog(){
                        {
                                // match grid button
                                ui::Widget button = ui::Button( "Match Grid" );
-                               gtk_widget_show( button );
+                               button.show();
                                gtk_table_attach( GTK_TABLE( table ), button, 2, 4, 5, 6,
                                                                  (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
-                               g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnMatchGrid ), 0 );
+                               button.connect( "clicked", G_CALLBACK( OnBtnMatchGrid ), 0 );
                        }
                }
 
                {
-                       ui::Widget frame = ui::Frame( "Texturing" );
-                       gtk_widget_show( frame );
+                       auto frame = ui::Frame( "Texturing" );
+                       frame.show();
                        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), FALSE, FALSE, 0 );
                        {
                                ui::Widget table = ui::Table( 4, 4, FALSE );
-                               gtk_widget_show( table );
-                               gtk_container_add( GTK_CONTAINER( frame ), table );
+                               table.show();
+                               frame.add(table);
                                gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
                                gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
                                gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
                                {
                                        ui::Widget label = ui::Label( "Brush" );
-                                       gtk_widget_show( label );
+                                       label.show();
                                        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
                                        ui::Widget label = ui::Label( "Patch" );
-                                       gtk_widget_show( label );
+                                       label.show();
                                        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
                                        ui::Widget label = ui::Label( "Width" );
-                                       gtk_widget_show( label );
+                                       label.show();
                                        gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
                                        ui::Widget label = ui::Label( "Height" );
-                                       gtk_widget_show( label );
+                                       label.show();
                                        gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
                                        ui::Widget button = ui::Button( "Axial" );
-                                       gtk_widget_show( button );
+                                       button.show();
                                        gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-                                       g_signal_connect( G_OBJECT( button ), "clicked",
+                                       button.connect( "clicked",
                                                                          G_CALLBACK( OnBtnAxial ), 0 );
                                        gtk_widget_set_size_request( button, 60, -1 );
                                }
                                {
                                        ui::Widget button = ui::Button( "Fit" );
-                                       gtk_widget_show( button );
+                                       button.show();
                                        gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-                                       g_signal_connect( G_OBJECT( button ), "clicked",
+                                       button.connect( "clicked",
                                                                          G_CALLBACK( OnBtnFaceFit ), 0 );
                                        gtk_widget_set_size_request( button, 60, -1 );
                                }
                                {
                                        ui::Widget button = ui::Button( "CAP" );
-                                       gtk_widget_show( button );
+                                       button.show();
                                        gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 3, 4,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-                                       g_signal_connect( G_OBJECT( button ), "clicked",
+                                       button.connect( "clicked",
                                                                          G_CALLBACK( OnBtnPatchdetails ), 0 );
                                        gtk_widget_set_size_request( button, 60, -1 );
                                }
                                {
                                        ui::Widget button = ui::Button( "Set..." );
-                                       gtk_widget_show( button );
+                                       button.show();
                                        gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 3, 4,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-                                       g_signal_connect( G_OBJECT( button ), "clicked",
+                                       button.connect( "clicked",
                                                                          G_CALLBACK( OnBtnPatchreset ), 0 );
                                        gtk_widget_set_size_request( button, 60, -1 );
                                }
                                {
                                        ui::Widget button = ui::Button( "Natural" );
-                                       gtk_widget_show( button );
+                                       button.show();
                                        gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 3, 4,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-                                       g_signal_connect( G_OBJECT( button ), "clicked",
+                                       button.connect( "clicked",
                                                                          G_CALLBACK( OnBtnPatchnatural ), 0 );
                                        gtk_widget_set_size_request( button, 60, -1 );
                                }
                                {
                                        ui::Widget button = ui::Button( "Fit" );
-                                       gtk_widget_show( button );
+                                       button.show();
                                        gtk_table_attach( GTK_TABLE( table ), button, 3, 4, 3, 4,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-                                       g_signal_connect( G_OBJECT( button ), "clicked",
+                                       button.connect( "clicked",
                                                                          G_CALLBACK( OnBtnPatchFit ), 0 );
                                        gtk_widget_set_size_request( button, 60, -1 );
                                }
                                {
-                                       ui::Widget spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
-                                       gtk_widget_show( spin );
+                                       auto spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
+                                       spin.show();
                                        gtk_table_attach( GTK_TABLE( table ), spin, 2, 3, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
@@ -925,8 +926,8 @@ ui::Window SurfaceInspector::BuildDialog(){
                                        AddDialogData( *GTK_SPIN_BUTTON( spin ), m_fitHorizontal );
                                }
                                {
-                                       ui::Widget spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
-                                       gtk_widget_show( spin );
+                                       auto spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
+                                       spin.show();
                                        gtk_table_attach( GTK_TABLE( table ), spin, 3, 4, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
@@ -937,17 +938,17 @@ ui::Window SurfaceInspector::BuildDialog(){
                }
                if ( !string_empty( g_pGameDescription->getKeyValue( "si_flags" ) ) ) {
                        {
-                               GtkFrame* frame = ui::Frame( "Surface Flags" );
-                               gtk_widget_show( GTK_WIDGET( frame ) );
+                               auto frame = ui::Frame( "Surface Flags" );
+                               frame.show();
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
                                {
-                                       GtkVBox* vbox3 = ui::VBox( FALSE, 4 );
+                                       auto vbox3 = ui::VBox( FALSE, 4 );
                                        //gtk_container_set_border_width(GTK_CONTAINER(vbox3), 4);
-                                       gtk_widget_show( GTK_WIDGET( vbox3 ) );
-                                       gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
+                                       vbox3.show();
+                                       frame.add(vbox3);
                                        {
-                                               GtkTable* table = ui::Table( 8, 4, FALSE );
-                                               gtk_widget_show( GTK_WIDGET( table ) );
+                                               auto table = ui::Table( 8, 4, FALSE );
+                                               table.show();
                                                gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
                                                gtk_table_set_row_spacings( table, 0 );
                                                gtk_table_set_col_spacings( table, 0 );
@@ -958,8 +959,8 @@ ui::Window SurfaceInspector::BuildDialog(){
                                                {
                                                        for ( int r = 0; r != 8; ++r )
                                                        {
-                                                               GtkCheckButton* check = ui::CheckButton( getSurfaceFlagName( c * 8 + r ) );
-                                                               gtk_widget_show( GTK_WIDGET( check ) );
+                                                               auto check = ui::CheckButton( getSurfaceFlagName( c * 8 + r ) );
+                                                               check.show();
                                                                gtk_table_attach( table, GTK_WIDGET( check ), c, c + 1, r, r + 1,
                                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                                                                                                  (GtkAttachOptions)( 0 ), 0, 0 );
@@ -972,18 +973,18 @@ ui::Window SurfaceInspector::BuildDialog(){
                                }
                        }
                        {
-                               GtkFrame* frame = ui::Frame( "Content Flags" );
-                               gtk_widget_show( GTK_WIDGET( frame ) );
+                               auto frame = ui::Frame( "Content Flags" );
+                               frame.show();
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
                                {
-                                       GtkVBox* vbox3 = ui::VBox( FALSE, 4 );
+                                       auto vbox3 = ui::VBox( FALSE, 4 );
                                        //gtk_container_set_border_width(GTK_CONTAINER(vbox3), 4);
-                                       gtk_widget_show( GTK_WIDGET( vbox3 ) );
-                                       gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
+                                       vbox3.show();
+                                       frame.add(vbox3);
                                        {
 
-                                               GtkTable* table = ui::Table( 8, 4, FALSE );
-                                               gtk_widget_show( GTK_WIDGET( table ) );
+                                               auto table = ui::Table( 8, 4, FALSE );
+                                               table.show();
                                                gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
                                                gtk_table_set_row_spacings( table, 0 );
                                                gtk_table_set_col_spacings( table, 0 );
@@ -994,8 +995,8 @@ ui::Window SurfaceInspector::BuildDialog(){
                                                {
                                                        for ( int r = 0; r != 8; ++r )
                                                        {
-                                                               GtkCheckButton* check = ui::CheckButton( getContentFlagName( c * 8 + r ) );
-                                                               gtk_widget_show( GTK_WIDGET( check ) );
+                                                               auto check = ui::CheckButton( getContentFlagName( c * 8 + r ) );
+                                                               check.show();
                                                                gtk_table_attach( table, GTK_WIDGET( check ), c, c + 1, r, r + 1,
                                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                                                                                                  (GtkAttachOptions)( 0 ), 0, 0 );
@@ -1011,18 +1012,18 @@ ui::Window SurfaceInspector::BuildDialog(){
                                }
                        }
                        {
-                               GtkFrame* frame = ui::Frame( "Value" );
-                               gtk_widget_show( GTK_WIDGET( frame ) );
+                               auto frame = ui::Frame( "Value" );
+                               frame.show();
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
                                {
-                                       GtkVBox* vbox3 = ui::VBox( FALSE, 4 );
+                                       auto vbox3 = ui::VBox( FALSE, 4 );
                                        gtk_container_set_border_width( GTK_CONTAINER( vbox3 ), 4 );
-                                       gtk_widget_show( GTK_WIDGET( vbox3 ) );
-                                       gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
+                                       vbox3.show();
+                                       frame.add(vbox3);
 
                                        {
-                                               GtkEntry* entry = ui::Entry();
-                                               gtk_widget_show( GTK_WIDGET( entry ) );
+                                               auto entry = ui::Entry(ui::New);
+                                               entry.show();
                                                gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
                                                m_valueEntryWidget = entry;
                                                m_valueEntry.connect( entry );
@@ -1035,7 +1036,7 @@ ui::Window SurfaceInspector::BuildDialog(){
                if ( g_bp_globals.m_texdefTypeId == TEXDEFTYPEID_BRUSHPRIMITIVES ) {
 // Shamus: Textool goodies...
                        ui::Widget frame = ui::Frame( "Textool" );
-                       gtk_widget_show( frame );
+                       frame.show();
                        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), FALSE, FALSE, 0 );
                        {
                                //Prolly should make this a member or global var, so the SI can draw on it...
@@ -1045,38 +1046,38 @@ ui::Window SurfaceInspector::BuildDialog(){
                                gtk_widget_set_events( TexTool::g_textoolWin, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK );
                                gtk_widget_set_can_focus( TexTool::g_textoolWin, true );
                                // <-- end stuff...
-                               gtk_widget_show( TexTool::g_textoolWin );
+                               TexTool::g_textoolWin.show();
                                gtk_widget_set_size_request( TexTool::g_textoolWin, -1, 240 ); //Yeah!
-                               gtk_container_add( GTK_CONTAINER( frame ), TexTool::g_textoolWin );
+                               frame.add(TexTool::g_textoolWin);
 
-                               g_signal_connect( G_OBJECT( TexTool::g_textoolWin ), "size_allocate", G_CALLBACK( TexTool::size_allocate ), NULL );
-                               g_signal_connect( G_OBJECT( TexTool::g_textoolWin ), "expose_event", G_CALLBACK( TexTool::expose ), NULL );
-                               g_signal_connect( G_OBJECT( TexTool::g_textoolWin ), "button_press_event", G_CALLBACK( TexTool::button_press ), NULL );
-                               g_signal_connect( G_OBJECT( TexTool::g_textoolWin ), "button_release_event", G_CALLBACK( TexTool::button_release ), NULL );
-                               g_signal_connect( G_OBJECT( TexTool::g_textoolWin ), "motion_notify_event", G_CALLBACK( TexTool::motion ), NULL );
+                               TexTool::g_textoolWin.connect( "size_allocate", G_CALLBACK( TexTool::size_allocate ), NULL );
+                               TexTool::g_textoolWin.connect( "expose_event", G_CALLBACK( TexTool::expose ), NULL );
+                               TexTool::g_textoolWin.connect( "button_press_event", G_CALLBACK( TexTool::button_press ), NULL );
+                               TexTool::g_textoolWin.connect( "button_release_event", G_CALLBACK( TexTool::button_release ), NULL );
+                               TexTool::g_textoolWin.connect( "motion_notify_event", G_CALLBACK( TexTool::motion ), NULL );
                        }
                        {
                                ui::Widget hbox = ui::HBox( FALSE, 5 );
-                               gtk_widget_show( hbox );
+                               hbox.show();
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), FALSE, FALSE, 0 );
                                // Checkboxes go here... (Flip X/Y)
                                ui::Widget flipX = ui::CheckButton( "Flip X axis" );
                                ui::Widget flipY = ui::CheckButton( "Flip Y axis" );
-                               gtk_widget_show( flipX );
-                               gtk_widget_show( flipY );
+                               flipX.show();
+                               flipY.show();
                                gtk_box_pack_start( GTK_BOX( hbox ), flipX, FALSE, FALSE, 0 );
                                gtk_box_pack_start( GTK_BOX( hbox ), flipY, FALSE, FALSE, 0 );
 
 //Instead of this, we probably need to create a vbox to put into the frame, then the
 //window, then the hbox. !!! FIX !!!
-//        gtk_container_add(GTK_CONTAINER(frame), hbox);
+//        frame.add(hbox);
 
 //Hmm. Do we really need g_object_set_data? Mebbe not... And we don't! :-)
-//        g_object_set_data(G_OBJECT(flipX), "handler", gint_to_pointer(g_signal_connect(G_OBJECT(flipX), "toggled", G_CALLBACK(TexTool::flipX), 0)));
-//        g_object_set_data(G_OBJECT(flipY), "handler", gint_to_pointer(g_signal_connect(G_OBJECT(flipY), "toggled", G_CALLBACK(TexTool::flipY), 0)));
+//        g_object_set_data(G_OBJECT(flipX), "handler", gint_to_pointer(flipX.connect("toggled", G_CALLBACK(TexTool::flipX), 0)));
+//        g_object_set_data(G_OBJECT(flipY), "handler", gint_to_pointer(flipY.connect("toggled", G_CALLBACK(TexTool::flipY), 0)));
 //Instead, just do:
-                               g_signal_connect( G_OBJECT( flipX ), "toggled", G_CALLBACK( TexTool::flipX ), NULL );
-                               g_signal_connect( G_OBJECT( flipY ), "toggled", G_CALLBACK( TexTool::flipY ), NULL );
+                               flipX.connect( "toggled", G_CALLBACK( TexTool::flipX ), NULL );
+                               flipY.connect( "toggled", G_CALLBACK( TexTool::flipY ), NULL );
                        }
                }
 #endif
@@ -1111,11 +1112,11 @@ void SurfaceInspector::Update(){
        const char * name = SurfaceInspector_GetSelectedShader();
 
        if ( shader_is_texture( name ) ) {
-               gtk_entry_set_text( m_texture, shader_get_textureName( name ) );
+               m_texture.text(shader_get_textureName(name));
        }
        else
        {
-               gtk_entry_set_text( m_texture, "" );
+               m_texture.text("");
        }
 
        texdef_t shiftScaleRotate;
@@ -1171,12 +1172,12 @@ void SurfaceInspector::Update(){
 
                for ( GtkCheckButton** p = m_surfaceFlags; p != m_surfaceFlags + 32; ++p )
                {
-                       toggle_button_set_active_no_signal( GTK_TOGGLE_BUTTON( *p ), flags.m_surfaceFlags & ( 1 << ( p - m_surfaceFlags ) ) );
+                       toggle_button_set_active_no_signal( ui::CheckButton( *p ), flags.m_surfaceFlags & ( 1 << ( p - m_surfaceFlags ) ) );
                }
 
                for ( GtkCheckButton** p = m_contentFlags; p != m_contentFlags + 32; ++p )
                {
-                       toggle_button_set_active_no_signal( GTK_TOGGLE_BUTTON( *p ), flags.m_contentFlags & ( 1 << ( p - m_contentFlags ) ) );
+                       toggle_button_set_active_no_signal( ui::CheckButton( *p ), flags.m_contentFlags & ( 1 << ( p - m_contentFlags ) ) );
                }
        }
 }