]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - contrib/gtkgensurf/gendlgs.cpp
GTK: wrap GTK_WIDGET
[xonotic/netradiant.git] / contrib / gtkgensurf / gendlgs.cpp
index bfaf98490eb3f7fe3649502775c07f4d52775bb3..a6545f34ea13c88ac02adb8c353571e32965f7f3 100644 (file)
@@ -32,7 +32,7 @@
 //#define BUFF_SIZE    32768
 
 #define ENABLE_WIDGET( name,enable ) \
-       gtk_widget_set_sensitive( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), ( name ) ) ), ( enable ) )
+       gtk_widget_set_sensitive( g_object_get_data( G_OBJECT( g_pWnd , ( name ) ) ), ( enable ) )
 #define CHECK_WIDGET( name,check ) \
        gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( g_object_get_data( G_OBJECT( g_pWnd ), name ) ), check )
 
@@ -111,12 +111,12 @@ static void SetupControls(){
 
        case EXTENTS_TAB:
                if ( Game != QUAKE3 ) {
-                       gtk_widget_hide( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "use_patches" ) ) );
+                       gtk_widget_hide( g_object_get_data( G_OBJECT( g_pWnd , "use_patches" ) ) );
                        ENABLE_WIDGET( "use_patches", FALSE );
                }
                else
                {
-                       gtk_widget_show( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "use_patches" ) ) );
+                       gtk_widget_show( g_object_get_data( G_OBJECT( g_pWnd , "use_patches" ) ) );
                        ENABLE_WIDGET( "use_patches", TRUE );
                }
 
@@ -316,7 +316,7 @@ static void SetDlgValues( int tab ){
                                                                  Decimate );
 
                if ( Game == QUAKE3 && UsePatches ) {
-                       gtk_widget_set_sensitive( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "decimate" ) ), FALSE );
+                       gtk_widget_set_sensitive( g_object_get_data( G_OBJECT( g_pWnd , "decimate" ) ), FALSE );
 
                        if ( NH % 2 ) {
                                NH++;
@@ -363,7 +363,7 @@ static void SetDlgValues( int tab ){
                }
                else
                {
-                       gtk_widget_set_sensitive( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "decimate" ) ), TRUE );
+                       gtk_widget_set_sensitive( g_object_get_data( G_OBJECT( g_pWnd , "decimate" ) ), TRUE );
 
                        gpointer spin = g_object_get_data( G_OBJECT( g_pWnd ), "nh" );
                        GtkAdjustment *adj = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
@@ -718,7 +718,7 @@ static void main_about( GtkWidget *widget, gpointer data ){
 }
 
 static void main_go( GtkWidget *widget, gpointer data ){
-       GtkWidget *notebook = GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "notebook" ) );
+       GtkWidget *notebook = g_object_get_data( G_OBJECT( g_pWnd , "notebook" ) );
        char Text[256];
 
        ReadDlgValues( current_tab );
@@ -1100,19 +1100,19 @@ void create_tooltips(){
 
        // Main
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "go" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "go" ) ),
                                                  "Accept all input and generate a surface in Q3Radiant",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "open" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "open" ) ),
                                                  "Open a previously saved GenSurf settings file.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "save" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "save" ) ),
                                                  "Save all settings to a file.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "defaults" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "defaults" ) ),
                                                  "Restore default values from DEFAULTS.SRF. If this file does not exist, GenSurf "
                                                  "initializes all input parameters to reasonable values. You can create your own "
                                                  "default surface by setting all parameters to your liking, then saving a settings "
@@ -1120,105 +1120,105 @@ void create_tooltips(){
                                                  "" );
 
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "main_preview" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "main_preview" ) ),
                                                  "View a wire-frame representation of the surface",
                                                  "" );
 
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "main_antialiasing" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "main_antialiasing" ) ),
                                                  "The lines in the preview window are antialiased for better quality",
                                                  "" );
 
        // General tab
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( wave_radios[0] ),
+                                                 wave_radios[0] ,
                                                  "Builds a surface with alternating hills and valleys. Uses the general form Z=cos(X) "
                                                  "x sin(Y)",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( wave_radios[1] ),
+                                                 wave_radios[1] ,
                                                  "Builds a surface with ridges parallel to the vertical axis.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( wave_radios[2] ),
+                                                 wave_radios[2] ,
                                                  "Builds a surface with ridges parallel to the horizontal axis.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( wave_radios[3] ),
+                                                 wave_radios[3] ,
                                                  "Builds a map from a bitmap image representing a contour plot. Click the \"Bitmap\" "
                                                  "tab to select the image. GenSurf only supports 256-color (8 bit) "
                                                  "bitmaps. GenSurf will work with any 256-color bitmap, but gray scale bitmaps are a bit "
                                                  "more intuitive.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( wave_radios[4] ),
+                                                 wave_radios[4] ,
                                                  "Builds a random surface using the Plasma Cloud technique. Variance is controlled "
                                                  "by the Roughness input. To build a surface with completely random values not "
                                                  "dependent on neighboring vertices, use one of the other waveforms with 0 amplitude.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "wavelength" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "wavelength" ) ),
                                                  "Enter the wavelength (distance between crests). NOTE: Wavelengths equal to the grid "
                                                  "size or 2 times the grid size will result in 0 amplitudes. For best results, the "
                                                  "wavelength value should be at least 4 times the grid size (extents divided by the "
                                                  "number of divisions",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "amplitude" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "amplitude" ) ),
                                                  "Enter the height of hills/ridges.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "roughness" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "roughness" ) ),
                                                  "Enter the roughness value (noise) for the surface. For fractal surfaces, this value "
                                                  "is used as a variance in the fractal calculations.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "random" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "random" ) ),
                                                  "Seed value for the pseudo-random number generator.",
                                                  "" );
        // Extents tab
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "hmin" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "hmin" ) ),
                                                  "Minimum horizontal coordinate of the surface, i.e. X for a surface parallel to "
                                                  "the XY or XZ planes, Y for a surface parallel to the YZ plane. For best results, "
                                                  "the extents (maximum-minimum values) in a given direction should be evenly "
                                                  "divisible by the number of divisions in that direction.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "hmax" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "hmax" ) ),
                                                  "Maximum horizontal coordinate of the surface, i.e. X for a surface parallel to "
                                                  "the XY or XZ planes, Y for a surface parallel to the YZ plane. For best results, "
                                                  "the extents (maximum-minimum values) in a given direction should be evenly "
                                                  "divisible by the number of divisions in that direction.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "vmin" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "vmin" ) ),
                                                  "Minimum vertical coordinate of the surface, i.e. Y for a surface parallel to "
                                                  "the XY plane, Z for a surface parallel to the XZ or YZ planes. For best results, "
                                                  "the extents (maximum-minimum values) in a given direction should be evenly "
                                                  "divisible by the number of divisions in that direction.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "vmax" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "vmax" ) ),
                                                  "Maximum vertical coordinate of the surface, i.e. Y for a surface parallel to "
                                                  "the XY plane, Z for a surface parallel to the XZ or YZ planes. For best results, "
                                                  "the extents (maximum-minimum values) in a given direction should be evenly "
                                                  "divisible by the number of divisions in that direction.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "nh" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "nh" ) ),
                                                  "Number of divisions in the horizontal direction. For best results, the extents "
                                                  "in a given direction should be evenly divisible by the number of divisions in "
                                                  "that direction.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "nv" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "nv" ) ),
                                                  "Number of divisions in the vertical direction. For best results, the extents "
                                                  "in a given direction should be evenly divisible by the number of divisions in "
                                                  "that direction.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "use_patches" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "use_patches" ) ),
                                                  "Produce one or more curved patches in the shape of your selected surface rather "
                                                  "than producing solid brushes. Depending on the size of your surface (and the "
                                                  "user's graphic detail settings, which you cannot control), curved surfaces will "
