]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/surfacedialog.cpp
Support lambda callbacks
[xonotic/netradiant.git] / radiant / surfacedialog.cpp
index f97745598e2c551174ca5ea4321368f6d9614056..498182d60aa1fd45f0b177bc544466bad635ff9b 100644 (file)
@@ -88,8 +88,8 @@ gboolean expose( ui::Widget, GdkEventExpose *, gpointer );
 gboolean button_press( ui::Widget, GdkEventButton *, gpointer );
 gboolean button_release( ui::Widget, GdkEventButton *, gpointer );
 gboolean motion( ui::Widget, GdkEventMotion *, gpointer );
-void flipX( GtkToggleButton *, gpointer );
-void flipY( GtkToggleButton *, gpointer );
+void flipX( ui::ToggleButton, gpointer );
+void flipY( ui::ToggleButton, gpointer );
 
 //End Textool function prototypes
 
@@ -105,7 +105,7 @@ void queueDraw(){
 
 #endif
 
-inline void spin_button_set_step( GtkSpinButton* spin, gfloat step ){
+inline void spin_button_set_step( ui::SpinButton spin, gfloat step ){
 #if 1
     gtk_adjustment_set_step_increment(gtk_spin_button_get_adjustment( spin ), step);
 #else
@@ -120,7 +120,7 @@ class Increment
 {
 float& m_f;
 public:
-GtkSpinButton* m_spin;
+ui::SpinButton m_spin;
 ui::Entry m_entry;
 Increment( float& f ) : m_f( f ), m_spin( 0 ), m_entry( ui::null ){
 }
@@ -174,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 ) ),
@@ -210,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() ) {
@@ -577,7 +577,7 @@ const char* getContentFlagName( std::size_t bit ){
 // =============================================================================
 // SurfaceInspector class
 
-guint togglebutton_connect_toggled( GtkToggleButton* button, const Callback& callback ){
+guint togglebutton_connect_toggled( ui::ToggleButton button, const Callback& callback ){
        return g_signal_connect_swapped( G_OBJECT( button ), "toggled", G_CALLBACK( callback.getThunk() ), callback.getEnvironment() );
 }
 
@@ -593,25 +593,25 @@ ui::Window SurfaceInspector::BuildDialog(){
 
        {
                // replaced by only the vbox:
-               ui::Widget vbox = ui::VBox( FALSE, 5 );
+               auto vbox = ui::VBox( FALSE, 5 );
                vbox.show();
                window.add(vbox);
                gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
 
                {
-                       ui::Widget hbox2 = ui::HBox( FALSE, 5 );
+                       auto hbox2 = ui::HBox( FALSE, 5 );
                        hbox2.show();
-                       gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox2 ), FALSE, FALSE, 0 );
+                       vbox.pack_start( hbox2, FALSE, FALSE, 0 );
 
                        {
                                ui::Widget label = ui::Label( "Texture" );
                                label.show();
-                               gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 );
+                               hbox2.pack_start( label, FALSE, TRUE, 0 );
                        }
                        {
-                               auto entry = ui::Entry();
+                               auto entry = ui::Entry(ui::New);
                                entry.show();
-                               gtk_box_pack_start( GTK_BOX( hbox2 ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
+                               hbox2.pack_start( entry, TRUE, TRUE, 0 );
                                m_texture = entry;
                                m_textureEntry.connect( entry );
                                GlobalTextureEntryCompletion::instance().connect( entry );
@@ -620,44 +620,36 @@ ui::Window SurfaceInspector::BuildDialog(){
 
 
                {
-                       ui::Widget table = ui::Table( 6, 4, FALSE );
+                       auto table = ui::Table(6, 4, FALSE);
                        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 );
+                       vbox.pack_start( table, FALSE, FALSE, 0 );
+                       gtk_table_set_row_spacings(table, 5);
+                       gtk_table_set_col_spacings(table, 5);
                        {
                                ui::Widget label = ui::Label( "Horizontal shift" );
                                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 );
+                               table.attach(label, {0, 1, 0, 1}, {GTK_FILL, 0});
                        }
                        {
                                auto spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 );
                                m_hshiftIncrement.m_spin = spin;
                                m_hshiftSpinner.connect( 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 );
-                               gtk_widget_set_size_request( GTK_WIDGET( spin ), 60, -1 );
+                               table.attach(spin, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0});
+                spin.dimensions(60, -1);
                        }
                        {
                                ui::Widget label = ui::Label( "Step" );
                                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 );
+                               table.attach(label, {2, 3, 0, 1}, {GTK_FILL, 0});
                        }
                        {
-                               auto entry = ui::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 );
-                               gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
+                               table.attach(entry, {3, 4, 0, 1}, {GTK_EXPAND | GTK_FILL, 0});
+                entry.dimensions(50, -1);
                                m_hshiftIncrement.m_entry = entry;
                                m_hshiftEntry.connect( entry );
                        }
@@ -665,35 +657,27 @@ ui::Window SurfaceInspector::BuildDialog(){
                                ui::Widget label = ui::Label( "Vertical shift" );
                                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 );
+                               table.attach(label, {0, 1, 1, 2}, {GTK_FILL, 0});
                        }
                        {
                                auto spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 );
                                m_vshiftIncrement.m_spin = spin;
                                m_vshiftSpinner.connect( spin );
                                spin.show();
-                               gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 1, 2,
-                                                                 (GtkAttachOptions) ( GTK_FILL ),
-                                                                 (GtkAttachOptions) ( 0 ), 0, 0 );
-                               gtk_widget_set_size_request( GTK_WIDGET( spin ), 60, -1 );
+                               table.attach(spin, {1, 2, 1, 2}, {GTK_FILL, 0});
+                spin.dimensions(60, -1);
                        }
                        {
                                ui::Widget label = ui::Label( "Step" );
                                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 );