@@ -1226,7 +1226,7 @@ void create_tooltips(){
                                                  "concerning curved surfaces on the GenSurf web page before using this feature.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "decimate" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "decimate" ) ),
                                                  "Use the slider to control the number of vertices discarded by GenSurf. For many "
                                                  "surfaces, you can produce roughly the same shape surface with a high decimation "
                                                  "value. This will generally result in a map with lower polygon counts (and better "
@@ -1234,71 +1234,71 @@ void create_tooltips(){
                                                  "surfaces in Q3",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "z00" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "z00" ) ),
                                                  "Enter the height of the surface at the lower left corner. This value will likely "
                                                  "be modified unless \"Linear Borders\" is checked.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "z01" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "z01" ) ),
                                                  "Enter the height of the surface at the upper left corner. This value will likely "
                                                  "be modified unless \"Linear Borders\" is checked.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "z10" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "z10" ) ),
                                                  "Enter the height of the surface at the lower right corner. This value will likely "
                                                  "be modified unless \"Linear Borders\" is checked.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "z11" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "z11" ) ),
                                                  "Enter the height of the surface at the upper right corner. This value will likely "
                                                  "be modified unless \"Linear Borders\" is checked.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "linearborder" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "linearborder" ) ),
                                                  "Restrict the edges of the surface to a straight line. This will help match up "
                                                  "brush edges if you drop this surface into another map.",
                                                  "" );
        // Bitmap tab
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_file" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "bmp_file" ) ),
                                                  "Type the name of an 8-bit bitmap image file, or click Browse to select an image "
                                                  "from a list of those available on your system.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_file_browse" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "bmp_file_browse" ) ),
                                                  "Select a bitmap image file from a list of those available on your system.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_reload" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "bmp_reload" ) ),
                                                  "Reload the selected bitmap file after making changes in an external image editor.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_black" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "bmp_black" ) ),
                                                  "Enter the value corresponding to color index 0 in the bitmap file. For gray scale "
                                                  "images, color 0 is normally black.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_white" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "bmp_white" ) ),
                                                  "Enter the value corresponding to color index 255 in the bitmap file. For gray scale "
                                                  "images, color 255 is normally white.",
                                                  "" );
        // Fixpoints tab
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "fix_value" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "fix_value" ) ),
                                                  "Enter a value for the selected vertex. This value will not be adjusted when applying "
                                                  "a waveform or roughness to the surface. Unlock this vertex (so that it will be "
                                                  "adjusted normally) by clicking \"Free\". This vertex will influence vertices within "
                                                  "the \"Range affected\" of this vertex.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "fix_range" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "fix_range" ) ),
                                                  "Enter the range away from the selected vertex that other vertices will be affected. "
                                                  "Use 0 if you don't want other vertices to be influenced by the currently selected "
                                                  "one. Note: this box is disabled if you've chosen the fractal generator, as it uses "
                                                  "a completely different method for determining values.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "fix_rate" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "fix_rate" ) ),
                                                  "Enter a rate of change for the surface affected by the fixed value. 0 gives a smooth "
                                                  "sinusoidal curve, values less than 0 give progressively sharper spikes, and values "
                                                  "greater than 0 take on a square shape. Values less than -30 or greater than 30 are "
@@ -1306,32 +1306,32 @@ void create_tooltips(){
                                                  "you also specify a \"range affected\".",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "fix_free" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "fix_free" ) ),
                                                  "Click this to free (unlock the value of) the currently selected vertex.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "fix_freeall" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "fix_freeall" ) ),
                                                  "Click this to free (unlock the values of) all vertices.",
                                                  "" );
        // Texture tab
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "texture1" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "texture1" ) ),
                                                  "Enter the name of the texture or shader used for the surface faces.",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "texture2" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "texture2" ) ),
                                                  "Enter the name of the texture or shader used for faces other than the surface. Under "
                                                  "normal circumstances this should be \"common/caulk\"",
                                                  "" );
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "texture3" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "texture3" ) ),
                                                  "Enter the name of the texture or shader used for \"steep\" surface faces, where \"steep\" "
                                                  "is the angle specified below. If this entry is left blank or if the \"steep\" angle is 0, "
                                                  "all surface faces will use the texture specified by \"Surface\".",
                                                  "" );
 
        gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ),
-                                                 GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "detail" ) ),
+                                                 g_object_get_data( G_OBJECT( g_pWnd , "detail" ) ),
                                                  "Check this box to use the detail content property on the generated brushes. Compile "
                                                  "times will be considerably shorter if the detail property is used, though the surface "
                                                  "will not block visibility at all. If you use the detail property, you should make sure "
@@ -1344,9 +1344,9 @@ void create_tooltips(){
 // create main dialog
 
 GtkWidget* create_main_dialog(){
-       GtkWidget *dlg, *vbox, *hbox, *hbox2, *button, *notebook, *frame, *table, *table2;
+       GtkWidget *hbox2, *button, *notebook, *table2;
        GtkWidget *check, *spin, *radio, *label, *entry, *scale;
-       GtkObject *adj;
+       ui::Adjustment adj;
        GSList *group;
        int i;
        const char *games[] = { "Quake 2", "Half-Life", "SiN", "Heretic 2", "Kingpin", "Genesis3D", "Quake 3 Arena" };
@@ -1355,501 +1355,501 @@ GtkWidget* create_main_dialog(){
        const char *orientations[] = { "Ground surface", "Ceiling", "Wall facing 0", "Wall facing 90",
                                                                   "Wall facing 180","Wall facing 270" };
 
-       g_pWnd = dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       auto dlg = g_pWnd = ui::Window( ui::window_type::TOP );
        gtk_window_set_title( GTK_WINDOW( dlg ), gszCaption );
-       g_signal_connect( G_OBJECT( dlg ), "delete_event", G_CALLBACK( main_close ), NULL );
-       //  g_signal_connect (G_OBJECT (dlg), "destroy", G_CALLBACK (gtk_widget_destroy), NULL);
+       dlg.connect( "delete_event", G_CALLBACK( main_close ), NULL );
+       //  dlg.connect( "destroy", G_CALLBACK (gtk_widget_destroy), NULL);
        gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pRadiantWnd ) );
 
-       hbox = gtk_hbox_new( FALSE, 5 );
-       gtk_widget_show( hbox );
-       gtk_container_add( GTK_CONTAINER( dlg ), hbox );
+       auto hbox = ui::HBox( FALSE, 5 );
+       hbox.show();
+       dlg.add(hbox);
        gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 );
 
        notebook = gtk_notebook_new();
-       gtk_widget_show( notebook );
-       gtk_box_pack_start( GTK_BOX( hbox ), notebook, TRUE, TRUE, 0 );
-       g_signal_connect( G_OBJECT( notebook ), "switch_page",
+       notebook.show();
+       hbox.pack_start( notebook, TRUE, TRUE, 0 );
+       notebook.connect( "switch_page",
                                          G_CALLBACK( switch_page ), NULL );
        gtk_notebook_set_tab_pos( GTK_NOTEBOOK( notebook ), GTK_POS_TOP );
        g_object_set_data( G_OBJECT( dlg ), "notebook", notebook );
 
-       table = gtk_table_new( 2, 2, FALSE );
-       gtk_widget_show( table );
+       table = ui::Table( 2, 2, FALSE );
+       table.show();
        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 );
 
-       label = gtk_label_new( "General" );
-       gtk_widget_show( label );
+       label = ui::Label( "General" );
+       label.show();
        gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), table, label );
 
-       frame = gtk_frame_new( "Game" );
-       gtk_widget_show( frame );
+       auto frame = ui::Frame( "Game" );
+       frame.show();
        gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
 
-       vbox = gtk_vbox_new( TRUE, 5 );
-       gtk_widget_show( vbox );
-       gtk_container_add( GTK_CONTAINER( frame ), vbox );
+       auto vbox = ui::VBox( TRUE, 5 );
+       vbox.show();
+       frame.add(vbox);
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
 
        for ( i = 0, group = NULL; i < NUMGAMES; i++ )
        {
                radio = gtk_radio_button_new_with_label( group, games[i] );
-               gtk_widget_show( radio );
-               gtk_box_pack_start( GTK_BOX( vbox ), radio, TRUE, TRUE, 0 );
-               group = gtk_radio_button_group( GTK_RADIO_BUTTON( radio ) );
+               radio.show();
+               vbox.pack_start( radio, TRUE, TRUE, 0 );
+               group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radio ) );
                game_radios[i] = radio;
-               g_signal_connect( G_OBJECT( radio ), "toggled", G_CALLBACK( general_game ), GINT_TO_POINTER( i ) );
+               radio.connect( "toggled", G_CALLBACK( general_game ), GINT_TO_POINTER( i ) );
        }
 
-       frame = gtk_frame_new( "Waveform" );
-       gtk_widget_show( frame );
+       frame = ui::Frame( "Waveform" );
+       frame.show();
        gtk_table_attach( GTK_TABLE( table ), frame, 1, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
 
-       vbox = gtk_vbox_new( TRUE, 5 );
-       gtk_widget_show( vbox );
-       gtk_container_add( GTK_CONTAINER( frame ), vbox );
+       vbox = ui::VBox( TRUE, 5 );
+       vbox.show();
+       frame.add(vbox);
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
 
        for ( i = 0, group = NULL; i < 5; i++ )
        {
                radio = gtk_radio_button_new_with_label( group, waveforms[i] );
-               gtk_widget_show( radio );
-               gtk_box_pack_start( GTK_BOX( vbox ), radio, TRUE, TRUE, 0 );
-               group = gtk_radio_button_group( GTK_RADIO_BUTTON( radio ) );
+               radio.show();
+               vbox.pack_start( radio, TRUE, TRUE, 0 );
+               group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radio ) );
                wave_radios[i] = radio;
-               g_signal_connect( G_OBJECT( radio ), "toggled", G_CALLBACK( general_wave ), GINT_TO_POINTER( i ) );
+               radio.connect( "toggled", G_CALLBACK( general_wave ), GINT_TO_POINTER( i ) );
        }
 
-       frame = gtk_frame_new( "Orientation" );
-       gtk_widget_show( frame );
+       frame = ui::Frame( "Orientation" );
+       frame.show();
        gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
 
-       vbox = gtk_vbox_new( TRUE, 5 );
-       gtk_widget_show( vbox );
-       gtk_container_add( GTK_CONTAINER( frame ), vbox );
+       vbox = ui::VBox( TRUE, 5 );
+       vbox.show();
+       frame.add(vbox);
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
 
        for ( i = 0, group = NULL; i < 6; i++ )
        {
                radio = gtk_radio_button_new_with_label( group, orientations[i] );
-               gtk_widget_show( radio );
-               gtk_box_pack_start( GTK_BOX( vbox ), radio, TRUE, TRUE, 0 );
-               group = gtk_radio_button_group( GTK_RADIO_BUTTON( radio ) );
+               radio.show();
+               vbox.pack_start( radio, TRUE, TRUE, 0 );
+               group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radio ) );
                plane_radios[i] = radio;
-               g_signal_connect( G_OBJECT( radio ), "toggled", G_CALLBACK( general_plane ), GINT_TO_POINTER( i ) );
+               radio.connect( "toggled", G_CALLBACK( general_plane ), GINT_TO_POINTER( i ) );
        }
 
-       table2 = gtk_table_new( 4, 2, FALSE );
-       gtk_widget_show( table2 );
+       table2 = ui::Table( 4, 2, FALSE );
+       table2.show();
        gtk_table_set_row_spacings( GTK_TABLE( table2 ), 5 );
        gtk_table_set_col_spacings( GTK_TABLE( table2 ), 5 );
        gtk_table_attach( GTK_TABLE( table ), table2, 1, 2, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
 
-       label = gtk_label_new( "Wavelength:" );
-       gtk_widget_show( label );
+       label = ui::Label( "Wavelength:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
        gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT );
 
-       label = gtk_label_new( "Max. amplitude:" );
-       gtk_widget_show( label );
+       label = ui::Label( "Max. amplitude:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
        gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT );
 
-       label = gtk_label_new( "Roughness:" );
-       gtk_widget_show( label );
+       label = ui::Label( "Roughness:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 2, 3,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
        gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT );
 
-       label = gtk_label_new( "Random seed:" );
-       gtk_widget_show( label );
+       label = ui::Label( "Random seed:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 3, 4,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
        gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table2 ), entry, 1, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( entry, 50, -2 );
+       gtk_widget_set_size_request( entry, 50, -1 );
        g_object_set_data( G_OBJECT( dlg ), "wavelength", entry );
-       g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &WaveLength );
+       entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &WaveLength );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table2 ), entry, 1, 2, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( entry, 50, -2 );
+       gtk_widget_set_size_request( entry, 50, -1 );
        g_object_set_data( G_OBJECT( dlg ), "amplitude", entry );