+                               table.attach(label, {2, 3, 1, 2}, {GTK_FILL, 0});
                        }
                        {
-                               auto entry = ui::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 );
-                               gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
+                               table.attach(entry, {3, 4, 1, 2}, {GTK_FILL, 0});
+                entry.dimensions(50, -1);
                                m_vshiftIncrement.m_entry = entry;
                                m_vshiftEntry.connect( entry );
                        }
@@ -701,35 +685,27 @@ ui::Window SurfaceInspector::BuildDialog(){
                                ui::Widget label = ui::Label( "Horizontal stretch" );
                                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 );
+                               table.attach(label, {0, 1, 2, 3}, {GTK_FILL, 0});
                        }
                        {
                                auto spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 5 );
                                m_hscaleIncrement.m_spin = spin;
                                m_hscaleSpinner.connect( spin );
                                spin.show();
-                               gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 2, 3,
-                                                                 (GtkAttachOptions) ( GTK_FILL ),
-                                                                 (GtkAttachOptions) ( 0 ), 0, 0 );
-                               gtk_widget_set_size_request( GTK_WIDGET( spin ), 60, -1 );
+                               table.attach(spin, {1, 2, 2, 3}, {GTK_FILL, 0});
+                spin.dimensions(60, -1);
                        }
                        {
                                ui::Widget label = ui::Label( "Step" );
                                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 );
+                               table.attach(label, {2, 3, 2, 3}, {GTK_FILL, 0});
                        }
                        {
-                               auto entry = ui::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 );
-                               gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
+                               table.attach(entry, {3, 4, 2, 3}, {GTK_FILL, 0});
+                entry.dimensions(50, -1);
                                m_hscaleIncrement.m_entry = entry;
                                m_hscaleEntry.connect( entry );
                        }
@@ -737,35 +713,27 @@ ui::Window SurfaceInspector::BuildDialog(){
                                ui::Widget label = ui::Label( "Vertical stretch" );
                                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 );
+                               table.attach(label, {0, 1, 3, 4}, {GTK_FILL, 0});
                        }
                        {
                                auto spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 5 );
                                m_vscaleIncrement.m_spin = spin;
                                m_vscaleSpinner.connect( spin );
                                spin.show();
-                               gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 3, 4,
-                                                                 (GtkAttachOptions) ( GTK_FILL ),
-                                                                 (GtkAttachOptions) ( 0 ), 0, 0 );
-                               gtk_widget_set_size_request( GTK_WIDGET( spin ), 60, -1 );
+                               table.attach(spin, {1, 2, 3, 4}, {GTK_FILL, 0});
+                spin.dimensions(60, -1);
                        }
                        {
                                ui::Widget label = ui::Label( "Step" );
                                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 );