-       g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Amplitude );
+       entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Amplitude );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table2 ), entry, 1, 2, 2, 3,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( entry, 50, -2 );
+       gtk_widget_set_size_request( entry, 50, -1 );
        g_object_set_data( G_OBJECT( dlg ), "roughness", entry );
-       g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Roughness );
+       entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Roughness );
 
-       adj = gtk_adjustment_new( 1, 1, 32767, 1, 10, 0 );
-       g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( general_random ), NULL );
-       spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
-       gtk_widget_show( spin );
+       adj = ui::Adjustment( 1, 1, 32767, 1, 10, 0 );
+       adj.connect( "value_changed", G_CALLBACK( general_random ), NULL );
+       spin = ui::SpinButton( adj, 1, 0 );
+       spin.show();
        gtk_table_attach( GTK_TABLE( table2 ), spin, 1, 2, 3, 4,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( spin, 60, -2 );
+       gtk_widget_set_size_request( spin, 60, -1 );
        g_object_set_data( G_OBJECT( dlg ), "random", spin );
 
-       vbox = gtk_vbox_new( FALSE, 5 );
-       gtk_widget_show( vbox );
+       vbox = ui::VBox( FALSE, 5 );
+       vbox.show();
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
 
-       label = gtk_label_new( "Extents" );
-       gtk_widget_show( label );
+       label = ui::Label( "Extents" );
+       label.show();
        gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), vbox, label );
 
-       hbox2 = gtk_hbox_new( FALSE, 5 );
-       gtk_widget_show( hbox2 );
-       gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 0 );
+       hbox2 = ui::HBox( FALSE, 5 );
+       hbox2.show();
+       vbox.pack_start( hbox2, FALSE, TRUE, 0 );
 
-       frame = gtk_frame_new( "Extents" );
-       gtk_widget_show( frame );
-       gtk_box_pack_start( GTK_BOX( hbox2 ), frame, TRUE, TRUE, 0 );
+       frame = ui::Frame( "Extents" );
+       frame.show();
+       hbox2.pack_start( frame, TRUE, TRUE, 0 );
 
-       table = gtk_table_new( 3, 4, FALSE );
-       gtk_widget_show( table );
+       auto table = ui::Table( 3, 4, FALSE );
+       table.show();
        gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
-       gtk_container_add( GTK_CONTAINER( frame ), table );
+       frame.add(table);
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
        gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
 
-       label = gtk_label_new( "X:" );
-       gtk_widget_show( label );
+       label = ui::Label( "X:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
        g_object_set_data( G_OBJECT( dlg ), "hmin_text", label );
 
-       label = gtk_label_new( "X:" );
-       gtk_widget_show( label );
+       label = ui::Label( "X:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
        g_object_set_data( G_OBJECT( dlg ), "hmax_text", label );
 
-       label = gtk_label_new( "Y:" );
-       gtk_widget_show( label );
+       label = ui::Label( "Y:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
        g_object_set_data( G_OBJECT( dlg ), "vmin_text", label );
 
-       label = gtk_label_new( "Y:" );
-       gtk_widget_show( label );
+       label = ui::Label( "Y:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
        g_object_set_data( G_OBJECT( dlg ), "vmax_text", label );
 
-       label = gtk_label_new( "Lower-left" );
-       gtk_widget_show( label );
+       label = ui::Label( "Lower-left" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 1, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
 
-       label = gtk_label_new( "Upper-right" );
-       gtk_widget_show( label );
+       label = ui::Label( "Upper-right" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( entry, 50, -2 );
+       gtk_widget_set_size_request( entry, 50, -1 );
        g_object_set_data( G_OBJECT( dlg ), "hmin", entry );
-       g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Hll );
+       entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Hll );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( entry, 50, -2 );
+       gtk_widget_set_size_request( entry, 50, -1 );
        g_object_set_data( G_OBJECT( dlg ), "hmax", entry );
-       g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Hur );
+       entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Hur );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 2, 3,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( entry, 50, -2 );
+       gtk_widget_set_size_request( entry, 50, -1 );
        g_object_set_data( G_OBJECT( dlg ), "vmin", entry );
-       g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Vll );
+       entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Vll );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 2, 3,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( entry, 50, -2 );
+       gtk_widget_set_size_request( entry, 50, -1 );
        g_object_set_data( G_OBJECT( dlg ), "vmax", entry );
-       g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Vur );
+       entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Vur );
 
-       frame = gtk_frame_new( "Divisions" );
-       gtk_widget_show( frame );
-       gtk_box_pack_start( GTK_BOX( hbox2 ), frame, TRUE, TRUE, 0 );
+       frame = ui::Frame( "Divisions" );
+       frame.show();
+       hbox2.pack_start( frame, TRUE, TRUE, 0 );
 
-       table = gtk_table_new( 2, 2, FALSE );
-       gtk_widget_show( table );
+       table = ui::Table( 2, 2, FALSE );
+       table.show();
        gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
-       gtk_container_add( GTK_CONTAINER( frame ), table );
+       frame.add(table);
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
        gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
 
-       label = gtk_label_new( "X:" );
-       gtk_widget_show( label );
+       label = ui::Label( "X:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
        g_object_set_data( G_OBJECT( dlg ), "nh_text", label );
 
-       label = gtk_label_new( "Y:" );
-       gtk_widget_show( label );
+       label = ui::Label( "Y:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
        g_object_set_data( G_OBJECT( dlg ), "nv_text", label );
 
-       adj = gtk_adjustment_new( 8, 1, MAX_ROWS, 1, 10, 0 );
-       g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( extents_nhnv_spin ), &NH );
-       spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
-       gtk_widget_show( spin );
+       adj = ui::Adjustment( 8, 1, MAX_ROWS, 1, 10, 0 );
+       adj.connect( "value_changed", G_CALLBACK( extents_nhnv_spin ), &NH );
+       spin = ui::SpinButton( adj, 1, 0 );
+       spin.show();
        gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( spin, 60, -2 );
+       gtk_widget_set_size_request( spin, 60, -1 );
        g_object_set_data( G_OBJECT( dlg ), "nh", spin );
 
-       adj = gtk_adjustment_new( 8, 1, MAX_ROWS, 1, 10, 0 );
-       g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( extents_nhnv_spin ), &NV );
-       spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
-       gtk_widget_show( spin );
+       adj = ui::Adjustment( 8, 1, MAX_ROWS, 1, 10, 0 );
+       adj.connect( "value_changed", G_CALLBACK( extents_nhnv_spin ), &NV );
+       spin = ui::SpinButton( adj, 1, 0 );
+       spin.show();
        gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( spin, 60, -2 );
+       gtk_widget_set_size_request( spin, 60, -1 );
        g_object_set_data( G_OBJECT( dlg ), "nv", spin );
 
-       check = gtk_check_button_new_with_label( "Use Bezier patches" );
-       gtk_widget_show( check );
-       gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 );
+       check = ui::CheckButton( "Use Bezier patches" );
+       check.show();
+       vbox.pack_start( check, FALSE, TRUE, 0 );
        g_object_set_data( G_OBJECT( dlg ), "use_patches", check );
-       g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( extents_use_patches ), NULL );
+       check.connect( "toggled", G_CALLBACK( extents_use_patches ), NULL );
 
        // ^Fishman - Snap to grid, replaced scroll bar with a texbox.
-       label = gtk_label_new( "Snap to grid:" );
-       gtk_widget_show( label );
-       gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 );
+       label = ui::Label( "Snap to grid:" );
+       label.show();
+       vbox.pack_start( label, FALSE, TRUE, 0 );
        gtk_object_set_data( GTK_OBJECT( dlg ), "snap_text", label );
 
-       adj = gtk_adjustment_new( 8, 0, 256, 1, 10, 0 );
-       g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( extents_snaptogrid_spin ), &SP );
-       spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
-       gtk_widget_show( spin );
-       gtk_box_pack_start( GTK_BOX( vbox ), spin, FALSE, TRUE, 0 );
-       gtk_widget_set_usize( spin, 60, -2 );
+       adj = ui::Adjustment( 8, 0, 256, 1, 10, 0 );
+       adj.connect( "value_changed", G_CALLBACK( extents_snaptogrid_spin ), &SP );
+       spin = ui::SpinButton( adj, 1, 0 );
+       spin.show();
+       vbox.pack_start( spin, FALSE, TRUE, 0 );
+       gtk_widget_set_size_request( spin, 60, -1 );
        g_object_set_data( G_OBJECT( dlg ), "sp", spin );
        // ^Fishman - End of Snap to grid code.
 
-       hbox2 = gtk_hbox_new( FALSE, 5 );
-       gtk_widget_show( hbox2 );
-       gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 10 );
+       hbox2 = ui::HBox( FALSE, 5 );
+       hbox2.show();
+       vbox.pack_start( hbox2, FALSE, TRUE, 10 );
 
-       label = gtk_label_new( "Decimate:" );
-       gtk_widget_show( label );
-       gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 );
+       label = ui::Label( "Decimate:" );
+       label.show();
+       hbox2.pack_start( label, FALSE, TRUE, 0 );
 
-       adj = gtk_adjustment_new( 0, 0, 110, 1, 10, 0 );
-       g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( extents_decimate ), NULL );
+       adj = ui::Adjustment( 0, 0, 110, 1, 10, 0 );
+       adj.connect( "value_changed", G_CALLBACK( extents_decimate ), NULL );
        g_object_set_data( G_OBJECT( dlg ), "decimate_adj", adj );
-       scale = gtk_hscale_new( GTK_ADJUSTMENT( adj ) );
-       gtk_widget_show( scale );
-       gtk_box_pack_start( GTK_BOX( hbox2 ), scale, TRUE, TRUE, 0 );
+       scale = ui::HScale( adj );
+       scale.show();
+       hbox2.pack_start( scale, TRUE, TRUE, 0 );
        gtk_scale_set_value_pos( GTK_SCALE( scale ), GTK_POS_RIGHT );
        gtk_scale_set_digits( GTK_SCALE( scale ), 0 );
        g_object_set_data( G_OBJECT( dlg ), "decimate", scale );
 
-       frame = gtk_frame_new( "Corner values" );
-       gtk_widget_show( frame );
-       gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
+       frame = ui::Frame( "Corner values" );
+       frame.show();
+       vbox.pack_start( frame, FALSE, TRUE, 0 );
 
-       table = gtk_table_new( 3, 4, FALSE );
-       gtk_widget_show( table );
+       table = ui::Table( 3, 4, FALSE );
+       table.show();
        gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
-       gtk_container_add( GTK_CONTAINER( frame ), table );
+       frame.add(table);
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
        gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
 
-       label = gtk_label_new( "Upper-left:" );
-       gtk_widget_show( label );
+       label = ui::Label( "Upper-left:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
 
-       label = gtk_label_new( "Lower-left:" );
-       gtk_widget_show( label );
+       label = ui::Label( "Lower-left:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
 
-       label = gtk_label_new( "Upper-right:" );
-       gtk_widget_show( label );
+       label = ui::Label( "Upper-right:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
 
-       label = gtk_label_new( "Lower-right:" );
-       gtk_widget_show( label );
+       label = ui::Label( "Lower-right:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( entry, 50, -2 );
+       gtk_widget_set_size_request( entry, 50, -1 );
        g_object_set_data( G_OBJECT( dlg ), "z01", entry );
-       g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z01 );
+       entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z01 );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( entry, 50, -2 );
+       gtk_widget_set_size_request( entry, 50, -1 );
        g_object_set_data( G_OBJECT( dlg ), "z00", entry );
-       g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z00 );
+       entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z00 );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 0, 1,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( entry, 50, -2 );
+       gtk_widget_set_size_request( entry, 50, -1 );
        g_object_set_data( G_OBJECT( dlg ), "z11", entry );
-       g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z11 );
+       entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z11 );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( entry, 50, -2 );
+       gtk_widget_set_size_request( entry, 50, -1 );
        g_object_set_data( G_OBJECT( dlg ), "z10", entry );
-       g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z10 );
+       entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z10 );
 
-       check = gtk_check_button_new_with_label( "Linear borders" );
-       gtk_widget_show( check );
+       check = ui::CheckButton( "Linear borders" );
+       check.show();
        gtk_table_attach( GTK_TABLE( table ), check, 0, 4, 2, 3,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
        g_object_set_data( G_OBJECT( dlg ), "linearborder", check );
-       g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( extents_linearborder ), NULL );
+       check.connect( "toggled", G_CALLBACK( extents_linearborder ), NULL );
 
-       vbox = gtk_vbox_new( FALSE, 10 );
-       gtk_widget_show( vbox );
+       vbox = ui::VBox( FALSE, 10 );
+       vbox.show();
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
 