+                               table.attach(label, {2, 3, 3, 4}, {GTK_FILL, 0});
                        }
                        {
-                               auto entry = ui::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 );
-                               gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
+                               table.attach(entry, {3, 4, 3, 4}, {GTK_FILL, 0});
+                entry.dimensions(50, -1);
                                m_vscaleIncrement.m_entry = entry;
                                m_vscaleEntry.connect( entry );
                        }
@@ -773,36 +741,28 @@ ui::Window SurfaceInspector::BuildDialog(){
                                ui::Widget label = ui::Label( "Rotate" );
                                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 );
+                               table.attach(label, {0, 1, 4, 5}, {GTK_FILL, 0});
                        }
                        {
                                auto spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 );
                                m_rotateIncrement.m_spin = spin;
                                m_rotateSpinner.connect( spin );
                                spin.show();
-                               gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 4, 5,
-                                                                 (GtkAttachOptions) ( GTK_FILL ),
-                                                                 (GtkAttachOptions) ( 0 ), 0, 0 );
-                               gtk_widget_set_size_request( GTK_WIDGET( spin ), 60, -1 );
+                               table.attach(spin, {1, 2, 4, 5}, {GTK_FILL, 0});
+                spin.dimensions(60, -1);
                                gtk_spin_button_set_wrap( spin, TRUE );
                        }
                        {
                                ui::Widget label = ui::Label( "Step" );
                                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 );
+                               table.attach(label, {2, 3, 4, 5}, {GTK_FILL, 0});
                        }
                        {
-                               auto entry = ui::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 );
-                               gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
+                               table.attach(entry, {3, 4, 4, 5}, {GTK_FILL, 0});
+                entry.dimensions(50, -1);
                                m_rotateIncrement.m_entry = entry;
                                m_rotateEntry.connect( entry );
                        }
@@ -810,9 +770,7 @@ ui::Window SurfaceInspector::BuildDialog(){
                                // match grid button
                                ui::Widget button = ui::Button( "Match Grid" );
                                button.show();
-                               gtk_table_attach( GTK_TABLE( table ), button, 2, 4, 5, 6,
-                                                                 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
-                                                                 (GtkAttachOptions) ( 0 ), 0, 0 );
+                               table.attach(button, {2, 4, 5, 6}, {GTK_EXPAND | GTK_FILL, 0});
                                button.connect( "clicked", G_CALLBACK( OnBtnMatchGrid ), 0 );
                        }
                }