-       label = gtk_label_new( "Bitmap" );
-       gtk_widget_show( label );
+       label = ui::Label( "Bitmap" );
+       label.show();
        gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), vbox, label );
 
-       label = gtk_label_new( "" );
-       gtk_widget_show( label );
-       gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 );
+       label = ui::Label( "" );
+       label.show();
+       vbox.pack_start( label, FALSE, TRUE, 0 );
        g_object_set_data( G_OBJECT( dlg ), "bmp_note", label );
 
-       table = gtk_table_new( 2, 2, FALSE );
-       gtk_widget_show( table );
+       table = ui::Table( 2, 2, FALSE );
+       table.show();
        gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
-       gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 );
+       vbox.pack_start( table, FALSE, TRUE, 0 );
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
        gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
 
-       label = gtk_label_new( "Filename:" );
-       gtk_widget_show( label );
+       label = ui::Label( "Filename:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
        g_object_set_data( G_OBJECT( dlg ), "bmp_text1", label );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
        g_object_set_data( G_OBJECT( dlg ), "bmp_file", entry );
-       g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( bitmap_file_entryfocusout ), NULL );
+       entry.connect( "focus_out_event", G_CALLBACK( bitmap_file_entryfocusout ), NULL );
 
-       hbox2 = gtk_hbox_new( TRUE, 5 );
-       gtk_widget_show( hbox2 );
+       hbox2 = ui::HBox( TRUE, 5 );
+       hbox2.show();
        gtk_table_attach( GTK_TABLE( table ), hbox2, 1, 2, 1, 2,
                                          (GtkAttachOptions) ( 0 ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
 
-       button = gtk_button_new_with_label( "Browse..." );
-       gtk_widget_show( button );
-       gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 );
-       gtk_widget_set_usize( button, 60, -2 );
+       button = ui::Button( "Browse..." );
+       button.show();
+       hbox2.pack_start( button, FALSE, FALSE, 0 );
+       gtk_widget_set_size_request( button, 60, -1 );
        g_object_set_data( G_OBJECT( dlg ), "bmp_file_browse", button );
-       g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( bitmap_browse ), NULL );
+       button.connect( "clicked", G_CALLBACK( bitmap_browse ), NULL );
 
-       button = gtk_button_new_with_label( "Reload" );
-       gtk_widget_show( button );
-       gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 );
-       gtk_widget_set_usize( button, 60, -2 );
+       button = ui::Button( "Reload" );
+       button.show();
+       hbox2.pack_start( button, FALSE, FALSE, 0 );
+       gtk_widget_set_size_request( button, 60, -1 );
        g_object_set_data( G_OBJECT( dlg ), "bmp_reload", button );
-       g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( bitmap_reload ), NULL );
+       button.connect( "clicked", G_CALLBACK( bitmap_reload ), NULL );
 
-       table = gtk_table_new( 2, 2, TRUE );
-       gtk_widget_show( table );
+       table = ui::Table( 2, 2, TRUE );
+       table.show();
        gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
-       gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 );
+       vbox.pack_start( table, FALSE, TRUE, 0 );
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
        gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
 
-       label = gtk_label_new( "Map color 0 to:" );
-       gtk_widget_show( label );
+       label = ui::Label( "Map color 0 to:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
@@ -1857,8 +1857,8 @@ GtkWidget* create_main_dialog(){
        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
        gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT );
 
-       label = gtk_label_new( "Map color 255 to:" );
-       gtk_widget_show( label );
+       label = ui::Label( "Map color 255 to:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
@@ -1866,324 +1866,324 @@ GtkWidget* create_main_dialog(){
        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
        gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT );
 
-       hbox2 = gtk_hbox_new( FALSE, 5 );
-       gtk_widget_show( hbox2 );
+       hbox2 = ui::HBox( FALSE, 5 );
+       hbox2.show();
        gtk_table_attach( GTK_TABLE( table ), hbox2, 1, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
-       gtk_box_pack_start( GTK_BOX( hbox2 ), entry, FALSE, FALSE, 0 );
-       gtk_widget_set_usize( entry, 50, -2 );
+       entry = ui::Entry();
+       entry.show();
+       hbox2.pack_start( entry, FALSE, FALSE, 0 );
+       gtk_widget_set_size_request( entry, 50, -1 );
        g_object_set_data( G_OBJECT( dlg ), "bmp_black", entry );
-       g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &gbmp.black_value );
+       entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &gbmp.black_value );
 
-       hbox2 = gtk_hbox_new( FALSE, 5 );
-       gtk_widget_show( hbox2 );
+       hbox2 = ui::HBox( FALSE, 5 );
+       hbox2.show();
        gtk_table_attach( GTK_TABLE( table ), hbox2, 1, 2, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
-       gtk_box_pack_start( GTK_BOX( hbox2 ), entry, FALSE, FALSE, 0 );
-       gtk_widget_set_usize( entry, 50, -2 );
+       entry = ui::Entry();
+       entry.show();
+       hbox2.pack_start( entry, FALSE, FALSE, 0 );
+       gtk_widget_set_size_request( entry, 50, -1 );
        g_object_set_data( G_OBJECT( dlg ), "bmp_white", entry );
-       g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &gbmp.white_value );
+       entry.connect( "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &gbmp.white_value );
 
-       vbox = gtk_vbox_new( FALSE, 10 );
-       gtk_widget_show( vbox );
+       vbox = ui::VBox( FALSE, 10 );
+       vbox.show();
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
 
-       label = gtk_label_new( "Fix Points" );
-       gtk_widget_show( label );
+       label = ui::Label( "Fix Points" );
+       label.show();
        gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), vbox, label );
 
-       label = gtk_label_new( "Click on a vertex in the lower half of the preview window,\n"
+       label = ui::Label( "Click on a vertex in the lower half of the preview window,\n"
                                                   "then use the arrow keys or text box to assign a value.\n"
                                                   "Use Ctrl+Click to select multiple vertices/toggle a\n"
                                                   "selection. Use Shift+Click to select a range of vertices.\n\n"
                                                   "Click \"Free\" to unlock a vertex. Vertices within \"Range\n"
                                                   "affected\" will be influenced by this vertex." );
-       gtk_widget_show( label );
-       gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 );
+       label.show();
+       vbox.pack_start( label, FALSE, TRUE, 0 );
 
-       table = gtk_table_new( 3, 3, FALSE );
-       gtk_widget_show( table );
+       table = ui::Table( 3, 3, FALSE );
+       table.show();
        gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
-       gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 );
+       vbox.pack_start( table, FALSE, TRUE, 0 );
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
        gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
 
-       label = gtk_label_new( "Value:" );
-       gtk_widget_show( label );
+       label = ui::Label( "Value:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
        g_object_set_data( G_OBJECT( dlg ), "fix_value_text", label );
 
-       label = gtk_label_new( "Range affected:" );
-       gtk_widget_show( label );
+       label = ui::Label( "Range affected:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
        g_object_set_data( G_OBJECT( dlg ), "fix_range_text", label );
 
-       label = gtk_label_new( "Rate of change:" );
-       gtk_widget_show( label );
+       label = ui::Label( "Rate of change:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
        g_object_set_data( G_OBJECT( dlg ), "fix_rate_text", label );
 
-       adj = gtk_adjustment_new( 0, -65536, 65536, 1, 16, 0 );
-       g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( fix_value_changed ), NULL );
-       spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
-       gtk_widget_show( spin );
+       adj = ui::Adjustment( 0, -65536, 65536, 1, 16, 0 );
+       adj.connect( "value_changed", G_CALLBACK( fix_value_changed ), NULL );
+       spin = ui::SpinButton( adj, 1, 0 );
+       spin.show();
        gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_EXPAND ),
                                          (GtkAttachOptions) ( GTK_EXPAND ), 0, 0 );
-       gtk_widget_set_usize( spin, 60, -2 );
+       gtk_widget_set_size_request( spin, 60, -1 );
        g_object_set_data( G_OBJECT( dlg ), "fix_value", spin );
-       g_signal_connect( G_OBJECT( spin ), "focus_out_event", G_CALLBACK( fix_value_entryfocusout ), NULL );
+       spin.connect( "focus_out_event", G_CALLBACK( fix_value_entryfocusout ), NULL );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( entry, 60, -2 );
+       gtk_widget_set_size_request( entry, 60, -1 );
        g_object_set_data( G_OBJECT( dlg ), "fix_range", entry );
-       g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( fix_range_entryfocusout ), NULL );
+       entry.connect( "focus_out_event", G_CALLBACK( fix_range_entryfocusout ), NULL );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 2, 3,
                                          (GtkAttachOptions) ( GTK_EXPAND ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( entry, 60, -2 );
+       gtk_widget_set_size_request( entry, 60, -1 );
        g_object_set_data( G_OBJECT( dlg ), "fix_rate", entry );
-       g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( fix_rate_entryfocusout ), NULL );
+       entry.connect( "focus_out_event", G_CALLBACK( fix_rate_entryfocusout ), NULL );
 
-       button = gtk_button_new_with_label( "Free" );
-       gtk_widget_show( button );
+       button = ui::Button( "Free" );
+       button.show();
        gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 0, 1,
                                          (GtkAttachOptions) ( GTK_EXPAND ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( button, 60, -2 );
+       gtk_widget_set_size_request( button, 60, -1 );
        g_object_set_data( G_OBJECT( dlg ), "fix_free", button );
-       g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( fix_free ), NULL );
+       button.connect( "clicked", G_CALLBACK( fix_free ), NULL );
 
-       button = gtk_button_new_with_label( "Free All" );
-       gtk_widget_show( button );
+       button = ui::Button( "Free All" );
+       button.show();
        gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( button, 60, -2 );
+       gtk_widget_set_size_request( button, 60, -1 );
        g_object_set_data( G_OBJECT( dlg ), "fix_freeall", button );
-       g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( fix_freeall ), NULL );
+       button.connect( "clicked", G_CALLBACK( fix_freeall ), NULL );
 
-       vbox = gtk_vbox_new( FALSE, 10 );
-       gtk_widget_show( vbox );
+       vbox = ui::VBox( FALSE, 10 );
+       vbox.show();
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
 
-       label = gtk_label_new( "Texture" );
-       gtk_widget_show( label );
+       label = ui::Label( "Texture" );
+       label.show();
        gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), vbox, label );
 
        // ^Fishman - Modified to add more labels and textboxes.
-       table = gtk_table_new( 5, 2, FALSE );
-       gtk_widget_show( table );
-       gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 );
+       table = ui::Table( 5, 2, FALSE );
+       table.show();
+       vbox.pack_start( table, FALSE, TRUE, 0 );
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
        gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
 
-       label = gtk_label_new( "Surface:" );
-       gtk_widget_show( label );
+       label = ui::Label( "Surface:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
 
-       label = gtk_label_new( "Other:" );
-       gtk_widget_show( label );
+       label = ui::Label( "Other:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
 
-       label = gtk_label_new( "Steep:" );
-       gtk_widget_show( label );
+       label = ui::Label( "Steep:" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( entry, 60, -2 );
+       gtk_widget_set_size_request( entry, 60, -1 );
        g_object_set_data( G_OBJECT( dlg ), "texture1", entry );
-       g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( texture_entryfocusout ), GINT_TO_POINTER( 0 ) );
+       entry.connect( "focus_out_event", G_CALLBACK( texture_entryfocusout ), GINT_TO_POINTER( 0 ) );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( entry, 60, -2 );
+       gtk_widget_set_size_request( entry, 60, -1 );
        g_object_set_data( G_OBJECT( dlg ), "texture2", entry );
-       g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( texture_entryfocusout ), GINT_TO_POINTER( 1 ) );
+       entry.connect( "focus_out_event", G_CALLBACK( texture_entryfocusout ), GINT_TO_POINTER( 1 ) );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 2, 3,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( entry, 60, -2 );
+       gtk_widget_set_size_request( entry, 60, -1 );
        g_object_set_data( G_OBJECT( dlg ), "texture3", entry );
 
-       hbox2 = gtk_hbox_new( FALSE, 5 );
-       gtk_widget_show( hbox2 );
-       gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 0 );
+       hbox2 = ui::HBox( FALSE, 5 );
+       hbox2.show();
+       vbox.pack_start( hbox2, FALSE, TRUE, 0 );
 
-       label = gtk_label_new( "\"Steep\" angle:" );
-       gtk_widget_show( label );
-       gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 );
+       label = ui::Label( "\"Steep\" angle:" );
+       label.show();
+       hbox2.pack_start( label, FALSE, TRUE, 0 );
 
-       adj = gtk_adjustment_new( 60, 0, 90, 1, 10, 0 );
-       spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
-       gtk_widget_show( spin );
-       gtk_box_pack_start( GTK_BOX( hbox2 ), spin, FALSE, TRUE, 0 );
+       adj = ui::Adjustment( 60, 0, 90, 1, 10, 0 );
+       spin = ui::SpinButton( adj, 1, 0 );
+       spin.show();
+       hbox2.pack_start( spin, FALSE, TRUE, 0 );
        g_object_set_data( G_OBJECT( dlg ), "tex_slant", spin );
 
-       table = gtk_table_new( 2, 4, TRUE );
-       gtk_widget_show( table );
-       gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 );
+       table = ui::Table( 2, 4, TRUE );
+       table.show();
+       vbox.pack_start( table, FALSE, TRUE, 0 );
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
        gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
 