@@ -820,118 +778,94 @@ ui::Window SurfaceInspector::BuildDialog(){
                {
                        auto frame = ui::Frame( "Texturing" );
                        frame.show();
-                       gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), FALSE, FALSE, 0 );
+                       vbox.pack_start( frame, FALSE, FALSE, 0 );
                        {
-                               ui::Widget table = ui::Table( 4, 4, FALSE );
+                               auto table = ui::Table(4, 4, FALSE);
                                table.show();
                                frame.add(table);
-                               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);
                                gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
                                {
                                        ui::Widget label = ui::Label( "Brush" );
                                        label.show();
-                                       gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
-                                                                         (GtkAttachOptions) ( GTK_FILL ),
-                                                                         (GtkAttachOptions) ( 0 ), 0, 0 );
+                                       table.attach(label, {0, 1, 0, 1}, {GTK_FILL, 0});
                                }
                                {
                                        ui::Widget label = ui::Label( "Patch" );
                                        label.show();
-                                       gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
-                                                                         (GtkAttachOptions) ( GTK_FILL ),
-                                                                         (GtkAttachOptions) ( 0 ), 0, 0 );
+                                       table.attach(label, {0, 1, 2, 3}, {GTK_FILL, 0});
                                }
                                {
                                        ui::Widget label = ui::Label( "Width" );
                                        label.show();
-                                       gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1,
-                                                                         (GtkAttachOptions) ( GTK_FILL ),
-                                                                         (GtkAttachOptions) ( 0 ), 0, 0 );
+                                       table.attach(label, {2, 3, 0, 1}, {GTK_FILL, 0});
                                }
                                {
                                        ui::Widget label = ui::Label( "Height" );
                                        label.show();
-                                       gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1,
-                                                                         (GtkAttachOptions) ( GTK_FILL ),
-                                                                         (GtkAttachOptions) ( 0 ), 0, 0 );
+                                       table.attach(label, {3, 4, 0, 1}, {GTK_FILL, 0});
                                }
                                {
                                        ui::Widget button = ui::Button( "Axial" );
                                        button.show();
-                                       gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2,
-                                                                         (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
-                                                                         (GtkAttachOptions) ( 0 ), 0, 0 );
+                                       table.attach(button, {0, 1, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
                                        button.connect( "clicked",
                                                                          G_CALLBACK( OnBtnAxial ), 0 );
-                                       gtk_widget_set_size_request( button, 60, -1 );
+                    button.dimensions(60, -1);
                                }
                                {
                                        ui::Widget button = ui::Button( "Fit" );
                                        button.show();
-                                       gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 1, 2,
-                                                                         (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
-                                                                         (GtkAttachOptions) ( 0 ), 0, 0 );
+                                       table.attach(button, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
                                        button.connect( "clicked",
                                                                          G_CALLBACK( OnBtnFaceFit ), 0 );
-                                       gtk_widget_set_size_request( button, 60, -1 );
+                    button.dimensions(60, -1);
                                }
                                {
                                        ui::Widget button = ui::Button( "CAP" );
                                        button.show();
-                                       gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 3, 4,
-                                                                         (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
-                                                                         (GtkAttachOptions) ( 0 ), 0, 0 );
+                                       table.attach(button, {0, 1, 3, 4}, {GTK_EXPAND | GTK_FILL, 0});
                                        button.connect( "clicked",
                                                                          G_CALLBACK( OnBtnPatchdetails ), 0 );
-                                       gtk_widget_set_size_request( button, 60, -1 );
+                    button.dimensions(60, -1);
                                }
                                {
                                        ui::Widget button = ui::Button( "Set..." );
                                        button.show();
-                                       gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 3, 4,
-                                                                         (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
-                                                                         (GtkAttachOptions) ( 0 ), 0, 0 );
+                                       table.attach(button, {1, 2, 3, 4}, {GTK_EXPAND | GTK_FILL, 0});
                                        button.connect( "clicked",
                                                                          G_CALLBACK( OnBtnPatchreset ), 0 );
-                                       gtk_widget_set_size_request( button, 60, -1 );
+                    button.dimensions(60, -1);
                                }
                                {
                                        ui::Widget button = ui::Button( "Natural" );
                                        button.show();
-                                       gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 3, 4,
-                                                                         (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
-                                                                         (GtkAttachOptions) ( 0 ), 0, 0 );
+                                       table.attach(button, {2, 3, 3, 4}, {GTK_EXPAND | GTK_FILL, 0});
                                        button.connect( "clicked",
                                                                          G_CALLBACK( OnBtnPatchnatural ), 0 );
-                                       gtk_widget_set_size_request( button, 60, -1 );
+                    button.dimensions(60, -1);
                                }
                                {
                                        ui::Widget button = ui::Button( "Fit" );
                                        button.show();
-                                       gtk_table_attach( GTK_TABLE( table ), button, 3, 4, 3, 4,
-                                                                         (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
-                                                                         (GtkAttachOptions) ( 0 ), 0, 0 );
+                                       table.attach(button, {3, 4, 3, 4}, {GTK_EXPAND | GTK_FILL, 0});
                                        button.connect( "clicked",
                                                                          G_CALLBACK( OnBtnPatchFit ), 0 );
-                                       gtk_widget_set_size_request( button, 60, -1 );
+                    button.dimensions(60, -1);
                                }
                                {
                                        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 );
-                                       gtk_widget_set_size_request( spin, 60, -1 );
+                                       table.attach(spin, {2, 3, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
+                    spin.dimensions(60, -1);
                                        AddDialogData( *GTK_SPIN_BUTTON( spin ), m_fitHorizontal );
                                }
                                {
                                        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 );
-                                       gtk_widget_set_size_request( spin, 60, -1 );
+                                       table.attach(spin, {3, 4, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
+                    spin.dimensions(60, -1);
                                        AddDialogData( *GTK_SPIN_BUTTON( spin ), m_fitVertical );
                                }
                        }
@@ -940,7 +874,7 @@ ui::Window SurfaceInspector::BuildDialog(){
                        {
                                auto frame = ui::Frame( "Surface Flags" );
                                frame.show();
-                               gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
+                               vbox.pack_start( frame, TRUE, TRUE, 0 );
                                {
                                        auto vbox3 = ui::VBox( FALSE, 4 );
                                        //gtk_container_set_border_width(GTK_CONTAINER(vbox3), 4);
@@ -949,23 +883,21 @@ ui::Window SurfaceInspector::BuildDialog(){
                                        {
                                                auto table = ui::Table( 8, 4, FALSE );
                                                table.show();
-                                               gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
+                                               vbox3.pack_start( table, TRUE, TRUE, 0 );
                                                gtk_table_set_row_spacings( table, 0 );
                                                gtk_table_set_col_spacings( table, 0 );
 
                                                GtkCheckButton** p = m_surfaceFlags;
 
-                                               for ( int c = 0; c != 4; ++c )
+                                               for (unsigned int c = 0; c != 4; ++c)
                                                {
-                                                       for ( int r = 0; r != 8; ++r )
+                                                       for (unsigned int r = 0; r != 8; ++r)
                                                        {
                                                                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 );
+                                                               table.attach(check, {c, c + 1, r, r + 1}, {GTK_EXPAND | GTK_FILL, 0});
                                                                *p++ = check;
-                                                               guint handler_id = togglebutton_connect_toggled( GTK_TOGGLE_BUTTON( check ), ApplyFlagsCaller( *this ) );
+                                                               guint handler_id = togglebutton_connect_toggled( check, ApplyFlagsCaller( *this ) );
                                                                g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( handler_id ) );
                                                        }
                                                }
@@ -975,7 +907,7 @@ ui::Window SurfaceInspector::BuildDialog(){
                        {
                                auto frame = ui::Frame( "Content Flags" );
                                frame.show();
-                               gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
+                               vbox.pack_start( frame, TRUE, TRUE, 0 );
                                {
                                        auto vbox3 = ui::VBox( FALSE, 4 );
                                        //gtk_container_set_border_width(GTK_CONTAINER(vbox3), 4);
@@ -985,36 +917,34 @@ ui::Window SurfaceInspector::BuildDialog(){
 
                                                auto table = ui::Table( 8, 4, FALSE );
                                                table.show();
-                                               gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
+                                               vbox3.pack_start( table, TRUE, TRUE, 0 );
                                                gtk_table_set_row_spacings( table, 0 );
                                                gtk_table_set_col_spacings( table, 0 );
 
                                                GtkCheckButton** p = m_contentFlags;
 
-                                               for ( int c = 0; c != 4; ++c )
+                                               for (unsigned int c = 0; c != 4; ++c)
                                                {
-                                                       for ( int r = 0; r != 8; ++r )
+                                                       for (unsigned int r = 0; r != 8; ++r)
                                                        {
                                                                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 );
+                                                               table.attach(check, {c, c + 1, r, r + 1}, {GTK_EXPAND | GTK_FILL, 0});
                                                                *p++ = check;
-                                                               guint handler_id = togglebutton_connect_toggled( GTK_TOGGLE_BUTTON( check ), ApplyFlagsCaller( *this ) );
+                                                               guint handler_id = togglebutton_connect_toggled( check, ApplyFlagsCaller( *this ) );
                                                                g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( handler_id ) );
                                                        }
                                                }
 
                                                // not allowed to modify detail flag using Surface Inspector
-                                               gtk_widget_set_sensitive( GTK_WIDGET( m_contentFlags[BRUSH_DETAIL_FLAG] ), FALSE );
+                                               gtk_widget_set_sensitive( ui::CheckButton(m_contentFlags[BRUSH_DETAIL_FLAG]), FALSE );
                                        }
                                }
                        }
                        {
                                auto frame = ui::Frame( "Value" );
                                frame.show();
-                               gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
+                               vbox.pack_start( frame, TRUE, TRUE, 0 );
                                {
                                        auto vbox3 = ui::VBox( FALSE, 4 );
                                        gtk_container_set_border_width( GTK_CONTAINER( vbox3 ), 4 );
@@ -1022,9 +952,9 @@ ui::Window SurfaceInspector::BuildDialog(){
                                        frame.add(vbox3);
 
                                        {
-                                               auto entry = ui::Entry();
+                                               auto entry = ui::Entry(ui::New);
                                                entry.show();
-                                               gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
+                                               vbox3.pack_start( entry, TRUE, TRUE, 0 );
                                                m_valueEntryWidget = entry;
                                                m_valueEntry.connect( entry );
                                        }
@@ -1037,7 +967,7 @@ ui::Window SurfaceInspector::BuildDialog(){
 // Shamus: Textool goodies...
                        ui::Widget frame = ui::Frame( "Textool" );
                        frame.show();
-                       gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), FALSE, FALSE, 0 );
+                       vbox.pack_start( frame , FALSE, FALSE, 0 );
                        {
                                //Prolly should make this a member or global var, so the SI can draw on it...
                                TexTool::g_textoolWin = glwidget_new( FALSE );
@@ -1047,7 +977,7 @@ ui::Window SurfaceInspector::BuildDialog(){
                                gtk_widget_set_can_focus( TexTool::g_textoolWin, true );
                                // <-- end stuff...
                                TexTool::g_textoolWin.show();
-                               gtk_widget_set_size_request( TexTool::g_textoolWin, -1, 240 ); //Yeah!
+                               TexTool::g_textoolWin.dimensions( -1, 240 ); //Yeah!
                                frame.add(TexTool::g_textoolWin);
 
                                TexTool::g_textoolWin.connect( "size_allocate", G_CALLBACK( TexTool::size_allocate ), NULL );
@@ -1059,14 +989,14 @@ ui::Window SurfaceInspector::BuildDialog(){
                        {
                                ui::Widget hbox = ui::HBox( FALSE, 5 );
                                hbox.show();
-                               gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), FALSE, FALSE, 0 );
+                               vbox.pack_start( 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" );
                                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 );
+                               hbox.pack_start( flipX, FALSE, FALSE, 0 );
+                               hbox.pack_start( 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 !!!
@@ -1096,15 +1026,15 @@ ui::Window SurfaceInspector::BuildDialog(){
    ===============
  */
 
-void spin_button_set_value_no_signal( GtkSpinButton* spin, gdouble value ){
+void spin_button_set_value_no_signal( ui::SpinButton spin, gdouble value ){
        guint handler_id = gpointer_to_int( g_object_get_data( G_OBJECT( spin ), "handler" ) );
        g_signal_handler_block( G_OBJECT( gtk_spin_button_get_adjustment( spin ) ), handler_id );
        gtk_spin_button_set_value( spin, value );
        g_signal_handler_unblock( G_OBJECT( gtk_spin_button_get_adjustment( spin ) ), handler_id );
 }
 
-void spin_button_set_step_increment( GtkSpinButton* spin, gdouble value ){
-       GtkAdjustment* adjust = gtk_spin_button_get_adjustment( spin );
+void spin_button_set_step_increment( ui::SpinButton spin, gdouble value ){
+       auto adjust = gtk_spin_button_get_adjustment( spin );
        gtk_adjustment_set_step_increment(adjust, value);
 }
 
@@ -1112,11 +1042,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;
@@ -2278,7 +2208,7 @@ gboolean motion( ui::Widget win, GdkEventMotion * e, gpointer ){
 
 //It seems the fake tex coords conversion is screwing this stuff up... !!! FIX !!!
 //This is still wrong... Prolly need to do something with the oldScaleX/Y stuff...
-void flipX( GtkToggleButton *, gpointer ){
+void flipX( ui::ToggleButton, gpointer ){
 //     globalOutputStream() << "--> Flip X...\n";
        //Shamus:
 //     SurfaceInspector_GetSelectedBPTexdef();         // Refresh g_selectedBrushPrimitTexdef...
@@ -2292,7 +2222,7 @@ void flipX( GtkToggleButton *, gpointer ){
        UpdateControlPoints();
 }
 
-void flipY( GtkToggleButton *, gpointer ){
+void flipY( ui::ToggleButton, gpointer ){
 //     globalOutputStream() << "--> Flip Y...\n";
 //     tm.coords[0][1] = -tm.coords[0][1];
 //     tm.coords[1][1] = -tm.coords[1][1];