-       label = gtk_label_new( "Offset <h,v>" );
-       gtk_widget_show( label );
+       label = ui::Label( "Offset <h,v>" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 0, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
 
-       label = gtk_label_new( "Scale <h,v>" );
-       gtk_widget_show( label );
+       label = ui::Label( "Scale <h,v>" );
+       label.show();
        gtk_table_attach( GTK_TABLE( table ), label, 2, 4, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table ), entry, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( entry, 60, -2 );
+       gtk_widget_set_size_request( entry, 60, -1 );
        g_object_set_data( G_OBJECT( dlg ), "texoffsetx", entry );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( entry, 60, -2 );
+       gtk_widget_set_size_request( entry, 60, -1 );
        g_object_set_data( G_OBJECT( dlg ), "texoffsety", entry );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table ), entry, 2, 3, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( entry, 60, -2 );
+       gtk_widget_set_size_request( entry, 60, -1 );
        g_object_set_data( G_OBJECT( dlg ), "texscalex", entry );
 
-       entry = gtk_entry_new();
-       gtk_widget_show( entry );
+       entry = ui::Entry();
+       entry.show();
        gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
-       gtk_widget_set_usize( entry, 60, -2 );
+       gtk_widget_set_size_request( entry, 60, -1 );
        g_object_set_data( G_OBJECT( dlg ), "texscaley", entry );
 
 
 
-       check = gtk_check_button_new_with_label( "Use detail brushes" );
-       gtk_widget_show( check );
-       gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 );
+       check = ui::CheckButton( "Use detail brushes" );
+       check.show();
+       vbox.pack_start( check, FALSE, TRUE, 0 );
        g_object_set_data( G_OBJECT( dlg ), "detail", check );
-       g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( texture_detail ), NULL );
+       check.connect( "toggled", G_CALLBACK( texture_detail ), NULL );
 
-       check = gtk_check_button_new_with_label( "Detail hint brushes" );
-       gtk_widget_show( check );
-       gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 );
+       check = ui::CheckButton( "Detail hint brushes" );
+       check.show();
+       vbox.pack_start( check, FALSE, TRUE, 0 );
        g_object_set_data( G_OBJECT( dlg ), "hint", check );
-       g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( texture_hint ), NULL );
+       check.connect( "toggled", G_CALLBACK( texture_hint ), NULL );
 
        // ^Fishman - Add terrain key to func_group.
-       check = gtk_check_button_new_with_label( "Add terrain key" );
-       gtk_widget_show( check );
-       gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 );
+       check = ui::CheckButton( "Add terrain key" );
+       check.show();
+       vbox.pack_start( check, FALSE, TRUE, 0 );
        g_object_set_data( G_OBJECT( dlg ), "terrain_ent", check );
-       g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( texture_terrainent ), NULL );
+       check.connect( "toggled", G_CALLBACK( texture_terrainent ), NULL );
 
-       vbox = gtk_vbox_new( FALSE, 5 );
-       gtk_widget_show( vbox );
-       gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, TRUE, 0 );
+       vbox = ui::VBox( FALSE, 5 );
+       vbox.show();
+       hbox.pack_start( vbox, FALSE, TRUE, 0 );
 
-       button = gtk_button_new_with_label( "OK" );
-       gtk_widget_show( button );
-       gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 );
-       gtk_widget_set_usize( button, 60, -2 );
+       button = ui::Button( "OK" );
+       button.show();
+       vbox.pack_start( button, FALSE, TRUE, 0 );
+       gtk_widget_set_size_request( button, 60, -1 );
        g_object_set_data( G_OBJECT( dlg ), "go", button );
-       g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_go ), NULL );
+       button.connect( "clicked", G_CALLBACK( main_go ), NULL );
 
-       label = gtk_label_new( "Settings:" );
-       gtk_widget_show( label );
-       gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 );
+       label = ui::Label( "Settings:" );
+       label.show();
+       vbox.pack_start( label, FALSE, TRUE, 0 );
 
-       button = gtk_button_new_with_label( "Open..." );
-       gtk_widget_show( button );
-       gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 );
+       button = ui::Button( "Open..." );
+       button.show();
+       vbox.pack_start( button, FALSE, TRUE, 0 );
        g_object_set_data( G_OBJECT( dlg ), "open", button );
-       g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_open ), NULL );
+       button.connect( "clicked", G_CALLBACK( main_open ), NULL );
 
-       button = gtk_button_new_with_label( "Save as..." );
-       gtk_widget_show( button );
-       gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 );
+       button = ui::Button( "Save as..." );
+       button.show();
+       vbox.pack_start( button, FALSE, TRUE, 0 );
        g_object_set_data( G_OBJECT( dlg ), "save", button );
-       g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_save ), NULL );
+       button.connect( "clicked", G_CALLBACK( main_save ), NULL );
 
-       button = gtk_button_new_with_label( "Defaults" );
-       gtk_widget_show( button );
-       gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 );
+       button = ui::Button( "Defaults" );
+       button.show();
+       vbox.pack_start( button, FALSE, TRUE, 0 );
        g_object_set_data( G_OBJECT( dlg ), "defaults", button );
-       g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_defaults ), NULL );
+       button.connect( "clicked", G_CALLBACK( main_defaults ), NULL );
 
-       button = gtk_button_new_with_label( "About..." );
-       gtk_widget_show( button );
-       gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 );
-       g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_about ), NULL );
+       button = ui::Button( "About..." );
+       button.show();
+       vbox.pack_start( button, FALSE, TRUE, 0 );
+       button.connect( "clicked", G_CALLBACK( main_about ), NULL );
 
-       check = gtk_check_button_new_with_label( "Preview" );
-       gtk_widget_show( check );
-       gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 );
-       g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( main_preview ), NULL );
+       check = ui::CheckButton( "Preview" );
+       check.show();
+       vbox.pack_start( check, FALSE, TRUE, 0 );
+       check.connect( "toggled", G_CALLBACK( main_preview ), NULL );
        g_object_set_data( G_OBJECT( dlg ), "main_preview", check );
 
        // ^Fishman - Antializing for the preview window.
-       check = gtk_check_button_new_with_label( "Antialised lines" );
-       gtk_widget_show( check );
-       gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 );
+       check = ui::CheckButton( "Antialised lines" );
+       check.show();
+       vbox.pack_start( check, FALSE, TRUE, 0 );
        g_object_set_data( G_OBJECT( dlg ), "main_antialiasing", check );
-       g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( main_antialiasing ), NULL );
+       check.connect( "toggled", G_CALLBACK( main_antialiasing ), NULL );
 
        for ( i = 0; i < 5; i++ )
                SetDlgValues( i );