]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Wrap GTK
authorTimePath <andrew.hardaker1995@gmail.com>
Mon, 17 Jul 2017 11:55:47 +0000 (21:55 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 31 Jul 2017 12:35:47 +0000 (22:35 +1000)
119 files changed:
contrib/bkgrnd2d/dialog.cpp
contrib/bobtoolz/dialogs/dialogs-gtk.cpp
contrib/bobtoolz/dialogs/dialogs-gtk.h
contrib/bobtoolz/lists.cpp
contrib/bobtoolz/lists.h
contrib/bobtoolz/shapes.cpp
contrib/brushexport/callbacks.cpp
contrib/brushexport/interface.cpp
contrib/brushexport/plugin.cpp
contrib/brushexport/support.cpp
contrib/brushexport/support.h
contrib/camera/dialogs.cpp
contrib/gtkgensurf/gendlgs.cpp
contrib/gtkgensurf/gensurf.cpp
contrib/gtkgensurf/view.cpp
contrib/hydratoolz/plugin.cpp
contrib/prtview/AboutDialog.cpp
contrib/prtview/ConfigDialog.cpp
contrib/prtview/LoadPortalFileDialog.cpp
contrib/shaderplug/shaderplug.cpp
contrib/sunplug/sunplug.cpp
contrib/ufoaiplug/ufoai.cpp
include/itoolbar.h
include/qerplugin.h
libs/container/array.h
libs/container/cache.h
libs/container/hashtable.h
libs/debugging/debugging.h
libs/gtkutil/accelerator.cpp
libs/gtkutil/accelerator.h
libs/gtkutil/button.cpp
libs/gtkutil/button.h
libs/gtkutil/clipboard.cpp
libs/gtkutil/container.h
libs/gtkutil/cursor.cpp
libs/gtkutil/cursor.h
libs/gtkutil/dialog.cpp
libs/gtkutil/dialog.h
libs/gtkutil/entry.h
libs/gtkutil/filechooser.cpp
libs/gtkutil/filechooser.h
libs/gtkutil/frame.cpp
libs/gtkutil/glwidget.cpp
libs/gtkutil/image.cpp
libs/gtkutil/menu.cpp
libs/gtkutil/messagebox.cpp
libs/gtkutil/messagebox.h
libs/gtkutil/nonmodal.h
libs/gtkutil/paned.cpp
libs/gtkutil/toolbar.cpp
libs/gtkutil/toolbar.h
libs/gtkutil/widget.h
libs/gtkutil/window.cpp
libs/gtkutil/window.h
libs/gtkutil/xorrectangle.h
libs/modulesystem/moduleregistry.h
libs/modulesystem/singletonmodule.h
libs/uilib/uilib.cpp
libs/uilib/uilib.h [new file with mode: 0644]
plugins/textool/2DView.cpp
plugins/textool/TexTool.cpp
plugins/vfspk3/archive.cpp
radiant/autosave.cpp
radiant/brushmanip.cpp
radiant/build.cpp
radiant/camwindow.cpp
radiant/camwindow.h
radiant/commands.cpp
radiant/console.cpp
radiant/console.h
radiant/dialog.cpp
radiant/dialog.h
radiant/entity.cpp
radiant/entity.h
radiant/entityinspector.cpp
radiant/entityinspector.h
radiant/entitylist.cpp
radiant/entitylist.h
radiant/feedback.cpp
radiant/feedback.h
radiant/findtexturedialog.cpp
radiant/findtexturedialog.h
radiant/groupdialog.cpp
radiant/groupdialog.h
radiant/gtkdlgs.cpp
radiant/gtkmisc.cpp
radiant/gtkmisc.h
radiant/main.cpp
radiant/mainframe.cpp
radiant/mainframe.h
radiant/map.cpp
radiant/mru.cpp
radiant/multimon.cpp
radiant/patchdialog.cpp
radiant/patchdialog.h
radiant/patchmanip.cpp
radiant/pluginmanager.cpp
radiant/pluginmanager.h
radiant/pluginmenu.cpp
radiant/plugintoolbar.cpp
radiant/preferences.cpp
radiant/preferences.h
radiant/qe3.cpp
radiant/qgl.cpp
radiant/select.cpp
radiant/server.cpp
radiant/surfacedialog.cpp
radiant/surfacedialog.h
radiant/textureentry.h
radiant/texwindow.cpp
radiant/texwindow.h
radiant/treemodel.cpp
radiant/url.cpp
radiant/watchbsp.cpp
radiant/windowobservers.cpp
radiant/windowobservers.h
radiant/xmlstuff.h
radiant/xywindow.cpp
radiant/xywindow.h

index 6d63bc3fd80e8cba0bb60ddd484088da45f470bb..a787c8fa1e71955b9b1a37c93cd00a9760928155 100644 (file)
@@ -183,45 +183,45 @@ CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){
        switch ( m_vt )
        {
        case XY:
-               m_pTabLabel = gtk_label_new( "X/Y" );
+               m_pTabLabel = ui::Label( "X/Y" );
                m_pImage = &backgroundXY;
                break;
        case XZ:
-               m_pTabLabel = gtk_label_new( "X/Z" );
+               m_pTabLabel = ui::Label( "X/Z" );
                m_pImage = &backgroundXZ;
                break;
        case YZ:
-               m_pTabLabel = gtk_label_new( "Y/Z" );
+               m_pTabLabel = ui::Label( "Y/Z" );
                m_pImage = &backgroundYZ;
                break;
        }
 // A vbox to hold everything
-       m_pWidget = gtk_vbox_new( FALSE,0 );
+       m_pWidget = ui::VBox( FALSE,0 );
 // Frame for file row
-       frame = gtk_frame_new( "File" );
+       frame = ui::Frame( "File" );
        gtk_box_pack_start( GTK_BOX( m_pWidget ),frame, FALSE, FALSE, 2 );
 
 // hbox for first row
-       hbox = gtk_hbox_new( FALSE,5 );
+       hbox = ui::HBox( FALSE,5 );
        gtk_container_set_border_width( GTK_CONTAINER( hbox ),4 );
        gtk_container_add( GTK_CONTAINER( frame ), hbox );
 
 // label to display filename
-       m_pFileLabel  = gtk_label_new( NO_FILE_MSG );
+       m_pFileLabel  = ui::Label( NO_FILE_MSG );
        gtk_label_set_selectable( GTK_LABEL( m_pFileLabel ),TRUE );
 //TODO set min size ? done with spaces right now
        gtk_box_pack_start( GTK_BOX( hbox ),m_pFileLabel, TRUE, TRUE, 5 );
 
        gtk_widget_show( m_pFileLabel );
 
-       w = gtk_button_new_with_label( "Browse..." );
+       w = ui::Button( "Browse..." );
        g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( browse_callback ),
                                          ( gpointer ) this );
        gtk_box_pack_start( GTK_BOX( hbox ),w, FALSE, FALSE, 5 );
        gtk_tooltips_set_tip( pTooltips, w, "Select a file", NULL );
        gtk_widget_show( w );
 
-       w = gtk_button_new_with_label( "Reload" );
+       w = ui::Button( "Reload" );
        g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( reload_callback ),
                                          ( gpointer ) this );
        // TODO disable until we have file
@@ -234,18 +234,18 @@ CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){
        gtk_widget_show( frame );
 
 // second row (rendering options)
-       frame = gtk_frame_new( "Rendering" );
+       frame = ui::Frame( "Rendering" );
        gtk_box_pack_start( GTK_BOX( m_pWidget ),frame, FALSE, FALSE, 2 );
 
-       hbox = gtk_hbox_new( FALSE,5 );
+       hbox = ui::HBox( FALSE,5 );
        gtk_container_set_border_width( GTK_CONTAINER( hbox ),4 );
        gtk_container_add( GTK_CONTAINER( frame ), hbox );
 
-       w = gtk_label_new( "Vertex alpha:" );
+       w = ui::Label( "Vertex alpha:" );
        gtk_box_pack_start( GTK_BOX( hbox ),w, FALSE, FALSE, 5 );
        gtk_widget_show( w );
 
-       w = gtk_hscale_new_with_range( 0.0,1.0,0.01 );
+       w = ui::HScale( 0.0, 1.0, 0.01 );
        gtk_range_set_value( GTK_RANGE( w ),0.5 );
        gtk_scale_set_value_pos( GTK_SCALE( w ),GTK_POS_LEFT );
        g_signal_connect( G_OBJECT( w ), "value-changed",
@@ -257,15 +257,15 @@ CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){
        gtk_widget_show( hbox );
        gtk_widget_show( frame );
 // Third row (size and position)
-       frame = gtk_frame_new( "Size/Position (undefined)" );
+       frame = ui::Frame( "Size/Position (undefined)" );
        m_pPosLabel = gtk_frame_get_label_widget( GTK_FRAME( frame ) );
        gtk_box_pack_start( GTK_BOX( m_pWidget ), frame, FALSE, FALSE, 2 );
 
-       hbox = gtk_hbox_new( FALSE,5 );
+       hbox = ui::HBox( FALSE,5 );
        gtk_container_add( GTK_CONTAINER( frame ), hbox );
        gtk_container_set_border_width( GTK_CONTAINER( hbox ),4 );
 
-       w = gtk_button_new_with_label( "from selection" );
+       w = ui::Button( "from selection" );
        gtk_box_pack_start( GTK_BOX( hbox ),w, TRUE, FALSE, 5 );
        g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( size_sel_callback ),
                                          ( gpointer ) this );
@@ -273,7 +273,7 @@ CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){
        gtk_widget_show( w );
 
        if ( m_vt == XY ) {
-               w = gtk_button_new_with_label( "from map mins/maxs" );
+               w = ui::Button( "from map mins/maxs" );
                gtk_box_pack_start( GTK_BOX( hbox ),w, TRUE, FALSE, 2 );
                g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( size_mm_callback ),
                                                  ( gpointer ) this );
@@ -320,11 +320,11 @@ void InitBackgroundDialog(){
                                                  //                                                                              GTK_STOCK_CLOSE,
                                                  //                                                                              GTK_RESPONSE_CLOSE,
                                                                                          NULL );
-       gtk_signal_connect( GTK_OBJECT( pDialogWnd ), "delete_event",
-                                               GTK_SIGNAL_FUNC( close_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( pDialogWnd ), "response",
-                                               GTK_SIGNAL_FUNC( response_callback ), NULL );
-//  gtk_signal_connect( GTK_OBJECT (pDialogWnd), "expose_event", GTK_SIGNAL_FUNC( ci_expose ), NULL );
+       g_signal_connect( GTK_OBJECT( pDialogWnd ), "delete_event",
+                                               G_CALLBACK( close_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( pDialogWnd ), "response",
+                                               G_CALLBACK( response_callback ), NULL );
+//  g_signal_connect( GTK_OBJECT (pDialogWnd), "expose_event", G_CALLBACK( ci_expose ), NULL );
 
        pTooltips = gtk_tooltips_new();
 
index b596f0591a846ec8c50575818221155fcbdb6fbf..daeb391383f810225063b86897aa67274e35e47f 100644 (file)
@@ -59,23 +59,23 @@ void Update_TextureReseter(){
        gboolean check;
 
        check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbTexChange ) );
-       gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editTexNew ), check );
-       gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editTexOld ), check );
+       gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editTexNew ), check );
+       gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editTexOld ), check );
 
        check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleHor ) );
-       gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editScaleHor ), check );
+       gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editScaleHor ), check );
 
        check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleVert ) );
-       gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editScaleVert ), check );
+       gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editScaleVert ), check );
 
        check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftHor ) );
-       gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editShiftHor ), check );
+       gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editShiftHor ), check );
 
        check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftVert ) );
-       gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editShiftVert ), check );
+       gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editShiftVert ), check );
 
        check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbRotation ) );
-       gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editRotation ), check );
+       gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editRotation ), check );
 }
 
 static void dialog_button_callback( GtkWidget *widget, gpointer data ){
@@ -105,9 +105,9 @@ static void dialog_button_callback_settex( GtkWidget *widget, gpointer data ){
        TwinWidget* tw = (TwinWidget*)data;
 
        GtkEntry* entry = GTK_ENTRY( tw->one );
-       GtkCombo* combo = GTK_COMBO( tw->two );
+       auto* combo = GTK_BIN(tw->two);
 
-       const gchar* tex = gtk_entry_get_text( GTK_ENTRY( combo->entry ) );
+       const gchar *tex = gtk_entry_get_text(GTK_ENTRY (gtk_bin_get_child(combo)));
        gtk_entry_set_text( entry, tex );
 }
 
@@ -209,100 +209,100 @@ bool ValidateTextInt( const char* pData, char* error_title, int* value ){
  */
 
 EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMessageBoxType type ){
-       GtkWidget *window, *w, *vbox, *hbox;
+       ui::Widget window, w, vbox, hbox;
        EMessageBoxReturn ret;
        int loop = 1;
 
-       window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
-       gtk_signal_connect( GTK_OBJECT( window ), "delete_event",
-                                               GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( window ), "destroy",
-                                               GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       window = ui::Window( ui::window_type::TOP );
+       g_signal_connect( GTK_OBJECT( window ), "delete_event",
+                                               G_CALLBACK( dialog_delete_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "destroy",
+                                               G_CALLBACK( gtk_widget_destroy ), NULL );
        gtk_window_set_title( GTK_WINDOW( window ), lpCaption );
-       gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+       gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
        g_object_set_data( G_OBJECT( window ), "loop", &loop );
        g_object_set_data( G_OBJECT( window ), "ret", &ret );
        gtk_widget_realize( window );
 
-       vbox = gtk_vbox_new( FALSE, 10 );
+       vbox = ui::VBox( FALSE, 10 );
        gtk_container_add( GTK_CONTAINER( window ), vbox );
        gtk_widget_show( vbox );
 
-       w = gtk_label_new( lpText );
+       w = ui::Label( lpText );
        gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
        gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
        gtk_widget_show( w );
 
-       w = gtk_hseparator_new();
+       w = ui::Widget(gtk_hseparator_new());
        gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
        gtk_widget_show( w );
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
        gtk_widget_show( hbox );
 
        if ( type == eMB_OK ) {
-               w = gtk_button_new_with_label( "Ok" );
+               w = ui::Button( "Ok" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
-               GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
+               gtk_widget_set_can_default(w, true);
                gtk_widget_grab_default( w );
                gtk_widget_show( w );
                ret = eIDOK;
        }
        else if ( type ==  eMB_OKCANCEL ) {
-               w = gtk_button_new_with_label( "Ok" );
+               w = ui::Button( "Ok" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
-               GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
+               gtk_widget_set_can_default( w, true );
                gtk_widget_grab_default( w );
                gtk_widget_show( w );
 
-               w = gtk_button_new_with_label( "Cancel" );
+               w = ui::Button( "Cancel" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
                gtk_widget_show( w );
                ret = eIDCANCEL;
        }
        else if ( type == eMB_YESNOCANCEL ) {
-               w = gtk_button_new_with_label( "Yes" );
+               w = ui::Button( "Yes" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
-               GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
+               gtk_widget_set_can_default( w, true );
                gtk_widget_grab_default( w );
                gtk_widget_show( w );
 
-               w = gtk_button_new_with_label( "No" );
+               w = ui::Button( "No" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
                gtk_widget_show( w );
 
-               w = gtk_button_new_with_label( "Cancel" );
+               w = ui::Button( "Cancel" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
                gtk_widget_show( w );
                ret = eIDCANCEL;
        }
        else /* if (mode == MB_YESNO) */
        {
-               w = gtk_button_new_with_label( "Yes" );
+               w = ui::Button( "Yes" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
-               GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
+               gtk_widget_set_can_default( w, true );
                gtk_widget_grab_default( w );
                gtk_widget_show( w );
 
-               w = gtk_button_new_with_label( "No" );
+               w = ui::Button( "No" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
                gtk_widget_show( w );
                ret = eIDNO;
        }
@@ -322,18 +322,17 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess
 
 EMessageBoxReturn DoIntersectBox( IntersectRS* rs ){
        GtkWidget *window, *w, *vbox, *hbox;
-       GtkWidget *radio1, *radio2;
        GtkWidget *check1, *check2;
        EMessageBoxReturn ret;
        int loop = 1;
 
-       window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       window = ui::Window( ui::window_type::TOP );
 
-       gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
 
        gtk_window_set_title( GTK_WINDOW( window ), "Intersect" );
-       gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+       gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
 
        g_object_set_data( G_OBJECT( window ), "loop", &loop );
        g_object_set_data( G_OBJECT( window ), "ret", &ret );
@@ -342,18 +341,18 @@ EMessageBoxReturn DoIntersectBox( IntersectRS* rs ){
 
 
 
-       vbox = gtk_vbox_new( FALSE, 10 );
+       vbox = ui::VBox( FALSE, 10 );
        gtk_container_add( GTK_CONTAINER( window ), vbox );
        gtk_widget_show( vbox );
 
        // ---- vbox ----
 
 
-       radio1 = gtk_radio_button_new_with_label( NULL, "Use Whole Map" );
+       auto radio1 = gtk_radio_button_new_with_label( NULL, "Use Whole Map" );
        gtk_box_pack_start( GTK_BOX( vbox ), radio1, FALSE, FALSE, 2 );
        gtk_widget_show( radio1 );
 
-       radio2 = gtk_radio_button_new_with_label( ( (GtkRadioButton*)radio1 )->group, "Use Selected Brushes" );
+       auto radio2 = gtk_radio_button_new_with_label( gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio1)), "Use Selected Brushes" );
        gtk_box_pack_start( GTK_BOX( vbox ), radio2, FALSE, FALSE, 2 );
        gtk_widget_show( radio2 );
 
@@ -361,31 +360,31 @@ EMessageBoxReturn DoIntersectBox( IntersectRS* rs ){
        gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
        gtk_widget_show( w );
 
-       check1 = gtk_check_button_new_with_label( "Include Detail Brushes" );
+       check1 = ui::CheckButton( "Include Detail Brushes" );
        gtk_box_pack_start( GTK_BOX( vbox ), check1, FALSE, FALSE, 0 );
        gtk_widget_show( check1 );
 
-       check2 = gtk_check_button_new_with_label( "Select Duplicate Brushes Only" );
+       check2 = ui::CheckButton( "Select Duplicate Brushes Only" );
        gtk_box_pack_start( GTK_BOX( vbox ), check2, FALSE, FALSE, 0 );
        gtk_widget_show( check2 );
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
        gtk_widget_show( hbox );
 
        // ---- hbox ---- ok/cancel buttons
 
-       w = gtk_button_new_with_label( "Ok" );
+       w = ui::Button( "Ok" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
 
-       GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+       gtk_widget_set_can_default( w, true );
        gtk_widget_grab_default( w );
        gtk_widget_show( w );
 
-       w = gtk_button_new_with_label( "Cancel" );
+       w = ui::Button( "Cancel" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
        gtk_widget_show( w );
        ret = eIDCANCEL;
 
@@ -425,13 +424,13 @@ EMessageBoxReturn DoPolygonBox( PolygonRS* rs ){
        EMessageBoxReturn ret;
        int loop = 1;
 
-       window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       window = ui::Window( ui::window_type::TOP );
 
-       gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
 
        gtk_window_set_title( GTK_WINDOW( window ), "Polygon Builder" );
-       gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+       gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
 
        g_object_set_data( G_OBJECT( window ), "loop", &loop );
        g_object_set_data( G_OBJECT( window ), "ret", &ret );
@@ -440,55 +439,55 @@ EMessageBoxReturn DoPolygonBox( PolygonRS* rs ){
 
 
 
-       vbox = gtk_vbox_new( FALSE, 10 );
+       vbox = ui::VBox( FALSE, 10 );
        gtk_container_add( GTK_CONTAINER( window ), vbox );
        gtk_widget_show( vbox );
 
        // ---- vbox ----
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
        gtk_widget_show( hbox );
 
        // ---- hbox ----
 
 
-       vbox2 = gtk_vbox_new( FALSE, 10 );
+       vbox2 = ui::VBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( hbox ), vbox2, FALSE, FALSE, 2 );
        gtk_widget_show( vbox2 );
 
        // ---- vbox2 ----
 
-       hbox2 = gtk_hbox_new( FALSE, 10 );
+       hbox2 = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, FALSE, FALSE, 2 );
        gtk_widget_show( hbox2 );
 
        // ---- hbox2 ----
 
-       text1 = gtk_entry_new_with_max_length( 256 );
+       text1 = ui::Entry( 256 );
        gtk_entry_set_text( (GtkEntry*)text1, "3" );
        gtk_box_pack_start( GTK_BOX( hbox2 ), text1, FALSE, FALSE, 2 );
        gtk_widget_show( text1 );
 
-       w = gtk_label_new( "Number Of Sides" );
+       w = ui::Label( "Number Of Sides" );
        gtk_box_pack_start( GTK_BOX( hbox2 ), w, FALSE, FALSE, 2 );
        gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
        gtk_widget_show( w );
 
        // ---- /hbox2 ----
 
-       hbox2 = gtk_hbox_new( FALSE, 10 );
+       hbox2 = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, FALSE, FALSE, 2 );
        gtk_widget_show( hbox2 );
 
        // ---- hbox2 ----
 
-       text2 = gtk_entry_new_with_max_length( 256 );
+       text2 = ui::Entry( 256 );
        gtk_entry_set_text( (GtkEntry*)text2, "8" );
        gtk_box_pack_start( GTK_BOX( hbox2 ), text2, FALSE, FALSE, 2 );
        gtk_widget_show( text2 );
 
-       w = gtk_label_new( "Border Width" );
+       w = ui::Label( "Border Width" );
        gtk_box_pack_start( GTK_BOX( hbox2 ), w, FALSE, FALSE, 2 );
        gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
        gtk_widget_show( w );
@@ -499,23 +498,23 @@ EMessageBoxReturn DoPolygonBox( PolygonRS* rs ){
 
 
 
-       vbox2 = gtk_vbox_new( FALSE, 10 );
+       vbox2 = ui::VBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( hbox ), vbox2, FALSE, FALSE, 2 );
        gtk_widget_show( vbox2 );
 
        // ---- vbox2 ----
 
-       check1 = gtk_check_button_new_with_label( "Use Border" );
+       check1 = ui::CheckButton( "Use Border" );
        gtk_box_pack_start( GTK_BOX( vbox2 ), check1, FALSE, FALSE, 0 );
        gtk_widget_show( check1 );
 
 
-       check2 = gtk_check_button_new_with_label( "Inverse Polygon" );
+       check2 = ui::CheckButton( "Inverse Polygon" );
        gtk_box_pack_start( GTK_BOX( vbox2 ), check2, FALSE, FALSE, 0 );
        gtk_widget_show( check2 );
 
 
-       check3 = gtk_check_button_new_with_label( "Align Top Edge" );
+       check3 = ui::CheckButton( "Align Top Edge" );
        gtk_box_pack_start( GTK_BOX( vbox2 ), check3, FALSE, FALSE, 0 );
        gtk_widget_show( check3 );
 
@@ -523,23 +522,23 @@ EMessageBoxReturn DoPolygonBox( PolygonRS* rs ){
 
        // ---- /hbox ----
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
        gtk_widget_show( hbox );
 
        // ---- hbox ----
 
-       w = gtk_button_new_with_label( "Ok" );
+       w = ui::Button( "Ok" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
 
-       GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+       gtk_widget_set_can_default( w, true );
        gtk_widget_grab_default( w );
        gtk_widget_show( w );
 
-       w = gtk_button_new_with_label( "Cancel" );
+       w = ui::Button( "Cancel" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
        gtk_widget_show( w );
        ret = eIDCANCEL;
 
@@ -597,16 +596,16 @@ EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){
        EMessageBoxReturn ret;
        int loop = 1;
 
-       char    *text = "Please set a value in the boxes below and press 'OK' to build the stairs";
+       char *text = "Please set a value in the boxes below and press 'OK' to build the stairs";
 
-       window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       window = ui::Window( ui::window_type::TOP );
 
-       gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
 
        gtk_window_set_title( GTK_WINDOW( window ), "Stair Builder" );
 
-       gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+       gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
 
        g_object_set_data( G_OBJECT( window ), "loop", &loop );
        g_object_set_data( G_OBJECT( window ), "ret", &ret );
@@ -614,16 +613,16 @@ EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){
        gtk_widget_realize( window );
 
        // new vbox
-       vbox = gtk_vbox_new( FALSE, 10 );
+       vbox = ui::VBox( FALSE, 10 );
        gtk_container_add( GTK_CONTAINER( window ), vbox );
        gtk_widget_show( vbox );
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_container_add( GTK_CONTAINER( vbox ), hbox );
        gtk_widget_show( hbox );
 
        // dunno if you want this text or not ...
-       w = gtk_label_new( text );
+       w = ui::Label( text );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 ); // not entirely sure on all the parameters / what they do ...
        gtk_widget_show( w );
 
@@ -634,31 +633,31 @@ EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){
        // ------------------------- // indenting == good way of keeping track of lines :)
 
        // new hbox
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       textStairHeight = gtk_entry_new_with_max_length( 256 );
+       textStairHeight = ui::Entry( 256 );
        gtk_box_pack_start( GTK_BOX( hbox ), textStairHeight, FALSE, FALSE, 1 );
        gtk_widget_show( textStairHeight );
 
-       w = gtk_label_new( "Stair Height" );
+       w = ui::Label( "Stair Height" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
        gtk_widget_show( w );
 
        // ------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_label_new( "Direction:" );
+       w = ui::Label( "Direction:" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 5 );
        gtk_widget_show( w );
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
@@ -672,19 +671,19 @@ EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){
        gtk_box_pack_start( GTK_BOX( hbox ), radioNorth, FALSE, FALSE, 3 );
        gtk_widget_show( radioNorth );
 
-       radioDirection = gtk_radio_button_group( GTK_RADIO_BUTTON( radioNorth ) );
+       radioDirection = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radioNorth ) );
 
        radioSouth = gtk_radio_button_new_with_label( radioDirection, "South" );
        gtk_box_pack_start( GTK_BOX( hbox ), radioSouth, FALSE, FALSE, 2 );
        gtk_widget_show( radioSouth );
 
-       radioDirection = gtk_radio_button_group( GTK_RADIO_BUTTON( radioSouth ) );
+       radioDirection = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radioSouth ) );
 
        radioEast = gtk_radio_button_new_with_label( radioDirection, "East" );
        gtk_box_pack_start( GTK_BOX( hbox ), radioEast, FALSE, FALSE, 1 );
        gtk_widget_show( radioEast );
 
-       radioDirection = gtk_radio_button_group( GTK_RADIO_BUTTON( radioEast ) );
+       radioDirection = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radioEast ) );
 
        radioWest = gtk_radio_button_new_with_label( radioDirection, "West" );
        gtk_box_pack_start( GTK_BOX( hbox ), radioWest, FALSE, FALSE, 0 );
@@ -692,17 +691,17 @@ EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){
 
        // --------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_label_new( "Style:" );
+       w = ui::Label( "Style:" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 5 );
        gtk_widget_show( w );
 
        // --------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
@@ -710,13 +709,13 @@ EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){
        gtk_box_pack_start( GTK_BOX( hbox ), radioOldStyle, FALSE, FALSE, 0 );
        gtk_widget_show( radioOldStyle );
 
-       radioStyle = gtk_radio_button_group( GTK_RADIO_BUTTON( radioOldStyle ) );
+       radioStyle = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radioOldStyle ) );
 
        radioBobStyle = gtk_radio_button_new_with_label( radioStyle, "Bob's Style" );
        gtk_box_pack_start( GTK_BOX( hbox ), radioBobStyle, FALSE, FALSE, 0 );
        gtk_widget_show( radioBobStyle );
 
-       radioStyle = gtk_radio_button_group( GTK_RADIO_BUTTON( radioBobStyle ) );
+       radioStyle = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radioBobStyle ) );
 
        radioCornerStyle = gtk_radio_button_new_with_label( radioStyle, "Corner Style" );
        gtk_box_pack_start( GTK_BOX( hbox ), radioCornerStyle, FALSE, FALSE, 0 );
@@ -729,36 +728,36 @@ EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){
        // djbob: think we need some button callback functions or smuffin
        // FIXME: actually get around to doing what i suggested!!!!
 
-       checkUseDetail = gtk_check_button_new_with_label( "Use Detail Brushes" );
+       checkUseDetail = ui::CheckButton( "Use Detail Brushes" );
        gtk_box_pack_start( GTK_BOX( hbox ), checkUseDetail, FALSE, FALSE, 0 );
        gtk_widget_show( checkUseDetail );
 
        // --------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       textMainTex = gtk_entry_new_with_max_length( 512 );
+       textMainTex = ui::Entry( 512 );
        gtk_entry_set_text( GTK_ENTRY( textMainTex ), rs->mainTexture );
        gtk_box_pack_start( GTK_BOX( hbox ), textMainTex, FALSE, FALSE, 0 );
        gtk_widget_show( textMainTex );
 
-       w = gtk_label_new( "Main Texture" );
+       w = ui::Label( "Main Texture" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
        gtk_widget_show( w );
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       textRiserTex = gtk_entry_new_with_max_length( 512 );
+       textRiserTex = ui::Entry( 512 );
        gtk_box_pack_start( GTK_BOX( hbox ), textRiserTex, FALSE, FALSE, 0 );
        gtk_widget_show( textRiserTex );
 
-       w = gtk_label_new( "Riser Texture" );
+       w = ui::Label( "Riser Texture" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
        gtk_widget_show( w );
 
@@ -767,20 +766,20 @@ EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){
        gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_button_new_with_label( "OK" );
+       w = ui::Button( "OK" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
-       GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
+       gtk_widget_set_can_default( w, true );
        gtk_widget_grab_default( w );
        gtk_widget_show( w );
 
-       w = gtk_button_new_with_label( "Cancel" );
+       w = ui::Button( "Cancel" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
        gtk_widget_show( w );
 
        ret = eIDCANCEL;
@@ -855,14 +854,14 @@ EMessageBoxReturn DoDoorsBox( DoorRS* rs ){
        EMessageBoxReturn ret;
        int loop = 1;
 
-       window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       window = ui::Window( ui::window_type::TOP );
 
-       gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
 
        gtk_window_set_title( GTK_WINDOW( window ), "Door Builder" );
 
-       gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+       gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
 
        g_object_set_data( G_OBJECT( window ), "loop", &loop );
        g_object_set_data( G_OBJECT( window ), "ret", &ret );
@@ -870,126 +869,124 @@ EMessageBoxReturn DoDoorsBox( DoorRS* rs ){
        gtk_widget_realize( window );
 
        char buffer[256];
-       GList       *listMainTextures = NULL;
-       GList       *listTrimTextures = NULL;
-       LoadGList( GetFilename( buffer, "plugins/bt/door-tex.txt" ), &listMainTextures );
-       LoadGList( GetFilename( buffer, "plugins/bt/door-tex-trim.txt" ), &listTrimTextures );
+       GtkListStore *listMainTextures = gtk_list_store_new( 1, G_TYPE_STRING );
+       GtkListStore *listTrimTextures = gtk_list_store_new( 1, G_TYPE_STRING );
+       LoadGList( GetFilename( buffer, "plugins/bt/door-tex.txt" ), listMainTextures );
+       LoadGList( GetFilename( buffer, "plugins/bt/door-tex-trim.txt" ), listTrimTextures );
 
-       vbox = gtk_vbox_new( FALSE, 10 );
+       vbox = ui::VBox( FALSE, 10 );
        gtk_container_add( GTK_CONTAINER( window ), vbox );
        gtk_widget_show( vbox );
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       textFrontBackTex = gtk_entry_new_with_max_length( 512 );
+       textFrontBackTex = ui::Entry( 512 );
        gtk_entry_set_text( GTK_ENTRY( textFrontBackTex ), rs->mainTexture );
        gtk_box_pack_start( GTK_BOX( hbox ), textFrontBackTex, FALSE, FALSE, 0 );
        gtk_widget_show( textFrontBackTex );
 
-       w = gtk_label_new( "Door Front/Back Texture" );
+       w = ui::Label( "Door Front/Back Texture" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
 
        // ------------------------ //
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       textTrimTex = gtk_entry_new_with_max_length( 512 );
+       textTrimTex = ui::Entry( 512 );
        gtk_box_pack_start( GTK_BOX( hbox ), textTrimTex, FALSE, FALSE, 0 );
        gtk_widget_show( textTrimTex );
 
-       w = gtk_label_new( "Door Trim Texture" );
+       w = ui::Label( "Door Trim Texture" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
 
        // ----------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
        // sp: horizontally ????
        // djbob: yes mars, u can spell :]
-       checkScaleMainH = gtk_check_button_new_with_label( "Scale Main Texture Horizontally" );
+       checkScaleMainH = ui::CheckButton( "Scale Main Texture Horizontally" );
        gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( checkScaleMainH ), TRUE );
        gtk_box_pack_start( GTK_BOX( hbox ), checkScaleMainH, FALSE, FALSE, 0 );
        gtk_widget_show( checkScaleMainH );
 
-       checkScaleTrimH = gtk_check_button_new_with_label( "Scale Trim Texture Horizontally" );
+       checkScaleTrimH = ui::CheckButton( "Scale Trim Texture Horizontally" );
        gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( checkScaleTrimH ), TRUE );
        gtk_box_pack_start( GTK_BOX( hbox ), checkScaleTrimH, FALSE, FALSE, 0 );
        gtk_widget_show( checkScaleTrimH );
 
        // ---------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       checkScaleMainV = gtk_check_button_new_with_label( "Scale Main Texture Vertically" );
+       checkScaleMainV = ui::CheckButton( "Scale Main Texture Vertically" );
        gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( checkScaleMainV ), TRUE );
        gtk_box_pack_start( GTK_BOX( hbox ), checkScaleMainV, FALSE, FALSE, 0 );
        gtk_widget_show( checkScaleMainV );
 
-       checkScaleTrimV = gtk_check_button_new_with_label( "Scale Trim Texture Vertically" );
+       checkScaleTrimV = ui::CheckButton( "Scale Trim Texture Vertically" );
        gtk_box_pack_start( GTK_BOX( hbox ), checkScaleTrimV, FALSE, FALSE, 0 );
        gtk_widget_show( checkScaleTrimV );
 
        // --------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
        // djbob: lists added
 
-       comboMain = gtk_combo_new();
+       comboMain = gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(listMainTextures));
+       gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(comboMain), 0);
        gtk_box_pack_start( GTK_BOX( hbox ), comboMain, FALSE, FALSE, 0 );
-       gtk_combo_set_popdown_strings( GTK_COMBO( comboMain ), listMainTextures );
-       gtk_combo_set_use_arrows( GTK_COMBO( comboMain ), 1 );
        gtk_widget_show( comboMain );
 
        tw1.one = textFrontBackTex;
-       tw1.two = comboMain;
+       tw1.two = GTK_COMBO_BOX(comboMain);
 
-       buttonSetMain = gtk_button_new_with_label( "Set As Main Texture" );
-       gtk_signal_connect( GTK_OBJECT( buttonSetMain ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback_settex ), &tw1 );
+       buttonSetMain = ui::Button( "Set As Main Texture" );
+       g_signal_connect( GTK_OBJECT( buttonSetMain ), "clicked", G_CALLBACK( dialog_button_callback_settex ), &tw1 );
        gtk_box_pack_start( GTK_BOX( hbox ), buttonSetMain, FALSE, FALSE, 0 );
        gtk_widget_show( buttonSetMain );
 
        // ------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       comboTrim = gtk_combo_new();
+       comboTrim = gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(listTrimTextures));
+       gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(comboMain), 0);
        gtk_box_pack_start( GTK_BOX( hbox ), comboTrim, FALSE, FALSE, 0 );
-       gtk_combo_set_popdown_strings( GTK_COMBO( comboTrim ), listTrimTextures );
-       gtk_combo_set_use_arrows( GTK_COMBO( comboMain ), 1 );
        gtk_widget_show( comboTrim );
 
        tw2.one = textTrimTex;
-       tw2.two = comboTrim;
+       tw2.two = GTK_COMBO_BOX(comboTrim);
 
-       buttonSetTrim = gtk_button_new_with_label( "Set As Trim Texture" );
-       gtk_signal_connect( GTK_OBJECT( buttonSetTrim ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback_settex ), &tw2 );
+       buttonSetTrim = ui::Button( "Set As Trim Texture" );
+       g_signal_connect( GTK_OBJECT( buttonSetTrim ), "clicked", G_CALLBACK( dialog_button_callback_settex ), &tw2 );
        gtk_box_pack_start( GTK_BOX( hbox ), buttonSetTrim, FALSE, FALSE, 0 );
        gtk_widget_show( buttonSetTrim );
 
        // ------------------ //
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_label_new( "Orientation" );
+       w = ui::Label( "Orientation" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
 
@@ -998,7 +995,7 @@ EMessageBoxReturn DoDoorsBox( DoorRS* rs ){
        gtk_box_pack_start( GTK_BOX( hbox ), radioNS, FALSE, FALSE, 0 );
        gtk_widget_show( radioNS );
 
-       radioOrientation = gtk_radio_button_group( GTK_RADIO_BUTTON( radioNS ) );
+       radioOrientation = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radioNS ) );
 
        radioEW = gtk_radio_button_new_with_label( radioOrientation, "East - West" );
        gtk_box_pack_start( GTK_BOX( hbox ), radioEW, FALSE, FALSE, 0 );
@@ -1012,20 +1009,20 @@ EMessageBoxReturn DoDoorsBox( DoorRS* rs ){
 
        // ----------------- //
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_button_new_with_label( "OK" );
+       w = ui::Button( "OK" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
-       GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
+       gtk_widget_set_can_default( w, true );
        gtk_widget_grab_default( w );
        gtk_widget_show( w );
 
-       w = gtk_button_new_with_label( "Cancel" );
+       w = ui::Button( "Cancel" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
        gtk_widget_show( w );
        ret = eIDCANCEL;
 
@@ -1070,13 +1067,13 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){
        EMessageBoxReturn ret;
        int loop = 1;
 
-       window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       window = ui::Window( ui::window_type::TOP );
 
-       gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
 
        gtk_window_set_title( GTK_WINDOW( window ), "Texture Reset" );
-       gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+       gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
 
        g_object_set_data( G_OBJECT( window ), "loop", &loop );
        g_object_set_data( G_OBJECT( window ), "ret", &ret );
@@ -1085,65 +1082,65 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){
 
 
 
-       vbox = gtk_vbox_new( FALSE, 10 );
+       vbox = ui::VBox( FALSE, 10 );
        gtk_container_add( GTK_CONTAINER( window ), vbox );
        gtk_widget_show( vbox );
 
        // ---- vbox ----
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
        gtk_widget_show( hbox );
 
        // ---- hbox ----
 
-       text1 = gtk_entry_new_with_max_length( 256 );
+       text1 = ui::Entry( 256 );
        gtk_entry_set_text( (GtkEntry*)text1, "25" );
        gtk_box_pack_start( GTK_BOX( hbox ), text1, FALSE, FALSE, 2 );
        gtk_widget_show( text1 );
 
-       w = gtk_label_new( "Number Of Points" );
+       w = ui::Label( "Number Of Points" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
        gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
        gtk_widget_show( w );
 
        // ---- /hbox ----
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
        gtk_widget_show( hbox );
 
        // ---- hbox ----
 
-       text2 = gtk_entry_new_with_max_length( 256 );
+       text2 = ui::Entry( 256 );
        gtk_entry_set_text( (GtkEntry*)text2, "3" );
        gtk_box_pack_start( GTK_BOX( hbox ), text2, FALSE, FALSE, 2 );
        gtk_widget_show( text2 );
 
-       w = gtk_label_new( "Multipler" );
+       w = ui::Label( "Multipler" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
        gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
        gtk_widget_show( w );
 
        // ---- /hbox ----
 
-       w = gtk_label_new( "Path Distance = dist(start -> apex) * multiplier" );
+       w = ui::Label( "Path Distance = dist(start -> apex) * multiplier" );
        gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
        gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
        gtk_widget_show( w );
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
        gtk_widget_show( hbox );
 
        // ---- hbox ----
 
-       text3 = gtk_entry_new_with_max_length( 256 );
+       text3 = ui::Entry( 256 );
        gtk_entry_set_text( (GtkEntry*)text3, "-800" );
        gtk_box_pack_start( GTK_BOX( hbox ), text3, FALSE, FALSE, 2 );
        gtk_widget_show( text3 );
 
-       w = gtk_label_new( "Gravity" );
+       w = ui::Label( "Gravity" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
        gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
        gtk_widget_show( w );
@@ -1154,11 +1151,11 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){
        gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
 
-       check1 = gtk_check_button_new_with_label( "No Dynamic Update" );
+       check1 = ui::CheckButton( "No Dynamic Update" );
        gtk_box_pack_start( GTK_BOX( vbox ), check1, FALSE, FALSE, 0 );
        gtk_widget_show( check1 );
 
-       check2 = gtk_check_button_new_with_label( "Show Bounding Lines" );
+       check2 = ui::CheckButton( "Show Bounding Lines" );
        gtk_box_pack_start( GTK_BOX( vbox ), check2, FALSE, FALSE, 0 );
        gtk_widget_show( check2 );
 
@@ -1173,26 +1170,26 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){
 
        // ----------------- //
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_button_new_with_label( "Enable" );
+       w = ui::Button( "Enable" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
        gtk_widget_show( w );
 
-       GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+       gtk_widget_set_can_default( w, true );
        gtk_widget_grab_default( w );
 
-       w = gtk_button_new_with_label( "Disable" );
+       w = ui::Button( "Disable" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
        gtk_widget_show( w );
 
-       w = gtk_button_new_with_label( "Cancel" );
+       w = ui::Button( "Cancel" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
        gtk_widget_show( w );
 
        ret = eIDCANCEL;
@@ -1241,13 +1238,13 @@ EMessageBoxReturn DoCTFColourChangeBox(){
        EMessageBoxReturn ret;
        int loop = 1;
 
-       window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       window = ui::Window( ui::window_type::TOP );
 
-       gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
 
        gtk_window_set_title( GTK_WINDOW( window ), "CTF Colour Changer" );
-       gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+       gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
 
        g_object_set_data( G_OBJECT( window ), "loop", &loop );
        g_object_set_data( G_OBJECT( window ), "ret", &ret );
@@ -1256,34 +1253,34 @@ EMessageBoxReturn DoCTFColourChangeBox(){
 
 
 
-       vbox = gtk_vbox_new( FALSE, 10 );
+       vbox = ui::VBox( FALSE, 10 );
        gtk_container_add( GTK_CONTAINER( window ), vbox );
        gtk_widget_show( vbox );
 
        // ---- vbox ----
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, TRUE, 0 );
        gtk_widget_show( hbox );
 
        // ---- hbox ---- ok/cancel buttons
 
-       w = gtk_button_new_with_label( "Red->Blue" );
+       w = ui::Button( "Red->Blue" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
 
-       GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+       gtk_widget_set_can_default( w, true );
        gtk_widget_grab_default( w );
        gtk_widget_show( w );
 
-       w = gtk_button_new_with_label( "Blue->Red" );
+       w = ui::Button( "Blue->Red" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
        gtk_widget_show( w );
 
-       w = gtk_button_new_with_label( "Cancel" );
+       w = ui::Button( "Cancel" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
        gtk_widget_show( w );
        ret = eIDCANCEL;
 
@@ -1312,26 +1309,26 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){
        EMessageBoxReturn ret;
        int loop = 1;
 
-       window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       window = ui::Window( ui::window_type::TOP );
 
-       gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
 
        gtk_window_set_title( GTK_WINDOW( window ), "Texture Reset" );
-       gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+       gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
 
        g_object_set_data( G_OBJECT( window ), "loop", &loop );
        g_object_set_data( G_OBJECT( window ), "ret", &ret );
 
        gtk_widget_realize( window );
 
-       vbox = gtk_vbox_new( FALSE, 10 );
+       vbox = ui::VBox( FALSE, 10 );
        gtk_container_add( GTK_CONTAINER( window ), vbox );
        gtk_widget_show( vbox );
 
        // ---- vbox ----
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
        gtk_widget_show( hbox );
 
@@ -1340,18 +1337,18 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){
        texSelected = "Currently Selected Texture:   ";
        texSelected += GetCurrentTexture();
 
-       w = gtk_label_new( texSelected );
+       w = ui::Label( texSelected );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
        gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
        gtk_widget_show( w );
 
        // ---- /hbox ----
 
-       frame = gtk_frame_new( "Reset Texture Names" );
+       frame = ui::Frame( "Reset Texture Names" );
        gtk_widget_show( frame );
        gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
 
-       table = gtk_table_new( 2, 3, TRUE );
+       table = ui::Table( 2, 3, TRUE );
        gtk_widget_show( table );
        gtk_container_add( GTK_CONTAINER( frame ), table );
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
@@ -1360,33 +1357,33 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){
 
        // ---- frame ----
 
-       dlgTexReset.cbTexChange = gtk_check_button_new_with_label( "Enabled" );
-       gtk_signal_connect( GTK_OBJECT( dlgTexReset.cbTexChange ), "toggled", GTK_SIGNAL_FUNC( dialog_button_callback_texreset_update ), NULL );
+       dlgTexReset.cbTexChange = ui::CheckButton( "Enabled" );
+       g_signal_connect( GTK_OBJECT( dlgTexReset.cbTexChange ), "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL );
        gtk_widget_show( dlgTexReset.cbTexChange );
        gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbTexChange, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
 
-       w = gtk_label_new( "Old Name: " );
+       w = ui::Label( "Old Name: " );
        gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_widget_show( w );
 
-       dlgTexReset.editTexOld = gtk_entry_new_with_max_length( 256 );
+       dlgTexReset.editTexOld = ui::Entry( 256 );
        gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editTexOld ), rs->textureName );
        gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editTexOld, 2, 3, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_widget_show( dlgTexReset.editTexOld );
 
-       w = gtk_label_new( "New Name: " );
+       w = ui::Label( "New Name: " );
        gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_widget_show( w );
 
-       dlgTexReset.editTexNew = gtk_entry_new_with_max_length( 256 );
+       dlgTexReset.editTexNew = ui::Entry( 256 );
        gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editTexNew ), rs->textureName );
        gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editTexNew, 2, 3, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -1395,11 +1392,11 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){
 
        // ---- /frame ----
 
-       frame = gtk_frame_new( "Reset Scales" );
+       frame = ui::Frame( "Reset Scales" );
        gtk_widget_show( frame );
        gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
 
-       table = gtk_table_new( 2, 3, TRUE );
+       table = ui::Table( 2, 3, TRUE );
        gtk_widget_show( table );
        gtk_container_add( GTK_CONTAINER( frame ), table );
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
@@ -1408,20 +1405,20 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){
 
        // ---- frame ----
 
-       dlgTexReset.cbScaleHor = gtk_check_button_new_with_label( "Enabled" );
-       gtk_signal_connect( GTK_OBJECT( dlgTexReset.cbScaleHor ), "toggled", GTK_SIGNAL_FUNC( dialog_button_callback_texreset_update ), NULL );
+       dlgTexReset.cbScaleHor = ui::CheckButton( "Enabled" );
+       g_signal_connect( GTK_OBJECT( dlgTexReset.cbScaleHor ), "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL );
        gtk_widget_show( dlgTexReset.cbScaleHor );
        gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbScaleHor, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
 
-       w = gtk_label_new( "New Horizontal Scale: " );
+       w = ui::Label( "New Horizontal Scale: " );
        gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_widget_show( w );
 
-       dlgTexReset.editScaleHor = gtk_entry_new_with_max_length( 256 );
+       dlgTexReset.editScaleHor = ui::Entry( 256 );
        gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editScaleHor ), "0.5" );
        gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editScaleHor, 2, 3, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -1429,20 +1426,20 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){
        gtk_widget_show( dlgTexReset.editScaleHor );
 
 
-       dlgTexReset.cbScaleVert = gtk_check_button_new_with_label( "Enabled" );
-       gtk_signal_connect( GTK_OBJECT( dlgTexReset.cbScaleVert ), "toggled", GTK_SIGNAL_FUNC( dialog_button_callback_texreset_update ), NULL );
+       dlgTexReset.cbScaleVert = ui::CheckButton( "Enabled" );
+       g_signal_connect( GTK_OBJECT( dlgTexReset.cbScaleVert ), "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL );
        gtk_widget_show( dlgTexReset.cbScaleVert );
        gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbScaleVert, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
 
-       w = gtk_label_new( "New Vertical Scale: " );
+       w = ui::Label( "New Vertical Scale: " );
        gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_widget_show( w );
 
-       dlgTexReset.editScaleVert = gtk_entry_new_with_max_length( 256 );
+       dlgTexReset.editScaleVert = ui::Entry( 256 );
        gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editScaleVert ), "0.5" );
        gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editScaleVert, 2, 3, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -1451,11 +1448,11 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){
 
        // ---- /frame ----
 
-       frame = gtk_frame_new( "Reset Shift" );
+       frame = ui::Frame( "Reset Shift" );
        gtk_widget_show( frame );
        gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
 
-       table = gtk_table_new( 2, 3, TRUE );
+       table = ui::Table( 2, 3, TRUE );
        gtk_widget_show( table );
        gtk_container_add( GTK_CONTAINER( frame ), table );
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
@@ -1464,20 +1461,20 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){
 
        // ---- frame ----
 
-       dlgTexReset.cbShiftHor = gtk_check_button_new_with_label( "Enabled" );
-       gtk_signal_connect( GTK_OBJECT( dlgTexReset.cbShiftHor ), "toggled", GTK_SIGNAL_FUNC( dialog_button_callback_texreset_update ), NULL );
+       dlgTexReset.cbShiftHor = ui::CheckButton( "Enabled" );
+       g_signal_connect( GTK_OBJECT( dlgTexReset.cbShiftHor ), "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL );
        gtk_widget_show( dlgTexReset.cbShiftHor );
        gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbShiftHor, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
 
-       w = gtk_label_new( "New Horizontal Shift: " );
+       w = ui::Label( "New Horizontal Shift: " );
        gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_widget_show( w );
 
-       dlgTexReset.editShiftHor = gtk_entry_new_with_max_length( 256 );
+       dlgTexReset.editShiftHor = ui::Entry( 256 );
        gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editShiftHor ), "0" );
        gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editShiftHor, 2, 3, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -1485,20 +1482,20 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){
        gtk_widget_show( dlgTexReset.editShiftHor );
 
 
-       dlgTexReset.cbShiftVert = gtk_check_button_new_with_label( "Enabled" );
-       gtk_signal_connect( GTK_OBJECT( dlgTexReset.cbShiftVert ), "toggled", GTK_SIGNAL_FUNC( dialog_button_callback_texreset_update ), NULL );
+       dlgTexReset.cbShiftVert = ui::CheckButton( "Enabled" );
+       g_signal_connect( GTK_OBJECT( dlgTexReset.cbShiftVert ), "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL );
        gtk_widget_show( dlgTexReset.cbShiftVert );
        gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbShiftVert, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
 
-       w = gtk_label_new( "New Vertical Shift: " );
+       w = ui::Label( "New Vertical Shift: " );
        gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_widget_show( w );
 
-       dlgTexReset.editShiftVert = gtk_entry_new_with_max_length( 256 );
+       dlgTexReset.editShiftVert = ui::Entry( 256 );
        gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editShiftVert ), "0" );
        gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editShiftVert, 2, 3, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -1507,11 +1504,11 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){
 
        // ---- /frame ----
 
-       frame = gtk_frame_new( "Reset Rotation" );
+       frame = ui::Frame( "Reset Rotation" );
        gtk_widget_show( frame );
        gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
 
-       table = gtk_table_new( 1, 3, TRUE );
+       table = ui::Table( 1, 3, TRUE );
        gtk_widget_show( table );
        gtk_container_add( GTK_CONTAINER( frame ), table );
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
@@ -1520,19 +1517,19 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){
 
        // ---- frame ----
 
-       dlgTexReset.cbRotation = gtk_check_button_new_with_label( "Enabled" );
+       dlgTexReset.cbRotation = ui::CheckButton( "Enabled" );
        gtk_widget_show( dlgTexReset.cbRotation );
        gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbRotation, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
 
-       w = gtk_label_new( "New Rotation Value: " );
+       w = ui::Label( "New Rotation Value: " );
        gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_widget_show( w );
 
-       dlgTexReset.editRotation = gtk_entry_new_with_max_length( 256 );
+       dlgTexReset.editRotation = ui::Entry( 256 );
        gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editRotation ), "0" );
        gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editRotation, 2, 3, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -1541,28 +1538,28 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){
 
        // ---- /frame ----
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
        gtk_widget_show( hbox );
 
        // ---- hbox ----
 
-       w = gtk_button_new_with_label( "Use Selected Brushes" );
+       w = ui::Button( "Use Selected Brushes" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
 
-       GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+       gtk_widget_set_can_default( w, true );
        gtk_widget_grab_default( w );
        gtk_widget_show( w );
 
-       w = gtk_button_new_with_label( "Use All Brushes" );
+       w = ui::Button( "Use All Brushes" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
        gtk_widget_show( w );
 
-       w = gtk_button_new_with_label( "Cancel" );
+       w = ui::Button( "Cancel" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
        gtk_widget_show( w );
        ret = eIDCANCEL;
 
@@ -1648,36 +1645,36 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){
        EMessageBoxReturn ret;
        int loop = 1;
 
-       window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       window = ui::Window( ui::window_type::TOP );
 
-       gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
 
        gtk_window_set_title( GTK_WINDOW( window ), "Train Thing" );
-       gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+       gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
 
-       gtk_object_set_data( GTK_OBJECT( window ), "loop", &loop );
-       gtk_object_set_data( GTK_OBJECT( window ), "ret", &ret );
+       g_object_set_data( G_OBJECT( window ), "loop", &loop );
+       g_object_set_data( G_OBJECT( window ), "ret", &ret );
 
        gtk_widget_realize( window );
 
-       vbox = gtk_vbox_new( FALSE, 10 );
+       vbox = ui::VBox( FALSE, 10 );
        gtk_container_add( GTK_CONTAINER( window ), vbox );
        gtk_widget_show( vbox );
 
        // ---- vbox ----
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
        gtk_widget_show( hbox );
 
        // ---- /hbox ----
 
-       frame = gtk_frame_new( "Radii" );
+       frame = ui::Frame( "Radii" );
        gtk_widget_show( frame );
        gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
 
-       table = gtk_table_new( 2, 3, TRUE );
+       table = ui::Table( 2, 3, TRUE );
        gtk_widget_show( table );
        gtk_container_add( GTK_CONTAINER( frame ), table );
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
@@ -1686,13 +1683,13 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){
 
        // ---- frame ----
 
-       w = gtk_label_new( "X: " );
+       w = ui::Label( "X: " );
        gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_widget_show( w );
 
-       radiusX = gtk_entry_new_with_max_length( 256 );
+       radiusX = ui::Entry( 256 );
        gtk_entry_set_text( GTK_ENTRY( radiusX ), "100" );
        gtk_table_attach( GTK_TABLE( table ), radiusX, 1, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -1701,13 +1698,13 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){
 
 
 
-       w = gtk_label_new( "Y: " );
+       w = ui::Label( "Y: " );
        gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_widget_show( w );
 
-       radiusY = gtk_entry_new_with_max_length( 256 );
+       radiusY = ui::Entry( 256 );
        gtk_entry_set_text( GTK_ENTRY( radiusY ), "100" );
        gtk_table_attach( GTK_TABLE( table ), radiusY, 1, 2, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -1716,11 +1713,11 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){
 
 
 
-       frame = gtk_frame_new( "Angles" );
+       frame = ui::Frame( "Angles" );
        gtk_widget_show( frame );
        gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
 
-       table = gtk_table_new( 2, 3, TRUE );
+       table = ui::Table( 2, 3, TRUE );
        gtk_widget_show( table );
        gtk_container_add( GTK_CONTAINER( frame ), table );
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
@@ -1729,13 +1726,13 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){
 
        // ---- frame ----
 
-       w = gtk_label_new( "Start: " );
+       w = ui::Label( "Start: " );
        gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_widget_show( w );
 
-       angleStart = gtk_entry_new_with_max_length( 256 );
+       angleStart = ui::Entry( 256 );
        gtk_entry_set_text( GTK_ENTRY( angleStart ), "0" );
        gtk_table_attach( GTK_TABLE( table ), angleStart, 1, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -1744,13 +1741,13 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){
 
 
 
-       w = gtk_label_new( "End: " );
+       w = ui::Label( "End: " );
        gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_widget_show( w );
 
-       angleEnd = gtk_entry_new_with_max_length( 256 );
+       angleEnd = ui::Entry( 256 );
        gtk_entry_set_text( GTK_ENTRY( angleEnd ), "90" );
        gtk_table_attach( GTK_TABLE( table ), angleEnd, 1, 2, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -1758,11 +1755,11 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){
        gtk_widget_show( angleEnd );
 
 
-       frame = gtk_frame_new( "Height" );
+       frame = ui::Frame( "Height" );
        gtk_widget_show( frame );
        gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
 
-       table = gtk_table_new( 2, 3, TRUE );
+       table = ui::Table( 2, 3, TRUE );
        gtk_widget_show( table );
        gtk_container_add( GTK_CONTAINER( frame ), table );
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
@@ -1771,13 +1768,13 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){
 
        // ---- frame ----
 
-       w = gtk_label_new( "Start: " );
+       w = ui::Label( "Start: " );
        gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_widget_show( w );
 
-       heightStart = gtk_entry_new_with_max_length( 256 );
+       heightStart = ui::Entry( 256 );
        gtk_entry_set_text( GTK_ENTRY( heightStart ), "0" );
        gtk_table_attach( GTK_TABLE( table ), heightStart, 1, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -1786,13 +1783,13 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){
 
 
 
-       w = gtk_label_new( "End: " );
+       w = ui::Label( "End: " );
        gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_widget_show( w );
 
-       heightEnd = gtk_entry_new_with_max_length( 256 );
+       heightEnd = ui::Entry( 256 );
        gtk_entry_set_text( GTK_ENTRY( heightEnd ), "0" );
        gtk_table_attach( GTK_TABLE( table ), heightEnd, 1, 2, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -1801,11 +1798,11 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){
 
 
 
-       frame = gtk_frame_new( "Points" );
+       frame = ui::Frame( "Points" );
        gtk_widget_show( frame );
        gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
 
-       table = gtk_table_new( 2, 3, TRUE );
+       table = ui::Table( 2, 3, TRUE );
        gtk_widget_show( table );
        gtk_container_add( GTK_CONTAINER( frame ), table );
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
@@ -1814,13 +1811,13 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){
 
        // ---- frame ----
 
-       w = gtk_label_new( "Number: " );
+       w = ui::Label( "Number: " );
        gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_widget_show( w );
 
-       numPoints = gtk_entry_new_with_max_length( 256 );
+       numPoints = ui::Entry( 256 );
        gtk_entry_set_text( GTK_ENTRY( numPoints ), "0" );
        gtk_table_attach( GTK_TABLE( table ), numPoints, 1, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -1828,23 +1825,23 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){
        gtk_widget_show( numPoints );
 
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
        gtk_widget_show( hbox );
 
        // ---- hbox ----
 
-       w = gtk_button_new_with_label( "Ok" );
+       w = ui::Button( "Ok" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
 
-       GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+       gtk_widget_set_can_default( w, true );
        gtk_widget_grab_default( w );
        gtk_widget_show( w );
 
-       w = gtk_button_new_with_label( "Cancel" );
+       w = ui::Button( "Cancel" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
        gtk_widget_show( w );
        ret = eIDCANCEL;
 
@@ -1911,14 +1908,14 @@ EMessageBoxReturn DoMakeChainBox( MakeChainRS* rs ){
 
        char    *text = "Please set a value in the boxes below and press 'OK' to make a chain";
 
-       window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       window = ui::Window( ui::window_type::TOP );
 
-       gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
 
        gtk_window_set_title( GTK_WINDOW( window ), "Make Chain" );
 
-       gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+       gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
 
        g_object_set_data( G_OBJECT( window ), "loop", &loop );
        g_object_set_data( G_OBJECT( window ), "ret", &ret );
@@ -1926,16 +1923,16 @@ EMessageBoxReturn DoMakeChainBox( MakeChainRS* rs ){
        gtk_widget_realize( window );
 
        // new vbox
-       vbox = gtk_vbox_new( FALSE, 10 );
+       vbox = ui::VBox( FALSE, 10 );
        gtk_container_add( GTK_CONTAINER( window ), vbox );
        gtk_widget_show( vbox );
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_container_add( GTK_CONTAINER( vbox ), hbox );
        gtk_widget_show( hbox );
 
        // dunno if you want this text or not ...
-       w = gtk_label_new( text );
+       w = ui::Label( text );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
 
@@ -1946,43 +1943,43 @@ EMessageBoxReturn DoMakeChainBox( MakeChainRS* rs ){
        // ------------------------- //
 
        // new hbox
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       textlinkNum = gtk_entry_new_with_max_length( 256 );
+       textlinkNum = ui::Entry( 256 );
        gtk_box_pack_start( GTK_BOX( hbox ), textlinkNum, FALSE, FALSE, 1 );
        gtk_widget_show( textlinkNum );
 
-       w = gtk_label_new( "Number of elements in chain" );
+       w = ui::Label( "Number of elements in chain" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
        gtk_widget_show( w );
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       textlinkName = gtk_entry_new_with_max_length( 256 );
+       textlinkName = ui::Entry( 256 );
        gtk_box_pack_start( GTK_BOX( hbox ), textlinkName, FALSE, FALSE, 0 );
        gtk_widget_show( textlinkName );
 
-       w = gtk_label_new( "Basename for chain's targetnames." );
+       w = ui::Label( "Basename for chain's targetnames." );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
        gtk_widget_show( w );
 
 
-       w = gtk_button_new_with_label( "OK" );
+       w = ui::Button( "OK" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
-       GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
+       gtk_widget_set_can_default( w, true );
        gtk_widget_grab_default( w );
        gtk_widget_show( w );
 
-       w = gtk_button_new_with_label( "Cancel" );
+       w = ui::Button( "Cancel" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
        gtk_widget_show( w );
 
        ret = eIDCANCEL;
@@ -2012,4 +2009,4 @@ EMessageBoxReturn DoMakeChainBox( MakeChainRS* rs ){
        gtk_widget_destroy( window );
 
        return ret;
-}
\ No newline at end of file
+}
index ae35490431b48cfcd43779ecb82c292c77e21322..75db2d18697ff85a5672c38b8e1366c558f0bcdf 100644 (file)
@@ -20,6 +20,7 @@
 #if !defined( INCLUDED_DIALOGS_GTK_H )
 #define INCLUDED_DIALOGS_GTK_H
 
+#include <gtk/gtk.h>
 #include "qerplugin.h"
 
 struct BuildStairsRS {
@@ -94,7 +95,7 @@ typedef struct _GtkWidget GtkWidget;
 
 struct TwinWidget {
        GtkWidget* one;
-       GtkWidget* two;
+       GtkComboBox* two;
 };
 
 EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMessageBoxType type );
index 810798397d6b7cfac63542f60d41c17a8fb612a3..c2b1ed9e30672e50ebacdc7aa02fd85ead8dcc85 100644 (file)
@@ -24,6 +24,7 @@
 #endif
 
 #include <glib.h>
+#include <gtk/gtk.h>
 
 #include "misc.h"
 
@@ -54,7 +55,7 @@ bool LoadExclusionList( char* filename, std::list<Str>* exclusionList ){
        return FALSE;
 }
 
-bool LoadGList( char* filename, GList** loadlist ){
+bool LoadGList( char* filename, GtkListStore* loadlist ){
        FILE* eFile = fopen( filename, "r" );
        if ( eFile ) {
                char buffer[256];
@@ -67,7 +68,9 @@ bool LoadGList( char* filename, GList** loadlist ){
                        if ( strlen( buffer ) > 0 ) {
                                char* buffer2 = new char[strlen( buffer ) + 1];
                                strcpy( buffer2, buffer );
-                               *loadlist = g_list_append( *loadlist, buffer2 );
+                               GtkTreeIter iter;
+                               gtk_list_store_append(loadlist, &iter);
+                               gtk_list_store_set(loadlist, &iter, 0, buffer2, -1);
                        }
                        else{
                                cnt++;
index 827c9cbc1638b2a97221b7a8d5a181be4ea96717..00e50266f0d9e0db2b1c50756c0d0b420645ac68 100644 (file)
@@ -18,8 +18,9 @@
  */
 
 #include <list>
+#include <gtk/gtk.h>
 #include "str.h"
 typedef struct _GList GList;
 
 bool LoadExclusionList( char* filename, std::list<Str>* exclusionList );
-bool LoadGList( char* filename, GList** loadlist );
+bool LoadGList( char* filename, GtkListStore* loadlist );
index f466c5153558315b3a223d3419558b87982ee6f7..2e47035d75b5e0630c611bc8395369198edc32b4 100644 (file)
@@ -58,9 +58,9 @@
        / |   / |
       /  |  /  |
     4 ----- 6  |
- |  2|_|___|8
- |  /  |   /
- | /   |  /       ----> WEST, definitely
    |  2|_|___|8
    |  /  |   /
    | /   |  /       ----> WEST, definitely
  ||/    | /
     1|_____|/3
 
index 6a346f3a07a6ce7997c25f3f9e9a087651fe0f97..be8d0bae54f45be693f482c9620fe9fa685a8f1f 100644 (file)
@@ -18,8 +18,8 @@ void OnDestroy( GtkWidget* w, gpointer data ){
 }
 
 void OnExportClicked( GtkButton* button, gpointer user_data ){
-       GtkWidget* window = lookup_widget( GTK_WIDGET( button ), "w_plugplug2" );
-       ASSERT_NOTNULL( window );
+       ui::Widget window = lookup_widget( GTK_WIDGET( button ), "w_plugplug2" );
+       ASSERT_TRUE( window );
        const char* cpath = GlobalRadiant().m_pfnFileDialog( window, false, "Save as Obj", 0, 0, false, false, true );
        if ( !cpath ) {
                return;
@@ -68,7 +68,7 @@ void OnExportClicked( GtkButton* button, gpointer user_data ){
                {
                        radio = lookup_widget( GTK_WIDGET( button ), "r_nocollapse" );
                        ASSERT_NOTNULL( radio );
-                       ASSERT_NOTNULL( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radio ) ) );
+                       ASSERT_TRUE( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radio ) ) );
                        mode = COLLAPSE_NONE;
                }
        }
index 76279ab043eb6dff5be61d5873cd8783b681a796..c0f18c82b29db4d62370e5d9a7183fc6940a6097 100644 (file)
@@ -7,7 +7,7 @@
 
 #define GLADE_HOOKUP_OBJECT( component,widget,name ) \
        g_object_set_data_full( G_OBJECT( component ), name, \
-                                                       gtk_widget_ref( widget ), (GDestroyNotify) gtk_widget_unref )
+                                                       g_object_ref( widget ), (GDestroyNotify) g_object_unref )
 
 #define GLADE_HOOKUP_OBJECT_NO_REF( component,widget,name )    \
        g_object_set_data( G_OBJECT( component ), name, widget )
@@ -37,36 +37,33 @@ create_w_plugplug2( void ){
        GtkWidget *t_exportmaterials;
        GtkWidget *t_limitmatnames;
        GtkWidget *t_objects;
-       GtkTooltips *tooltips;
 
-       tooltips = gtk_tooltips_new();
-
-       w_plugplug2 = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       w_plugplug2 = ui::Window( ui::window_type::TOP );
        gtk_widget_set_name( w_plugplug2, "w_plugplug2" );
        gtk_window_set_title( GTK_WINDOW( w_plugplug2 ), "BrushExport-Plugin 3.0 by namespace" );
        gtk_window_set_position( GTK_WINDOW( w_plugplug2 ), GTK_WIN_POS_CENTER );
        gtk_window_set_destroy_with_parent( GTK_WINDOW( w_plugplug2 ), TRUE );
 
-       vbox1 = gtk_vbox_new( FALSE, 0 );
+       vbox1 = ui::VBox( FALSE, 0 );
        gtk_widget_set_name( vbox1, "vbox1" );
        gtk_widget_show( vbox1 );
        gtk_container_add( GTK_CONTAINER( w_plugplug2 ), vbox1 );
        gtk_container_set_border_width( GTK_CONTAINER( vbox1 ), 5 );
 
-       hbox2 = gtk_hbox_new( TRUE, 5 );
+       hbox2 = ui::HBox( TRUE, 5 );
        gtk_widget_set_name( hbox2, "hbox2" );
        gtk_widget_show( hbox2 );
        gtk_box_pack_start( GTK_BOX( vbox1 ), hbox2, FALSE, FALSE, 0 );
        gtk_container_set_border_width( GTK_CONTAINER( hbox2 ), 5 );
 
-       vbox4 = gtk_vbox_new( TRUE, 0 );
+       vbox4 = ui::VBox( TRUE, 0 );
        gtk_widget_set_name( vbox4, "vbox4" );
        gtk_widget_show( vbox4 );
        gtk_box_pack_start( GTK_BOX( hbox2 ), vbox4, TRUE, FALSE, 0 );
 
        r_collapse = gtk_radio_button_new_with_mnemonic( NULL, "Collapse mesh" );
        gtk_widget_set_name( r_collapse, "r_collapse" );
-       gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), r_collapse, "Collapse all brushes into a single group", "Collapse all brushes into a single group" );
+       gtk_widget_set_tooltip_text(r_collapse, "Collapse all brushes into a single group");
        gtk_widget_show( r_collapse );
        gtk_box_pack_start( GTK_BOX( vbox4 ), r_collapse, FALSE, FALSE, 0 );
        gtk_radio_button_set_group( GTK_RADIO_BUTTON( r_collapse ), r_collapse_group );
@@ -74,7 +71,7 @@ create_w_plugplug2( void ){
 
        r_collapsebymaterial = gtk_radio_button_new_with_mnemonic( NULL, "Collapse by material" );
        gtk_widget_set_name( r_collapsebymaterial, "r_collapsebymaterial" );
-       gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), r_collapsebymaterial, "Collapse into groups by material", "Collapse into groups by material" );
+       gtk_widget_set_tooltip_text(r_collapsebymaterial, "Collapse into groups by material");
        gtk_widget_show( r_collapsebymaterial );
        gtk_box_pack_start( GTK_BOX( vbox4 ), r_collapsebymaterial, FALSE, FALSE, 0 );
        gtk_radio_button_set_group( GTK_RADIO_BUTTON( r_collapsebymaterial ), r_collapse_group );
@@ -82,13 +79,13 @@ create_w_plugplug2( void ){
 
        r_nocollapse = gtk_radio_button_new_with_mnemonic( NULL, "Don't collapse" );
        gtk_widget_set_name( r_nocollapse, "r_nocollapse" );
-       gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), r_nocollapse, "Every brush is stored in its own group", "Every brush is stored in its own group" );
+       gtk_widget_set_tooltip_text(r_nocollapse, "Every brush is stored in its own group");
        gtk_widget_show( r_nocollapse );
        gtk_box_pack_start( GTK_BOX( vbox4 ), r_nocollapse, FALSE, FALSE, 0 );
        gtk_radio_button_set_group( GTK_RADIO_BUTTON( r_nocollapse ), r_collapse_group );
        r_collapse_group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( r_nocollapse ) );
 
-       vbox3 = gtk_vbox_new( FALSE, 0 );
+       vbox3 = ui::VBox( FALSE, 0 );
        gtk_widget_set_name( vbox3, "vbox3" );
        gtk_widget_show( vbox3 );
        gtk_box_pack_start( GTK_BOX( hbox2 ), vbox3, FALSE, FALSE, 0 );
@@ -105,37 +102,37 @@ create_w_plugplug2( void ){
        gtk_box_pack_start( GTK_BOX( vbox3 ), b_close, TRUE, FALSE, 0 );
        gtk_container_set_border_width( GTK_CONTAINER( b_close ), 5 );
 
-       vbox2 = gtk_vbox_new( FALSE, 5 );
+       vbox2 = ui::VBox( FALSE, 5 );
        gtk_widget_set_name( vbox2, "vbox2" );
        gtk_widget_show( vbox2 );
        gtk_box_pack_start( GTK_BOX( vbox1 ), vbox2, TRUE, TRUE, 0 );
        gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 2 );
 
-       label1 = gtk_label_new( "Ignored materials:" );
+       label1 = ui::Label( "Ignored materials:" );
        gtk_widget_set_name( label1, "label1" );
        gtk_widget_show( label1 );
        gtk_box_pack_start( GTK_BOX( vbox2 ), label1, FALSE, FALSE, 0 );
 
-       scrolledwindow1 = gtk_scrolled_window_new( NULL, NULL );
+       scrolledwindow1 = ui::ScrolledWindow();
        gtk_widget_set_name( scrolledwindow1, "scrolledwindow1" );
        gtk_widget_show( scrolledwindow1 );
        gtk_box_pack_start( GTK_BOX( vbox2 ), scrolledwindow1, TRUE, TRUE, 0 );
        gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
        gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scrolledwindow1 ), GTK_SHADOW_IN );
 
-       t_materialist = gtk_tree_view_new();
+       t_materialist = ui::TreeView();
        gtk_widget_set_name( t_materialist, "t_materialist" );
        gtk_widget_show( t_materialist );
        gtk_container_add( GTK_CONTAINER( scrolledwindow1 ), t_materialist );
        gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( t_materialist ), FALSE );
        gtk_tree_view_set_enable_search( GTK_TREE_VIEW( t_materialist ), FALSE );
 
-       ed_materialname = gtk_entry_new();
+       ed_materialname = ui::Entry();
        gtk_widget_set_name( ed_materialname, "ed_materialname" );
        gtk_widget_show( ed_materialname );
        gtk_box_pack_start( GTK_BOX( vbox2 ), ed_materialname, FALSE, FALSE, 0 );
 
-       hbox1 = gtk_hbox_new( TRUE, 0 );
+       hbox1 = ui::HBox( TRUE, 0 );
        gtk_widget_set_name( hbox1, "hbox1" );
        gtk_widget_show( hbox1 );
        gtk_box_pack_start( GTK_BOX( vbox2 ), hbox1, FALSE, FALSE, 0 );
@@ -206,7 +203,7 @@ GtkWidget* g_brushexp_window = 0;
 
 // spawn plugin window (and make sure it got destroyed first or never created)
 void CreateWindow( void ){
-       ASSERT_NOTNULL( !g_brushexp_window );
+       ASSERT_TRUE( !g_brushexp_window );
 
        GtkWidget* wnd = create_w_plugplug2();
 
@@ -214,7 +211,7 @@ void CreateWindow( void ){
        GtkTreeViewColumn* col = gtk_tree_view_column_new();
        gtk_tree_view_column_set_title( col, "materials" );
        gtk_tree_view_append_column( GTK_TREE_VIEW( lookup_widget( wnd, "t_materialist" ) ), col );
-       GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
+       auto renderer = ui::CellRendererText();
        gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW( lookup_widget( wnd, "t_materialist" ) ), -1, "", renderer, "text", 0, NULL );
 
        // list store
index 274c840ee70f1947e408e6b360693ff148c78d9b..8e498987317783abd092ce0e18208ba6db4b4378 100644 (file)
@@ -24,7 +24,6 @@
 #include "qerplugin.h"
 
 #include <gtk/gtk.h>
-#include <gtk/gtktreeview.h>
 
 #include "debugging/debugging.h"
 #include "string/string.h"
@@ -50,11 +49,11 @@ bool IsWindowOpen( void );
 
 namespace BrushExport
 {
-GtkWindow* g_mainwnd;
+ui::Window g_mainwnd;
 
 const char* init( void* hApp, void* pMainWidget ){
-       g_mainwnd = (GtkWindow*)pMainWidget;
-       ASSERT_NOTNULL( g_mainwnd );
+       g_mainwnd = ui::Window(GTK_WINDOW(pMainWidget));
+       ASSERT_TRUE( g_mainwnd );
        return "";
 }
 const char* getName(){
@@ -69,7 +68,7 @@ const char* getCommandTitleList(){
 
 void dispatch( const char* command, float* vMin, float* vMax, bool bSingleBrush ){
        if ( string_equal( command, "About" ) ) {
-               GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_mainwnd ), "Brushexport plugin v 2.0 by namespace (www.codecreator.net)\n"
+               GlobalRadiant().m_pfnMessageBox( g_mainwnd, "Brushexport plugin v 2.0 by namespace (www.codecreator.net)\n"
                                                                                                                                  "Enjoy!\n\nSend feedback to spam@codecreator.net", "About me...",
                                                                                 eMB_OK,
                                                                                 eMB_ICONDEFAULT );
index 79c5e145b6939eb4ef6aa1f0a32b1fecc11e5679..768f213a6f77add162ccd54da793e1cfae97ebfe 100644 (file)
@@ -1,8 +1,9 @@
 #include <gtk/gtk.h>
+#include <uilib/uilib.h>
 
 #include "support.h"
 
-GtkWidget*
+ui::Widget
 lookup_widget( GtkWidget       *widget,
                           const gchar     *widget_name ){
        GtkWidget *parent, *found_widget;
@@ -13,7 +14,7 @@ lookup_widget( GtkWidget       *widget,
                        parent = gtk_menu_get_attach_widget( GTK_MENU( widget ) );
                }
                else{
-                       parent = widget->parent;
+                       parent = gtk_widget_get_parent(widget);
                }
                if ( !parent ) {
                        parent = (GtkWidget*) g_object_get_data( G_OBJECT( widget ), "GladeParentKey" );
@@ -29,5 +30,5 @@ lookup_widget( GtkWidget       *widget,
        if ( !found_widget ) {
                g_warning( "Widget not found: %s", widget_name );
        }
-       return found_widget;
+       return ui::Widget(found_widget);
 }
index e8f4cb045d5d75ba3d0fc308242c86cd49bae524..8a64631dc9d6fd2ef995c91edec3b63310987f4c 100644 (file)
@@ -7,6 +7,7 @@
 #endif
 
 #include <gtk/gtk.h>
+#include <uilib/uilib.h>
 
 /*
  * Public Functions.
@@ -18,5 +19,5 @@
  * or alternatively any widget in the component, and the name of the widget
  * you want returned.
  */
-GtkWidget*  lookup_widget( GtkWidget       *widget,
+ui::Widget lookup_widget( GtkWidget       *widget,
                                                   const gchar     *widget_name );
index acd2fbd4fbda8cb08936ffc582d27a99669833c5..460f8abfb91fa43383c07ef885e703bebef125c0 100644 (file)
@@ -69,10 +69,10 @@ static gint ci_new( GtkWidget *widget, gpointer data ){
 //     char buf[128];
 
        // create the window
-       window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       window = ui::Window( ui::window_type::TOP );
        gtk_window_set_title( GTK_WINDOW( window ), "New Camera" );
-       gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
        gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) );
 
        g_object_set_data( G_OBJECT( window ), "loop", &loop );
@@ -81,21 +81,21 @@ static gint ci_new( GtkWidget *widget, gpointer data ){
        gtk_widget_realize( window );
 
        // fill the window
-       vbox = gtk_vbox_new( FALSE, 5 );
+       vbox = ui::VBox( FALSE, 5 );
        gtk_container_add( GTK_CONTAINER( window ), vbox );
        gtk_widget_show( vbox );
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       frame = gtk_frame_new( "Type" );
+       frame = ui::Frame( "Type" );
        gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 );
        gtk_widget_show( frame );
 
-       vbox2 = gtk_vbox_new( FALSE, 5 );
+       vbox2 = ui::VBox( FALSE, 5 );
        gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
        gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
        gtk_widget_show( vbox2 );
@@ -105,17 +105,17 @@ static gint ci_new( GtkWidget *widget, gpointer data ){
        fixed = gtk_radio_button_new_with_label( targetTypeRadio, "Fixed" );
        gtk_box_pack_start( GTK_BOX( vbox2 ), fixed, FALSE, FALSE, 3 );
        gtk_widget_show( fixed );
-       targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( fixed ) );
+       targetTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( fixed ) );
 
        interpolated = gtk_radio_button_new_with_label( targetTypeRadio, "Interpolated" );
        gtk_box_pack_start( GTK_BOX( vbox2 ), interpolated, FALSE, FALSE, 3 );
        gtk_widget_show( interpolated );
-       targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( interpolated ) );
+       targetTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( interpolated ) );
 
        spline = gtk_radio_button_new_with_label( targetTypeRadio, "Spline" );
        gtk_box_pack_start( GTK_BOX( vbox2 ), spline, FALSE, FALSE, 3 );
        gtk_widget_show( spline );
-       targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( spline ) );
+       targetTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( spline ) );
 
        // -------------------------- //
 
@@ -125,21 +125,21 @@ static gint ci_new( GtkWidget *widget, gpointer data ){
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_button_new_with_label( "Ok" );
+       w = ui::Button( "Ok" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
        gtk_widget_show( w );
 
-       GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+       gtk_widget_set_can_default( w, true );
        gtk_widget_grab_default( w );
 
-       w = gtk_button_new_with_label( "Cancel" );
+       w = ui::Button( "Cancel" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
        gtk_widget_show( w );
        ret = eIDCANCEL;
 
@@ -314,7 +314,7 @@ static gint ci_pathlist_changed( GtkWidget *widget, gpointer data ){
        }
 
        // start edit mode
-       if ( g_pCameraInspectorWnd && GTK_WIDGET_VISIBLE( g_pCameraInspectorWnd ) ) {
+       if ( g_pCameraInspectorWnd && gtk_widget_get_visible( g_pCameraInspectorWnd ) ) {
                DoStartEdit( GetCurrentCam() );
        }
 
@@ -362,10 +362,10 @@ static gint ci_rename( GtkWidget *widget, gpointer data ){
        }
 
        // create the window
-       window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       window = ui::Window( ui::window_type::TOP );
        gtk_window_set_title( GTK_WINDOW( window ), "Rename Path" );
-       gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
        gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) );
 
        g_object_set_data( G_OBJECT( window ), "loop", &loop );
@@ -374,21 +374,21 @@ static gint ci_rename( GtkWidget *widget, gpointer data ){
        gtk_widget_realize( window );
 
        // fill the window
-       vbox = gtk_vbox_new( FALSE, 5 );
+       vbox = ui::VBox( FALSE, 5 );
        gtk_container_add( GTK_CONTAINER( window ), vbox );
        gtk_widget_show( vbox );
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_label_new( "Name:" );
+       w = ui::Label( "Name:" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
 
-       name = gtk_entry_new();
+       name = ui::Entry();
        gtk_box_pack_start( GTK_BOX( hbox ), name, FALSE, FALSE, 0 );
        gtk_widget_show( name );
 
@@ -407,21 +407,21 @@ static gint ci_rename( GtkWidget *widget, gpointer data ){
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_button_new_with_label( "Ok" );
+       w = ui::Button( "Ok" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
        gtk_widget_show( w );
 
-       GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+       gtk_widget_set_can_default( w, true );
        gtk_widget_grab_default( w );
 
-       w = gtk_button_new_with_label( "Cancel" );
+       w = ui::Button( "Cancel" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
        gtk_widget_show( w );
        ret = eIDCANCEL;
 
@@ -481,10 +481,10 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){
        }
 
        // create the window
-       window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       window = ui::Window( ui::window_type::TOP );
        gtk_window_set_title( GTK_WINDOW( window ), "Add Target" );
-       gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
        gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) );
 
        g_object_set_data( G_OBJECT( window ), "loop", &loop );
@@ -493,21 +493,21 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){
        gtk_widget_realize( window );
 
        // fill the window
-       vbox = gtk_vbox_new( FALSE, 5 );
+       vbox = ui::VBox( FALSE, 5 );
        gtk_container_add( GTK_CONTAINER( window ), vbox );
        gtk_widget_show( vbox );
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_label_new( "Name:" );
+       w = ui::Label( "Name:" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
 
-       name = gtk_entry_new();
+       name = ui::Entry();
        gtk_box_pack_start( GTK_BOX( hbox ), name, TRUE, TRUE, 0 );
        gtk_widget_show( name );
 
@@ -516,15 +516,15 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       frame = gtk_frame_new( "Type" );
+       frame = ui::Frame( "Type" );
        gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 );
        gtk_widget_show( frame );
 
-       vbox2 = gtk_vbox_new( FALSE, 5 );
+       vbox2 = ui::VBox( FALSE, 5 );
        gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
        gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
        gtk_widget_show( vbox2 );
@@ -534,17 +534,17 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){
        fixed = gtk_radio_button_new_with_label( targetTypeRadio, "Fixed" );
        gtk_box_pack_start( GTK_BOX( vbox2 ), fixed, FALSE, FALSE, 3 );
        gtk_widget_show( fixed );
-       targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( fixed ) );
+       targetTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( fixed ) );
 
        interpolated = gtk_radio_button_new_with_label( targetTypeRadio, "Interpolated" );
        gtk_box_pack_start( GTK_BOX( vbox2 ), interpolated, FALSE, FALSE, 3 );
        gtk_widget_show( interpolated );
-       targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( interpolated ) );
+       targetTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( interpolated ) );
 
        spline = gtk_radio_button_new_with_label( targetTypeRadio, "Spline" );
        gtk_box_pack_start( GTK_BOX( vbox2 ), spline, FALSE, FALSE, 3 );
        gtk_widget_show( spline );
-       targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( spline ) );
+       targetTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( spline ) );
 
        // -------------------------- //
 
@@ -554,21 +554,21 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_button_new_with_label( "Ok" );
+       w = ui::Button( "Ok" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
        gtk_widget_show( w );
 
-       GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+       gtk_widget_set_can_default( w, true );
        gtk_widget_grab_default( w );
 
-       w = gtk_button_new_with_label( "Cancel" );
+       w = ui::Button( "Cancel" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
        gtk_widget_show( w );
        ret = eIDCANCEL;
 
@@ -756,7 +756,7 @@ static gint ci_camlist_changed( GtkWidget *widget, gpointer data ){
 
        // start edit mode
        g_iActiveTarget = -1;
-       if ( g_pCameraInspectorWnd && GTK_WIDGET_VISIBLE( g_pCameraInspectorWnd ) ) {
+       if ( g_pCameraInspectorWnd && gtk_widget_get_visible( g_pCameraInspectorWnd ) ) {
                DoStartEdit( GetCurrentCam() );
        }
 
@@ -829,10 +829,10 @@ static gint ci_add( GtkWidget *widget, gpointer data ){
        }
 
        // create the window
-       window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       window = ui::Window( ui::window_type::TOP );
        gtk_window_set_title( GTK_WINDOW( window ), "Add Event" );
-       gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
        gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) );
 
        g_object_set_data( G_OBJECT( window ), "loop", &loop );
@@ -841,21 +841,21 @@ static gint ci_add( GtkWidget *widget, gpointer data ){
        gtk_widget_realize( window );
 
        // fill the window
-       vbox = gtk_vbox_new( FALSE, 5 );
+       vbox = ui::VBox( FALSE, 5 );
        gtk_container_add( GTK_CONTAINER( window ), vbox );
        gtk_widget_show( vbox );
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       frame = gtk_frame_new( "Type" );
+       frame = ui::Frame( "Type" );
        gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 );
        gtk_widget_show( frame );
 
-       vbox2 = gtk_vbox_new( FALSE, 5 );
+       vbox2 = ui::VBox( FALSE, 5 );
        gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
        gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
        gtk_widget_show( vbox2 );
@@ -866,7 +866,7 @@ static gint ci_add( GtkWidget *widget, gpointer data ){
                eventWidget[i] = gtk_radio_button_new_with_label( eventTypeRadio, camEventStr[i] );
                gtk_box_pack_start( GTK_BOX( vbox2 ), eventWidget[i], FALSE, FALSE, 3 );
                gtk_widget_show( eventWidget[i] );
-               eventTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( eventWidget[i] ) );
+               eventTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( eventWidget[i] ) );
                if ( camEventFlags[i][1] == false ) {
                        gtk_widget_set_sensitive( eventWidget[i], FALSE );
                }
@@ -874,15 +874,15 @@ static gint ci_add( GtkWidget *widget, gpointer data ){
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_label_new( "Parameters:" );
+       w = ui::Label( "Parameters:" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
 
-       parameters = gtk_entry_new();
+       parameters = ui::Entry();
        gtk_box_pack_start( GTK_BOX( hbox ), parameters, TRUE, TRUE, 0 );
        gtk_widget_show( parameters );
 
@@ -894,21 +894,21 @@ static gint ci_add( GtkWidget *widget, gpointer data ){
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_button_new_with_label( "Ok" );
+       w = ui::Button( "Ok" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
        gtk_widget_show( w );
 
-       GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+       gtk_widget_set_can_default( w, true );
        gtk_widget_grab_default( w );
 
-       w = gtk_button_new_with_label( "Cancel" );
+       w = ui::Button( "Cancel" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
        gtk_widget_show( w );
        ret = eIDCANCEL;
 
@@ -995,11 +995,11 @@ GtkWidget *CreateCameraInspectorDialog( void ){
        GtkWidget *window, *w, *vbox, *hbox, *table, *frame;
 
        // create the window
-       window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       window = ui::Window( ui::window_type::TOP );
        gtk_window_set_title( GTK_WINDOW( window ), "Camera Inspector" );
-       gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( ci_close ), NULL );
-       gtk_signal_connect( GTK_OBJECT( window ), "expose_event", GTK_SIGNAL_FUNC( ci_expose ), NULL );
-       //  gtk_signal_connect( GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( ci_close ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "expose_event", G_CALLBACK( ci_expose ), NULL );
+       //  g_signal_connect( GTK_OBJECT (window), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
        gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pRadiantWnd ) );
 
        // don't use show, as you don't want to have it displayed on startup ;-)
@@ -1010,7 +1010,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){
        // the table
        // -------------------------- //
 
-       table = gtk_table_new( 3, 2, FALSE );
+       table = ui::Table( 3, 2, FALSE );
        gtk_widget_show( table );
        gtk_container_add( GTK_CONTAINER( window ), table );
        gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
@@ -1020,7 +1020,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){
        // the properties column
        // -------------------------- //
 
-       vbox = gtk_vbox_new( FALSE, 5 );
+       vbox = ui::VBox( FALSE, 5 );
        gtk_widget_show( vbox );
        gtk_table_attach( GTK_TABLE( table ), vbox, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -1028,11 +1028,11 @@ GtkWidget *CreateCameraInspectorDialog( void ){
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_label_new( "File:" );
+       w = ui::Label( "File:" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
 
@@ -1042,52 +1042,52 @@ GtkWidget *CreateCameraInspectorDialog( void ){
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_label_new( "Name:" );
+       w = ui::Label( "Name:" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
 
-       g_pCamName = gtk_entry_new();
+       g_pCamName = ui::Entry();
        gtk_box_pack_start( GTK_BOX( hbox ), g_pCamName, FALSE, FALSE, 0 );
        gtk_widget_show( g_pCamName );
 
-       w = gtk_label_new( "Type: " );
+       w = ui::Label( "Type: " );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
 
-       w = gtk_label_new( "" );
+       w = ui::Label( "" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
        g_pCamType = GTK_LABEL( w );
 
        RefreshCamListCombo();
 
-       gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( g_pCamListCombo )->entry ), FALSE );
-       gtk_signal_connect( GTK_OBJECT( GTK_COMBO( g_pCamListCombo )->entry ), "changed", GTK_SIGNAL_FUNC( ci_camlist_changed ), NULL );
+       gtk_editable_set_editable( GTK_EDITABLE( GTK_COMBO( g_pCamListCombo )->entry ), FALSE );
+       g_signal_connect( GTK_OBJECT( GTK_COMBO( g_pCamListCombo )->entry ), "changed", G_CALLBACK( ci_camlist_changed ), NULL );
 
        // -------------------------- //
 
-       frame = gtk_frame_new( "Path and Target editing" );
+       frame = ui::Frame( "Path and Target editing" );
        gtk_widget_show( frame );
        gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
 
-       vbox = gtk_vbox_new( FALSE, 5 );
+       vbox = ui::VBox( FALSE, 5 );
        gtk_container_add( GTK_CONTAINER( frame ), vbox );
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
        gtk_widget_show( vbox );
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_label_new( "Edit:" );
+       w = ui::Label( "Edit:" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
 
@@ -1097,28 +1097,28 @@ GtkWidget *CreateCameraInspectorDialog( void ){
 
        RefreshPathListCombo();
 
-       gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( g_pPathListCombo )->entry ), FALSE );
-       gtk_signal_connect( GTK_OBJECT( GTK_COMBO( g_pPathListCombo )->entry ), "changed", GTK_SIGNAL_FUNC( ci_pathlist_changed ), NULL );
+       gtk_editable_set_editable( GTK_EDITABLE( GTK_COMBO( g_pPathListCombo )->entry ), FALSE );
+       g_signal_connect( GTK_OBJECT( GTK_COMBO( g_pPathListCombo )->entry ), "changed", G_CALLBACK( ci_pathlist_changed ), NULL );
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
        g_pEditModeEditRadioButton = gtk_radio_button_new_with_label( g_pEditTypeRadio, "Edit Points" );
        gtk_box_pack_start( GTK_BOX( hbox ), g_pEditModeEditRadioButton, FALSE, FALSE, 3 );
        gtk_widget_show( g_pEditModeEditRadioButton );
-       g_pEditTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( g_pEditModeEditRadioButton ) );
+       g_pEditTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( g_pEditModeEditRadioButton ) );
 
-       gtk_signal_connect( GTK_OBJECT( g_pEditModeEditRadioButton ), "clicked", GTK_SIGNAL_FUNC( ci_editmode_edit ), NULL );
+       g_signal_connect( GTK_OBJECT( g_pEditModeEditRadioButton ), "clicked", G_CALLBACK( ci_editmode_edit ), NULL );
 
        g_pEditModeAddRadioButton = gtk_radio_button_new_with_label( g_pEditTypeRadio, "Add Points" );
        gtk_box_pack_start( GTK_BOX( hbox ), g_pEditModeAddRadioButton, FALSE, FALSE, 3 );
        gtk_widget_show( g_pEditModeAddRadioButton );
-       g_pEditTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( g_pEditModeAddRadioButton ) );
+       g_pEditTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( g_pEditModeAddRadioButton ) );
 
-       gtk_signal_connect( GTK_OBJECT( g_pEditModeAddRadioButton ), "clicked", GTK_SIGNAL_FUNC( ci_editmode_add ), NULL );
+       g_signal_connect( GTK_OBJECT( g_pEditModeAddRadioButton ), "clicked", G_CALLBACK( ci_editmode_add ), NULL );
 
        // see if we should use a different default
        if ( g_iEditMode == 1 ) {
@@ -1126,141 +1126,141 @@ GtkWidget *CreateCameraInspectorDialog( void ){
                gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( g_pEditModeAddRadioButton ), TRUE );
        }
 
-       w = gtk_label_new( "Type: " );
+       w = ui::Label( "Type: " );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
 
-       w = gtk_label_new( "" );
+       w = ui::Label( "" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
        g_pPathType = GTK_LABEL( w );
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_button_new_with_label( "Rename..." );
+       w = ui::Button( "Rename..." );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_rename ), NULL );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_rename ), NULL );
        gtk_widget_show( w );
 
-       w = gtk_button_new_with_label( "Add Target..." );
+       w = ui::Button( "Add Target..." );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_add_target ), NULL );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_add_target ), NULL );
        gtk_widget_show( w );
 
        // not available in splines library
        /*w = gtk_button_new_with_label( "Delete Selected" );
           gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, TRUE, 0);
-          gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_delete_selected ), NULL );
+          g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_delete_selected ), NULL );
           gtk_widget_show( w );
 
           w = gtk_button_new_with_label( "Select All" );
           gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, TRUE, 0);
-          gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_select_all ), NULL );
+          g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_select_all ), NULL );
           gtk_widget_show( w );*/
 
        // -------------------------- //
 
-       frame = gtk_frame_new( "Time" );
+       frame = ui::Frame( "Time" );
        gtk_widget_show( frame );
        gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 2, 3,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
 
-       vbox = gtk_vbox_new( FALSE, 5 );
+       vbox = ui::VBox( FALSE, 5 );
        gtk_container_add( GTK_CONTAINER( frame ), vbox );
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
        gtk_widget_show( vbox );
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_label_new( "Length (seconds):" );
+       w = ui::Label( "Length (seconds):" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
 
-       g_pSecondsEntry = gtk_entry_new();
+       g_pSecondsEntry = ui::Entry();
        gtk_box_pack_start( GTK_BOX( hbox ), g_pSecondsEntry, FALSE, FALSE, 0 );
        gtk_widget_show( g_pSecondsEntry );
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_label_new( "Current Time: " );
+       w = ui::Label( "Current Time: " );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
 
-       w = gtk_label_new( "0.00" );
+       w = ui::Label( "0.00" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
        g_pCurrentTime = GTK_LABEL( w );
 
-       w = gtk_label_new( " of " );
+       w = ui::Label( " of " );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
 
-       w = gtk_label_new( "0.00" );
+       w = ui::Label( "0.00" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
        g_pTotalTime = GTK_LABEL( w );
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       g_pTimeLine = GTK_ADJUSTMENT( gtk_adjustment_new( 0, 0, 30000, 100, 250, 0 ) );
-       gtk_signal_connect( GTK_OBJECT( g_pTimeLine ), "value_changed", GTK_SIGNAL_FUNC( ci_timeline_changed ), NULL );
-       w = gtk_hscale_new( g_pTimeLine );
+       g_pTimeLine = ui::Adjustment( 0, 0, 30000, 100, 250, 0 );
+       g_signal_connect( GTK_OBJECT( g_pTimeLine ), "value_changed", G_CALLBACK( ci_timeline_changed ), NULL );
+       w = ui::HScale( g_pTimeLine );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
        gtk_widget_show( w );
        gtk_scale_set_draw_value( GTK_SCALE( w ), FALSE );
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       g_pTrackCamera = gtk_check_button_new_with_label( "Track Camera" );
+       g_pTrackCamera = ui::CheckButton( "Track Camera" );
        gtk_box_pack_start( GTK_BOX( hbox ), g_pTrackCamera, FALSE, FALSE, 0 );
        gtk_widget_show( g_pTrackCamera );
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_label_new( "Events:" );
+       w = ui::Label( "Events:" );
        gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
        gtk_widget_show( w );
 
        // -------------------------- //
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
        gtk_widget_show( hbox );
 
-       w = gtk_scrolled_window_new( NULL, NULL );
-       gtk_widget_set_usize( w, 0, 150 );
+       w = ui::ScrolledWindow();
+       gtk_widget_set_size_request( w, 0, 150 );
        gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( w ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
        gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
        gtk_widget_show( w );
 
        g_pEventsList = gtk_clist_new( 3 );
        gtk_container_add( GTK_CONTAINER( w ), g_pEventsList );
-       //gtk_signal_connect( GTK_OBJECT(g_pEventsList), "select_row", GTK_SIGNAL_FUNC (proplist_select_row), NULL);
+       //g_signal_connect( GTK_OBJECT(g_pEventsList), "select_row", G_CALLBACK (proplist_select_row), NULL);
        gtk_clist_set_selection_mode( GTK_CLIST( g_pEventsList ), GTK_SELECTION_BROWSE );
        gtk_clist_column_titles_hide( GTK_CLIST( g_pEventsList ) );
        gtk_clist_set_column_auto_resize( GTK_CLIST( g_pEventsList ), 0, TRUE );
@@ -1268,18 +1268,18 @@ GtkWidget *CreateCameraInspectorDialog( void ){
        gtk_clist_set_column_auto_resize( GTK_CLIST( g_pEventsList ), 2, TRUE );
        gtk_widget_show( g_pEventsList );
 
-       vbox = gtk_vbox_new( FALSE, 5 );
+       vbox = ui::VBox( FALSE, 5 );
        gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, FALSE, 0 );
        gtk_widget_show( vbox );
 
-       w = gtk_button_new_with_label( "Add..." );
+       w = ui::Button( "Add..." );
        gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_add ), NULL );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_add ), NULL );
        gtk_widget_show( w );
 
-       w = gtk_button_new_with_label( "Del" );
+       w = ui::Button( "Del" );
        gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_del ), NULL );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_del ), NULL );
        gtk_widget_show( w );
 
        // -------------------------- //
@@ -1301,12 +1301,12 @@ GtkWidget *CreateCameraInspectorDialog( void ){
 
        w = gtk_button_new_with_label( "New..." );
        gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_new ), NULL );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_new ), NULL );
        gtk_widget_show( w );
 
        w = gtk_button_new_with_label( "Load..." );
        gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_load ), NULL );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_load ), NULL );
        gtk_widget_show( w );
 
        // -------------------------- //
@@ -1319,12 +1319,12 @@ GtkWidget *CreateCameraInspectorDialog( void ){
 
        w = gtk_button_new_with_label( "Save..." );
        gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_save ), NULL );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_save ), NULL );
        gtk_widget_show( w );
 
        w = gtk_button_new_with_label( "Unload" );
        gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_unload ), NULL );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_unload ), NULL );
        gtk_widget_show( w );
 
        hbox = gtk_hbox_new( FALSE, 5 );
@@ -1333,12 +1333,12 @@ GtkWidget *CreateCameraInspectorDialog( void ){
 
        w = gtk_button_new_with_label( "Apply" );
        gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_apply ), NULL );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_apply ), NULL );
        gtk_widget_show( w );
 
        w = gtk_button_new_with_label( "Preview" );
        gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_preview ), NULL );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_preview ), NULL );
        gtk_widget_show( w );
 
        // -------------------------- //
@@ -1355,8 +1355,8 @@ GtkWidget *CreateCameraInspectorDialog( void ){
 
        w = gtk_button_new_with_label( "Close" );
        gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
-       gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_close ), NULL );
-       GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+       g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_close ), NULL );
+       gtk_widget_set_can_default( w, true );
        gtk_widget_grab_default( w );
        gtk_widget_show( w );
 
index bfaf98490eb3f7fe3649502775c07f4d52775bb3..d0639f0a37bb5616d3d56c0b78829616e20a1c01 100644 (file)
@@ -1346,7 +1346,7 @@ void create_tooltips(){
 GtkWidget* create_main_dialog(){
        GtkWidget *dlg, *vbox, *hbox, *hbox2, *button, *notebook, *frame, *table, *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,13 +1355,13 @@ 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 );
+       g_pWnd = dlg = 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);
        gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pRadiantWnd ) );
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_widget_show( hbox );
        gtk_container_add( GTK_CONTAINER( dlg ), hbox );
        gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 );
@@ -1374,23 +1374,23 @@ GtkWidget* create_main_dialog(){
        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 );
+       table = ui::Table( 2, 2, FALSE );
        gtk_widget_show( table );
        gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
        gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
 
-       label = gtk_label_new( "General" );
+       label = ui::Label( "General" );
        gtk_widget_show( label );
        gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), table, label );
 
-       frame = gtk_frame_new( "Game" );
+       frame = ui::Frame( "Game" );
        gtk_widget_show( frame );
        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 );
+       vbox = ui::VBox( TRUE, 5 );
        gtk_widget_show( vbox );
        gtk_container_add( GTK_CONTAINER( frame ), vbox );
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
@@ -1400,18 +1400,18 @@ GtkWidget* create_main_dialog(){
                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 ) );
+               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 ) );
        }
 
-       frame = gtk_frame_new( "Waveform" );
+       frame = ui::Frame( "Waveform" );
        gtk_widget_show( frame );
        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 );
+       vbox = ui::VBox( TRUE, 5 );
        gtk_widget_show( vbox );
        gtk_container_add( GTK_CONTAINER( frame ), vbox );
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
@@ -1421,18 +1421,18 @@ GtkWidget* create_main_dialog(){
                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 ) );
+               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 ) );
        }
 
-       frame = gtk_frame_new( "Orientation" );
+       frame = ui::Frame( "Orientation" );
        gtk_widget_show( frame );
        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 );
+       vbox = ui::VBox( TRUE, 5 );
        gtk_widget_show( vbox );
        gtk_container_add( GTK_CONTAINER( frame ), vbox );
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
@@ -1442,12 +1442,12 @@ GtkWidget* create_main_dialog(){
                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 ) );
+               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 ) );
        }
 
-       table2 = gtk_table_new( 4, 2, FALSE );
+       table2 = ui::Table( 4, 2, FALSE );
        gtk_widget_show( table2 );
        gtk_table_set_row_spacings( GTK_TABLE( table2 ), 5 );
        gtk_table_set_col_spacings( GTK_TABLE( table2 ), 5 );
@@ -1455,7 +1455,7 @@ GtkWidget* create_main_dialog(){
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
 
-       label = gtk_label_new( "Wavelength:" );
+       label = ui::Label( "Wavelength:" );
        gtk_widget_show( label );
        gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -1463,7 +1463,7 @@ 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( "Max. amplitude:" );
+       label = ui::Label( "Max. amplitude:" );
        gtk_widget_show( label );
        gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -1471,7 +1471,7 @@ 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( "Roughness:" );
+       label = ui::Label( "Roughness:" );
        gtk_widget_show( label );
        gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 2, 3,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -1479,7 +1479,7 @@ 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( "Random seed:" );
+       label = ui::Label( "Random seed:" );
        gtk_widget_show( label );
        gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 3, 4,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -1487,298 +1487,298 @@ GtkWidget* create_main_dialog(){
        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
        gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT );
 
-       entry = gtk_entry_new();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        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 = gtk_entry_new();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        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 = gtk_entry_new();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        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 );
 
-       adj = gtk_adjustment_new( 1, 1, 32767, 1, 10, 0 );
+       adj = ui::Adjustment( 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 );
+       spin = ui::SpinButton( adj, 1, 0 );
        gtk_widget_show( spin );
        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 );
+       vbox = ui::VBox( FALSE, 5 );
        gtk_widget_show( vbox );
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
 
-       label = gtk_label_new( "Extents" );
+       label = ui::Label( "Extents" );
        gtk_widget_show( label );
        gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), vbox, label );
 
-       hbox2 = gtk_hbox_new( FALSE, 5 );
+       hbox2 = ui::HBox( FALSE, 5 );
        gtk_widget_show( hbox2 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 0 );
 
-       frame = gtk_frame_new( "Extents" );
+       frame = ui::Frame( "Extents" );
        gtk_widget_show( frame );
        gtk_box_pack_start( GTK_BOX( hbox2 ), frame, TRUE, TRUE, 0 );
 
-       table = gtk_table_new( 3, 4, FALSE );
+       table = ui::Table( 3, 4, FALSE );
        gtk_widget_show( table );
        gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
        gtk_container_add( GTK_CONTAINER( frame ), table );
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
        gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
 
-       label = gtk_label_new( "X:" );
+       label = ui::Label( "X:" );
        gtk_widget_show( label );
        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:" );
+       label = ui::Label( "X:" );
        gtk_widget_show( label );
        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:" );
+       label = ui::Label( "Y:" );
        gtk_widget_show( label );
        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:" );
+       label = ui::Label( "Y:" );
        gtk_widget_show( label );
        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" );
+       label = ui::Label( "Lower-left" );
        gtk_widget_show( label );
        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" );
+       label = ui::Label( "Upper-right" );
        gtk_widget_show( label );
        gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
 
-       entry = gtk_entry_new();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        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 = gtk_entry_new();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        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 = gtk_entry_new();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        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 = gtk_entry_new();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        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 );
 
-       frame = gtk_frame_new( "Divisions" );
+       frame = ui::Frame( "Divisions" );
        gtk_widget_show( frame );
        gtk_box_pack_start( GTK_BOX( hbox2 ), frame, TRUE, TRUE, 0 );
 
-       table = gtk_table_new( 2, 2, FALSE );
+       table = ui::Table( 2, 2, FALSE );
        gtk_widget_show( table );
        gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
        gtk_container_add( GTK_CONTAINER( frame ), table );
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
        gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
 
-       label = gtk_label_new( "X:" );
+       label = ui::Label( "X:" );
        gtk_widget_show( label );
        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:" );
+       label = ui::Label( "Y:" );
        gtk_widget_show( label );
        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 );
+       adj = ui::Adjustment( 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 );
+       spin = ui::SpinButton( adj, 1, 0 );
        gtk_widget_show( spin );
        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 );
+       adj = ui::Adjustment( 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 );
+       spin = ui::SpinButton( adj, 1, 0 );
        gtk_widget_show( spin );
        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" );
+       check = ui::CheckButton( "Use Bezier patches" );
        gtk_widget_show( check );
        gtk_box_pack_start( GTK_BOX( vbox ), 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 );
 
        // ^Fishman - Snap to grid, replaced scroll bar with a texbox.
-       label = gtk_label_new( "Snap to grid:" );
+       label = ui::Label( "Snap to grid:" );
        gtk_widget_show( label );
        gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 );
        gtk_object_set_data( GTK_OBJECT( dlg ), "snap_text", label );
 
-       adj = gtk_adjustment_new( 8, 0, 256, 1, 10, 0 );
+       adj = ui::Adjustment( 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 );
+       spin = ui::SpinButton( 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 );
+       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 );
+       hbox2 = ui::HBox( FALSE, 5 );
        gtk_widget_show( hbox2 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 10 );
 
-       label = gtk_label_new( "Decimate:" );
+       label = ui::Label( "Decimate:" );
        gtk_widget_show( label );
        gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 );
 
-       adj = gtk_adjustment_new( 0, 0, 110, 1, 10, 0 );
+       adj = ui::Adjustment( 0, 0, 110, 1, 10, 0 );
        g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( extents_decimate ), NULL );
        g_object_set_data( G_OBJECT( dlg ), "decimate_adj", adj );
-       scale = gtk_hscale_new( GTK_ADJUSTMENT( adj ) );
+       scale = ui::HScale( adj );
        gtk_widget_show( scale );
        gtk_box_pack_start( GTK_BOX( hbox2 ), 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" );
+       frame = ui::Frame( "Corner values" );
        gtk_widget_show( frame );
        gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
 
-       table = gtk_table_new( 3, 4, FALSE );
+       table = ui::Table( 3, 4, FALSE );
        gtk_widget_show( table );
        gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
        gtk_container_add( GTK_CONTAINER( frame ), 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:" );
+       label = ui::Label( "Upper-left:" );
        gtk_widget_show( label );
        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:" );
+       label = ui::Label( "Lower-left:" );
        gtk_widget_show( label );
        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:" );
+       label = ui::Label( "Upper-right:" );
        gtk_widget_show( label );
        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:" );
+       label = ui::Label( "Lower-right:" );
        gtk_widget_show( label );
        gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
 
-       entry = gtk_entry_new();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        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 = gtk_entry_new();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        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 = gtk_entry_new();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        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 = gtk_entry_new();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        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 );
 
-       check = gtk_check_button_new_with_label( "Linear borders" );
+       check = ui::CheckButton( "Linear borders" );
        gtk_widget_show( check );
        gtk_table_attach( GTK_TABLE( table ), check, 0, 4, 2, 3,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -1786,34 +1786,34 @@ GtkWidget* create_main_dialog(){
        g_object_set_data( G_OBJECT( dlg ), "linearborder", check );
        g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( extents_linearborder ), NULL );
 
-       vbox = gtk_vbox_new( FALSE, 10 );
+       vbox = ui::VBox( FALSE, 10 );
        gtk_widget_show( vbox );
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
 
-       label = gtk_label_new( "Bitmap" );
+       label = ui::Label( "Bitmap" );
        gtk_widget_show( label );
        gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), vbox, label );
 
-       label = gtk_label_new( "" );
+       label = ui::Label( "" );
        gtk_widget_show( label );
        gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 );
        g_object_set_data( G_OBJECT( dlg ), "bmp_note", label );
 
-       table = gtk_table_new( 2, 2, FALSE );
+       table = ui::Table( 2, 2, FALSE );
        gtk_widget_show( table );
        gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), 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:" );
+       label = ui::Label( "Filename:" );
        gtk_widget_show( label );
        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();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -1821,34 +1821,34 @@ GtkWidget* create_main_dialog(){
        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 );
 
-       hbox2 = gtk_hbox_new( TRUE, 5 );
+       hbox2 = ui::HBox( TRUE, 5 );
        gtk_widget_show( hbox2 );
        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..." );
+       button = ui::Button( "Browse..." );
        gtk_widget_show( button );
        gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 );
-       gtk_widget_set_usize( button, 60, -2 );
+       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 = gtk_button_new_with_label( "Reload" );
+       button = ui::Button( "Reload" );
        gtk_widget_show( button );
        gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 );
-       gtk_widget_set_usize( button, 60, -2 );
+       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 );
 
-       table = gtk_table_new( 2, 2, TRUE );
+       table = ui::Table( 2, 2, TRUE );
        gtk_widget_show( table );
        gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), 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:" );
+       label = ui::Label( "Map color 0 to:" );
        gtk_widget_show( label );
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
@@ -1857,7 +1857,7 @@ 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:" );
+       label = ui::Label( "Map color 255 to:" );
        gtk_widget_show( label );
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
@@ -1866,41 +1866,41 @@ 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 );
+       hbox2 = ui::HBox( FALSE, 5 );
        gtk_widget_show( hbox2 );
        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();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        gtk_box_pack_start( GTK_BOX( hbox2 ), entry, FALSE, FALSE, 0 );
-       gtk_widget_set_usize( entry, 50, -2 );
+       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 );
 
-       hbox2 = gtk_hbox_new( FALSE, 5 );
+       hbox2 = ui::HBox( FALSE, 5 );
        gtk_widget_show( hbox2 );
        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();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        gtk_box_pack_start( GTK_BOX( hbox2 ), entry, FALSE, FALSE, 0 );
-       gtk_widget_set_usize( entry, 50, -2 );
+       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 );
 
-       vbox = gtk_vbox_new( FALSE, 10 );
+       vbox = ui::VBox( FALSE, 10 );
        gtk_widget_show( vbox );
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
 
-       label = gtk_label_new( "Fix Points" );
+       label = ui::Label( "Fix Points" );
        gtk_widget_show( label );
        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"
@@ -1909,14 +1909,14 @@ GtkWidget* create_main_dialog(){
        gtk_widget_show( label );
        gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 );
 
-       table = gtk_table_new( 3, 3, FALSE );
+       table = ui::Table( 3, 3, FALSE );
        gtk_widget_show( table );
        gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
        gtk_box_pack_start( GTK_BOX( vbox ), 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:" );
+       label = ui::Label( "Value:" );
        gtk_widget_show( label );
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -1924,7 +1924,7 @@ GtkWidget* create_main_dialog(){
        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:" );
+       label = ui::Label( "Range affected:" );
        gtk_widget_show( label );
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -1932,7 +1932,7 @@ GtkWidget* create_main_dialog(){
        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:" );
+       label = ui::Label( "Rate of change:" );
        gtk_widget_show( label );
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -1940,246 +1940,246 @@ GtkWidget* create_main_dialog(){
        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 );
+       adj = ui::Adjustment( 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 );
+       spin = ui::SpinButton( adj, 1, 0 );
        gtk_widget_show( spin );
        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 );
 
-       entry = gtk_entry_new();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        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 = gtk_entry_new();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        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 );
 
-       button = gtk_button_new_with_label( "Free" );
+       button = ui::Button( "Free" );
        gtk_widget_show( button );
        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 = gtk_button_new_with_label( "Free All" );
+       button = ui::Button( "Free All" );
        gtk_widget_show( button );
        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 );
 
-       vbox = gtk_vbox_new( FALSE, 10 );
+       vbox = ui::VBox( FALSE, 10 );
        gtk_widget_show( vbox );
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
 
-       label = gtk_label_new( "Texture" );
+       label = ui::Label( "Texture" );
        gtk_widget_show( label );
        gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), vbox, label );
 
        // ^Fishman - Modified to add more labels and textboxes.
-       table = gtk_table_new( 5, 2, FALSE );
+       table = ui::Table( 5, 2, FALSE );
        gtk_widget_show( table );
        gtk_box_pack_start( GTK_BOX( vbox ), 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:" );
+       label = ui::Label( "Surface:" );
        gtk_widget_show( label );
        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:" );
+       label = ui::Label( "Other:" );
        gtk_widget_show( label );
        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:" );
+       label = ui::Label( "Steep:" );
        gtk_widget_show( label );
        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();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        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 = gtk_entry_new();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        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 = gtk_entry_new();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        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 );
+       hbox2 = ui::HBox( FALSE, 5 );
        gtk_widget_show( hbox2 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 0 );
 
-       label = gtk_label_new( "\"Steep\" angle:" );
+       label = ui::Label( "\"Steep\" angle:" );
        gtk_widget_show( label );
        gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 );
 
-       adj = gtk_adjustment_new( 60, 0, 90, 1, 10, 0 );
-       spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
+       adj = ui::Adjustment( 60, 0, 90, 1, 10, 0 );
+       spin = ui::SpinButton( adj, 1, 0 );
        gtk_widget_show( spin );
        gtk_box_pack_start( GTK_BOX( hbox2 ), spin, FALSE, TRUE, 0 );
        g_object_set_data( G_OBJECT( dlg ), "tex_slant", spin );
 
-       table = gtk_table_new( 2, 4, TRUE );
+       table = ui::Table( 2, 4, TRUE );
        gtk_widget_show( table );
        gtk_box_pack_start( GTK_BOX( vbox ), 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>" );
+       label = ui::Label( "Offset <h,v>" );
        gtk_widget_show( label );
        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>" );
+       label = ui::Label( "Scale <h,v>" );
        gtk_widget_show( label );
        gtk_table_attach( GTK_TABLE( table ), label, 2, 4, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
 
-       entry = gtk_entry_new();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        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();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        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();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        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();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        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" );
+       check = ui::CheckButton( "Use detail brushes" );
        gtk_widget_show( check );
        gtk_box_pack_start( GTK_BOX( vbox ), 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 = gtk_check_button_new_with_label( "Detail hint brushes" );
+       check = ui::CheckButton( "Detail hint brushes" );
        gtk_widget_show( check );
        gtk_box_pack_start( GTK_BOX( vbox ), 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 );
 
        // ^Fishman - Add terrain key to func_group.
-       check = gtk_check_button_new_with_label( "Add terrain key" );
+       check = ui::CheckButton( "Add terrain key" );
        gtk_widget_show( check );
        gtk_box_pack_start( GTK_BOX( vbox ), 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 );
 
-       vbox = gtk_vbox_new( FALSE, 5 );
+       vbox = ui::VBox( FALSE, 5 );
        gtk_widget_show( vbox );
        gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, TRUE, 0 );
 
-       button = gtk_button_new_with_label( "OK" );
+       button = ui::Button( "OK" );
        gtk_widget_show( button );
        gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 );
-       gtk_widget_set_usize( button, 60, -2 );
+       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 );
 
-       label = gtk_label_new( "Settings:" );
+       label = ui::Label( "Settings:" );
        gtk_widget_show( label );
        gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 );
 
-       button = gtk_button_new_with_label( "Open..." );
+       button = ui::Button( "Open..." );
        gtk_widget_show( button );
        gtk_box_pack_start( GTK_BOX( vbox ), 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 = gtk_button_new_with_label( "Save as..." );
+       button = ui::Button( "Save as..." );
        gtk_widget_show( button );
        gtk_box_pack_start( GTK_BOX( vbox ), 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 = gtk_button_new_with_label( "Defaults" );
+       button = ui::Button( "Defaults" );
        gtk_widget_show( button );
        gtk_box_pack_start( GTK_BOX( vbox ), 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 = gtk_button_new_with_label( "About..." );
+       button = ui::Button( "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 );
 
-       check = gtk_check_button_new_with_label( "Preview" );
+       check = ui::CheckButton( "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 );
        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" );
+       check = ui::CheckButton( "Antialised lines" );
        gtk_widget_show( check );
        gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 );
        g_object_set_data( G_OBJECT( dlg ), "main_antialiasing", check );
index b28416e29bb485fceda4f2177c90dfc1dd2370b7..cecc8ab298ab53565658f8017b3d91fffa2f1329 100644 (file)
@@ -409,7 +409,7 @@ void WriteIniFile( const char *file ){
 }
 
 void UpdatePreview( bool DataChange ){
-       if ( g_pWndPreview && GTK_WIDGET_VISIBLE( g_pWndPreview ) ) {
+       if ( g_pWndPreview && gtk_widget_get_visible( g_pWndPreview ) ) {
                if ( DataChange ) {
                        GenerateXYZ();
                }
index ba0c43d5251c1ce7bf32a310582afc4b39e5d608..00c74aaac601b2d51c8c5ac8b2b1617d9b467f4a 100644 (file)
@@ -371,50 +371,50 @@ void CreateViewWindow(){
        azimuth   = PI / 6.;
 #endif
 
-       g_pWndPreview = dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       g_pWndPreview = dlg = ui::Window( ui::window_type::TOP );
        gtk_window_set_title( GTK_WINDOW( dlg ), "GtkGenSurf Preview" );
-       gtk_signal_connect( GTK_OBJECT( dlg ), "delete_event", GTK_SIGNAL_FUNC( preview_close ), NULL );
-       gtk_signal_connect( GTK_OBJECT( dlg ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       g_signal_connect( GTK_OBJECT( dlg ), "delete_event", G_CALLBACK( preview_close ), NULL );
+       g_signal_connect( GTK_OBJECT( dlg ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
        gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pWnd ) );
        gtk_window_set_default_size( GTK_WINDOW( dlg ), 300, 400 );
 
-       vbox = gtk_vbox_new( FALSE, 5 );
+       vbox = ui::VBox( FALSE, 5 );
        gtk_widget_show( vbox );
        gtk_container_add( GTK_CONTAINER( dlg ), vbox );
 
 #ifndef ISOMETRIC
-       hbox = gtk_hbox_new( TRUE, 5 );
+       hbox = ui::HBox( TRUE, 5 );
        gtk_widget_show( hbox );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, TRUE, 0 );
        gtk_container_set_border_width( GTK_CONTAINER( hbox ), 3 );
 
-       label = gtk_label_new( "Elevation" );
+       label = ui::Label( "Elevation" );
        gtk_widget_show( label );
        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
        gtk_box_pack_start( GTK_BOX( hbox ), label, FALSE, TRUE, 0 );
 
-       adj = gtk_adjustment_new( 30, -90, 90, 1, 10, 0 );
-       gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( preview_spin ), &elevation );
-       spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
+       adj = ui::Adjustment( 30, -90, 90, 1, 10, 0 );
+       g_signal_connect( adj, "value_changed", G_CALLBACK( preview_spin ), &elevation );
+       spin = ui::SpinButton( adj, 1, 0 );
        gtk_widget_show( spin );
        gtk_box_pack_start( GTK_BOX( hbox ), spin, FALSE, TRUE, 0 );
        g_signal_connect( G_OBJECT( spin ), "focus_out_event", G_CALLBACK( doublevariable_spinfocusout ), &elevation );
 
-       adj = gtk_adjustment_new( 30, 0, 359, 1, 10, 0 );
-       gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( preview_spin ), &azimuth );
-       spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
+       adj = ui::Adjustment( 30, 0, 359, 1, 10, 0 );
+       g_signal_connect( adj, "value_changed", G_CALLBACK( preview_spin ), &azimuth );
+       spin = ui::SpinButton( adj, 1, 0 );
        gtk_widget_show( spin );
        gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE );
        gtk_box_pack_end( GTK_BOX( hbox ), spin, FALSE, TRUE, 0 );
 
-       label = gtk_label_new( "Azimuth" );
+       label = ui::Label( "Azimuth" );
        gtk_widget_show( label );
        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
        gtk_box_pack_end( GTK_BOX( hbox ), label, FALSE, TRUE, 0 );
        g_signal_connect( G_OBJECT( spin ), "focus_out_event", G_CALLBACK( doublevariable_spinfocusout ), &azimuth );
 #endif
 
-       frame = gtk_frame_new( NULL );
+       frame = ui::Frame( nullptr );
        gtk_widget_show( frame );
        gtk_frame_set_shadow_type( GTK_FRAME( frame ), GTK_SHADOW_IN );
        gtk_box_pack_start( GTK_BOX( vbox ), frame, TRUE, TRUE, 0 );
@@ -422,10 +422,10 @@ void CreateViewWindow(){
        g_pPreviewWidget = g_UIGtkTable.m_pfn_glwidget_new( FALSE, NULL );
 
        gtk_widget_set_events( g_pPreviewWidget, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK );
-       gtk_signal_connect( GTK_OBJECT( g_pPreviewWidget ), "expose_event", GTK_SIGNAL_FUNC( expose ), NULL );
-       gtk_signal_connect( GTK_OBJECT( g_pPreviewWidget ), "motion_notify_event", GTK_SIGNAL_FUNC( motion ), NULL );
-       gtk_signal_connect( GTK_OBJECT( g_pPreviewWidget ), "button_press_event",
-                                               GTK_SIGNAL_FUNC( button_press ), NULL );
+       g_signal_connect( GTK_OBJECT( g_pPreviewWidget ), "expose_event", G_CALLBACK( expose ), NULL );
+       g_signal_connect( GTK_OBJECT( g_pPreviewWidget ), "motion_notify_event", G_CALLBACK( motion ), NULL );
+       g_signal_connect( GTK_OBJECT( g_pPreviewWidget ), "button_press_event",
+                                               G_CALLBACK( button_press ), NULL );
 
        gtk_widget_show( g_pPreviewWidget );
        gtk_container_add( GTK_CONTAINER( frame ), g_pPreviewWidget );
index 44393ea14f3fa0bd2d3199c0dbaccf821450f766..f2e3d89b7d434abf83bdfe260a28ac57dacbbfd2 100644 (file)
@@ -84,22 +84,22 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){
        GtkWidget *window, *w, *vbox, *hbox;
        int mode = ( uType & MB_TYPEMASK ), ret, loop = 1;
 
-       window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
-       gtk_signal_connect( GTK_OBJECT( window ), "delete_event",
-                                               GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( window ), "destroy",
-                                               GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       window = ui::Window( ui::window_type::TOP );
+       g_signal_connect( GTK_OBJECT( window ), "delete_event",
+                                               G_CALLBACK( dialog_delete_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "destroy",
+                                               G_CALLBACK( gtk_widget_destroy ), NULL );
        gtk_window_set_title( GTK_WINDOW( window ), lpCaption );
-       gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+       gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
        gtk_object_set_data( GTK_OBJECT( window ), "loop", &loop );
        gtk_object_set_data( GTK_OBJECT( window ), "ret", &ret );
        gtk_widget_realize( window );
 
-       vbox = gtk_vbox_new( FALSE, 10 );
+       vbox = ui::VBox( FALSE, 10 );
        gtk_container_add( GTK_CONTAINER( window ), vbox );
        gtk_widget_show( vbox );
 
-       w = gtk_label_new( lpText );
+       w = ui::Label( lpText );
        gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
        gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
        gtk_widget_show( w );
@@ -108,72 +108,72 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){
        gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
        gtk_widget_show( w );
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
        gtk_widget_show( hbox );
 
        if ( mode == MB_OK ) {
-               w = gtk_button_new_with_label( "Ok" );
+               w = ui::Button( "Ok" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
-               GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
+               gtk_widget_set_can_default( w, true );
                gtk_widget_grab_default( w );
                gtk_widget_show( w );
                ret = IDOK;
        }
        else if ( mode ==  MB_OKCANCEL ) {
-               w = gtk_button_new_with_label( "Ok" );
+               w = ui::Button( "Ok" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
-               GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
+               gtk_widget_set_can_default( w, true );
                gtk_widget_grab_default( w );
                gtk_widget_show( w );
 
-               w = gtk_button_new_with_label( "Cancel" );
+               w = ui::Button( "Cancel" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
                gtk_widget_show( w );
                ret = IDCANCEL;
        }
        else if ( mode == MB_YESNOCANCEL ) {
-               w = gtk_button_new_with_label( "Yes" );
+               w = ui::Button( "Yes" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDYES ) );
-               GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) );
+               gtk_widget_set_can_default( w, true );
                gtk_widget_grab_default( w );
                gtk_widget_show( w );
 
-               w = gtk_button_new_with_label( "No" );
+               w = ui::Button( "No" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDNO ) );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) );
                gtk_widget_show( w );
 
-               w = gtk_button_new_with_label( "Cancel" );
+               w = ui::Button( "Cancel" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
                gtk_widget_show( w );
                ret = IDCANCEL;
        }
        else /* if (mode == MB_YESNO) */
        {
-               w = gtk_button_new_with_label( "Yes" );
+               w = ui::Button( "Yes" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDYES ) );
-               GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) );
+               gtk_widget_set_can_default( w, true );
                gtk_widget_grab_default( w );
                gtk_widget_show( w );
 
-               w = gtk_button_new_with_label( "No" );
+               w = ui::Button( "No" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDNO ) );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) );
                gtk_widget_show( w );
                ret = IDNO;
        }
index 1baec68defd0b56e6c23fc38a293052c29591263..c90c319fc9391f63a9fa9a3266bfd937bc508a16 100644 (file)
@@ -20,6 +20,7 @@
 #include "AboutDialog.h"
 #include <gtk/gtk.h>
 #include <gtkutil/pointer.h>
+#include <uilib/uilib.h>
 #include "version.h"
 #include "gtkutil/pointer.h"
 
@@ -52,40 +53,39 @@ void DoAboutDlg(){
        GtkWidget *dlg, *hbox, *vbox, *button, *label;
        int loop = 1, ret = IDCANCEL;
 
-       dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       dlg = ui::Window( ui::window_type::TOP );
        gtk_window_set_title( GTK_WINDOW( dlg ), "About Portal Viewer" );
-       gtk_signal_connect( GTK_OBJECT( dlg ), "delete_event",
-                                               GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( dlg ), "destroy",
-                                               GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       g_signal_connect( GTK_OBJECT( dlg ), "delete_event",
+                                         G_CALLBACK( dialog_delete_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( dlg ), "destroy",
+                                               G_CALLBACK( gtk_widget_destroy ), NULL );
        g_object_set_data( G_OBJECT( dlg ), "loop", &loop );
        g_object_set_data( G_OBJECT( dlg ), "ret", &ret );
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_widget_show( hbox );
        gtk_container_add( GTK_CONTAINER( dlg ), hbox );
        gtk_container_set_border_width( GTK_CONTAINER( hbox ), 10 );
 
-       label = gtk_label_new( "Version 1.000\n\n"
+       char const *label_text = "Version 1.000\n\n"
                                                   "Gtk port by Leonardo Zide\nleo@lokigames.com\n\n"
                                                   "Written by Geoffrey DeWan\ngdewan@prairienet.org\n\n"
                                                   "Built against NetRadiant " RADIANT_VERSION "\n"
-                                                  __DATE__
-                                                  );
+                                                  __DATE__;
        gtk_widget_show( label );
        gtk_box_pack_start( GTK_BOX( hbox ), label, TRUE, TRUE, 0 );
        gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
 
-       vbox = gtk_vbox_new( FALSE, 0 );
+       vbox = ui::VBox( FALSE, 0 );
        gtk_widget_show( vbox );
        gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, FALSE, 0 );
 
-       button = gtk_button_new_with_label( "OK" );
+       button = ui::Button( "OK" );
        gtk_widget_show( button );
        gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
-       gtk_signal_connect( GTK_OBJECT( button ), "clicked",
-                                               GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
-       gtk_widget_set_usize( button, 60, -2 );
+       g_signal_connect( GTK_OBJECT( button ), "clicked",
+                                               G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
+       gtk_widget_set_size_request( button, 60, -1 );
 
        gtk_grab_add( dlg );
        gtk_widget_show( dlg );
index a91a6a2b8e4b618ccdebc5f267e33c6ffe09a98e..acb9f5b588c2e8f9321a27b6a0d890d6d1ffb89b 100644 (file)
@@ -20,6 +20,7 @@
 #include "ConfigDialog.h"
 #include <stdio.h>
 #include <gtk/gtk.h>
+#include <uilib/uilib.h>
 #include "gtkutil/pointer.h"
 
 #include "iscenegraph.h"
@@ -54,23 +55,27 @@ static gint dialog_delete_callback( GtkWidget *widget, GdkEvent* event, gpointer
 
 static int DoColor( PackedColour *c ){
        GtkWidget* dlg;
-       double clr[4];
+       GdkColor clr;
        int loop = 1, ret = IDCANCEL;
 
-       clr[0] = ( (double)GetRValue( *c ) ) / 255.0;
-       clr[1] = ( (double)GetGValue( *c ) ) / 255.0;
-       clr[2] = ( (double)GetBValue( *c ) ) / 255.0;
+       clr.red = (guint16) (GetRValue(*c) * (65535 / 255));
+       clr.blue = (guint16) (GetGValue(*c) * (65535 / 255));
+       clr.green = (guint16) (GetBValue(*c) * (65535 / 255));
 
        dlg = gtk_color_selection_dialog_new( "Choose Color" );
-       gtk_color_selection_set_color( GTK_COLOR_SELECTION( GTK_COLOR_SELECTION_DIALOG( dlg )->colorsel ), clr );
-       gtk_signal_connect( GTK_OBJECT( dlg ), "delete_event",
-                                               GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( dlg ), "destroy",
-                                               GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
-       gtk_signal_connect( GTK_OBJECT( GTK_COLOR_SELECTION_DIALOG( dlg )->ok_button ), "clicked",
-                                               GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
-       gtk_signal_connect( GTK_OBJECT( GTK_COLOR_SELECTION_DIALOG( dlg )->cancel_button ), "clicked",
-                                               GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
+       gtk_color_selection_set_current_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(dlg)) ), &clr );
+       g_signal_connect( GTK_OBJECT( dlg ), "delete_event",
+                                               G_CALLBACK( dialog_delete_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( dlg ), "destroy",
+                                               G_CALLBACK( gtk_widget_destroy ), NULL );
+
+       GtkWidget *ok_button, *cancel_button;
+       g_object_get(dlg, "ok-button", &ok_button, "cancel-button", &cancel_button, nullptr);
+
+       g_signal_connect( GTK_OBJECT(ok_button), "clicked",
+                                               G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
+       g_signal_connect( GTK_OBJECT(cancel_button), "clicked",
+                                               G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
        g_object_set_data( G_OBJECT( dlg ), "loop", &loop );
        g_object_set_data( G_OBJECT( dlg ), "ret", &ret );
 
@@ -80,13 +85,13 @@ static int DoColor( PackedColour *c ){
        while ( loop )
                gtk_main_iteration();
 
-       gtk_color_selection_get_color( GTK_COLOR_SELECTION( GTK_COLOR_SELECTION_DIALOG( dlg )->colorsel ), clr );
+       gtk_color_selection_get_current_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(dlg)) ), &clr );
 
        gtk_grab_remove( dlg );
        gtk_widget_destroy( dlg );
 
        if ( ret == IDOK ) {
-               *c = RGB( clr[0] * 255, clr[1] * 255, clr[2] * 255 );
+               *c = RGB( clr.red / (65535 / 255), clr.green / (65535 / 255), clr.blue / (65535 / 255));
        }
 
        return ret;
@@ -125,7 +130,7 @@ static void SetClipText( GtkWidget* label ){
 }
 
 static void OnScroll2d( GtkAdjustment *adj, gpointer data ){
-       portals.width_2d = static_cast<float>( adj->value );
+       portals.width_2d = static_cast<float>( gtk_adjustment_get_value(adj) );
        Set2DText( GTK_WIDGET( data ) );
 
        Portals_shadersChanged();
@@ -133,21 +138,21 @@ static void OnScroll2d( GtkAdjustment *adj, gpointer data ){
 }
 
 static void OnScroll3d( GtkAdjustment *adj, gpointer data ){
-       portals.width_3d = static_cast<float>( adj->value );
+       portals.width_3d = static_cast<float>( gtk_adjustment_get_value(adj) );
        Set3DText( GTK_WIDGET( data ) );
 
        SceneChangeNotify();
 }
 
 static void OnScrollTrans( GtkAdjustment *adj, gpointer data ){
-       portals.trans_3d = static_cast<float>( adj->value );
+       portals.trans_3d = static_cast<float>( gtk_adjustment_get_value(adj) );
        Set3DTransText( GTK_WIDGET( data ) );
 
        SceneChangeNotify();
 }
 
 static void OnScrollClip( GtkAdjustment *adj, gpointer data ){
-       portals.clip_range = static_cast<float>( adj->value );
+       portals.clip_range = static_cast<float>( gtk_adjustment_get_value(adj) );
        SetClipText( GTK_WIDGET( data ) );
 
        SceneChangeNotify();
@@ -239,235 +244,220 @@ static void OnClip( GtkWidget *widget, gpointer data ){
 
 void DoConfigDialog(){
        GtkWidget *dlg, *hbox, *vbox, *vbox2, *button, *table, *frame;
-       GtkWidget *lw3slider, *lw3label, *lw2slider, *lw2label, *zlist, *menu, *item;
+       GtkWidget *lw3slider, *lw3label, *lw2slider, *lw2label, *item;
        GtkWidget *aa2check, *aa3check, *depthcheck, *linescheck, *polyscheck;
        GtkWidget *transslider, *translabel, *clipslider, *cliplabel;
        GtkWidget *show2check, *show3check, *portalcheck;
        int loop = 1, ret = IDCANCEL;
-       GtkObject *adj;
 
-       dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       dlg = ui::Window( ui::window_type::TOP );
        gtk_window_set_title( GTK_WINDOW( dlg ), "Portal Viewer Configuration" );
-       gtk_signal_connect( GTK_OBJECT( dlg ), "delete_event",
-                                               GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( dlg ), "destroy",
-                                               GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       g_signal_connect( GTK_OBJECT( dlg ), "delete_event",
+                                               G_CALLBACK( dialog_delete_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( dlg ), "destroy",
+                                               G_CALLBACK( gtk_widget_destroy ), NULL );
        g_object_set_data( G_OBJECT( dlg ), "loop", &loop );
        g_object_set_data( G_OBJECT( dlg ), "ret", &ret );
 
-       vbox = gtk_vbox_new( FALSE, 5 );
+       vbox = ui::VBox( FALSE, 5 );
        gtk_widget_show( vbox );
        gtk_container_add( GTK_CONTAINER( dlg ), vbox );
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
 
-       frame = gtk_frame_new( "3D View" );
+       frame = ui::Frame( "3D View" );
        gtk_widget_show( frame );
        gtk_box_pack_start( GTK_BOX( vbox ), frame, TRUE, TRUE, 0 );
 
-       vbox2 = gtk_vbox_new( FALSE, 5 );
+       vbox2 = ui::VBox( FALSE, 5 );
        gtk_widget_show( vbox2 );
        gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
        gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_widget_show( hbox );
        gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, TRUE, 0 );
 
-       adj = gtk_adjustment_new( portals.width_3d, 2, 40, 1, 1, 0 );
-       lw3slider = gtk_hscale_new( GTK_ADJUSTMENT( adj ) );
+       auto adj = ui::Adjustment( portals.width_3d, 2, 40, 1, 1, 0 );
+       lw3slider = ui::HScale( adj );
        gtk_widget_show( lw3slider );
        gtk_box_pack_start( GTK_BOX( hbox ), lw3slider, TRUE, TRUE, 0 );
        gtk_scale_set_draw_value( GTK_SCALE( lw3slider ), FALSE );
 
-       lw3label = gtk_label_new( "" );
+       lw3label = ui::Label( "" );
        gtk_widget_show( lw3label );
        gtk_box_pack_start( GTK_BOX( hbox ), lw3label, FALSE, TRUE, 0 );
-       gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( OnScroll3d ), lw3label );
+       g_signal_connect( GTK_OBJECT(adj), "value_changed", G_CALLBACK( OnScroll3d ), lw3label );
 
-       table = gtk_table_new( 2, 4, FALSE );
+       table = ui::Table( 2, 4, FALSE );
        gtk_widget_show( table );
        gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 );
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
        gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
 
-       button = gtk_button_new_with_label( "Color" );
+       button = ui::Button( "Color" );
        gtk_widget_show( button );
        gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-       gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( OnColor3d ), NULL );
+       g_signal_connect( GTK_OBJECT( button ), "clicked", G_CALLBACK( OnColor3d ), NULL );
 
-       button = gtk_button_new_with_label( "Depth Color" );
+       button = ui::Button( "Depth Color" );
        gtk_widget_show( button );
        gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-       gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( OnColorFog ), NULL );
+       g_signal_connect( GTK_OBJECT( button ), "clicked", G_CALLBACK( OnColorFog ), NULL );
 
-       aa3check = gtk_check_button_new_with_label( "Anti-Alias (May not work on some video cards)" );
+       aa3check = ui::CheckButton( "Anti-Alias (May not work on some video cards)" );
        gtk_widget_show( aa3check );
        gtk_table_attach( GTK_TABLE( table ), aa3check, 1, 4, 0, 1,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-       gtk_signal_connect( GTK_OBJECT( aa3check ), "toggled", GTK_SIGNAL_FUNC( OnAntiAlias3d ), NULL );
+       g_signal_connect( GTK_OBJECT( aa3check ), "toggled", G_CALLBACK( OnAntiAlias3d ), NULL );
 
-       depthcheck = gtk_check_button_new_with_label( "Depth Cue" );
+       depthcheck = ui::CheckButton( "Depth Cue" );
        gtk_widget_show( depthcheck );
        gtk_table_attach( GTK_TABLE( table ), depthcheck, 1, 2, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-       gtk_signal_connect( GTK_OBJECT( depthcheck ), "toggled", GTK_SIGNAL_FUNC( OnFog ), NULL );
+       g_signal_connect( GTK_OBJECT( depthcheck ), "toggled", G_CALLBACK( OnFog ), NULL );
 
-       linescheck = gtk_check_button_new_with_label( "Lines" );
+       linescheck = ui::CheckButton( "Lines" );
        gtk_widget_show( linescheck );
        gtk_table_attach( GTK_TABLE( table ), linescheck, 2, 3, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-       gtk_signal_connect( GTK_OBJECT( linescheck ), "toggled", GTK_SIGNAL_FUNC( OnLines ), NULL );
+       g_signal_connect( GTK_OBJECT( linescheck ), "toggled", G_CALLBACK( OnLines ), NULL );
 
-       polyscheck = gtk_check_button_new_with_label( "Polygons" );
+       polyscheck = ui::CheckButton( "Polygons" );
        gtk_widget_show( polyscheck );
        gtk_table_attach( GTK_TABLE( table ), polyscheck, 3, 4, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-       gtk_signal_connect( GTK_OBJECT( polyscheck ), "toggled", GTK_SIGNAL_FUNC( OnPoly ), NULL );
+       g_signal_connect( GTK_OBJECT( polyscheck ), "toggled", G_CALLBACK( OnPoly ), NULL );
 
-       zlist = gtk_option_menu_new();
+       auto zlist = ui::ComboBoxText();
        gtk_widget_show( zlist );
        gtk_box_pack_start( GTK_BOX( vbox2 ), zlist, TRUE, FALSE, 0 );
 
-       menu = gtk_menu_new();
-       gtk_widget_show( menu );
-       gtk_option_menu_set_menu( GTK_OPTION_MENU( zlist ), menu );
-
-       item = gtk_menu_item_new_with_label( "Z-Buffer Test and Write (recommended for solid or no polygons)" );
-       gtk_widget_show( item );
-       gtk_signal_connect( GTK_OBJECT( item ), "activate",
-                                               GTK_SIGNAL_FUNC( OnSelchangeZbuffer ), GINT_TO_POINTER( 0 ) );
-       gtk_menu_append( GTK_MENU( menu ), item );
-
-       item = gtk_menu_item_new_with_label( "Z-Buffer Test Only (recommended for transparent polygons)" );
-       gtk_widget_show( item );
-       gtk_signal_connect( GTK_OBJECT( item ), "activate",
-                                               GTK_SIGNAL_FUNC( OnSelchangeZbuffer ), GINT_TO_POINTER( 1 ) );
-       gtk_menu_append( GTK_MENU( menu ), item );
-
-       item = gtk_menu_item_new_with_label( "Z-Buffer Off" );
-       gtk_widget_show( item );
-       gtk_signal_connect( GTK_OBJECT( item ), "activate",
-                                               GTK_SIGNAL_FUNC( OnSelchangeZbuffer ), GINT_TO_POINTER( 2 ) );
-       gtk_menu_append( GTK_MENU( menu ), item );
-
-       table = gtk_table_new( 2, 2, FALSE );
+       gtk_combo_box_text_append_text(zlist, "Z-Buffer Test and Write (recommended for solid or no polygons)");
+       gtk_combo_box_text_append_text(zlist, "Z-Buffer Test Only (recommended for transparent polygons)");
+       gtk_combo_box_text_append_text(zlist, "Z-Buffer Off");
+
+       g_signal_connect(G_OBJECT(zlist), "changed", G_CALLBACK(+[](GtkComboBox *self, void *) {
+               OnSelchangeZbuffer(GTK_WIDGET(self), GINT_TO_POINTER(gtk_combo_box_get_active(self)));
+       }), nullptr);
+
+       table = ui::Table( 2, 2, FALSE );
        gtk_widget_show( table );
        gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 );
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
        gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
 
-       adj = gtk_adjustment_new( portals.trans_3d, 0, 100, 1, 1, 0 );
-       transslider = gtk_hscale_new( GTK_ADJUSTMENT( adj ) );
+       adj = ui::Adjustment( portals.trans_3d, 0, 100, 1, 1, 0 );
+       transslider = ui::HScale( adj );
        gtk_widget_show( transslider );
        gtk_table_attach( GTK_TABLE( table ), transslider, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_scale_set_draw_value( GTK_SCALE( transslider ), FALSE );
 
-       translabel = gtk_label_new( "" );
+       translabel = ui::Label( "" );
        gtk_widget_show( translabel );
        gtk_table_attach( GTK_TABLE( table ), translabel, 1, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_misc_set_alignment( GTK_MISC( translabel ), 0.0, 0.0 );
-       gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( OnScrollTrans ), translabel );
+       g_signal_connect( GTK_OBJECT(adj), "value_changed", G_CALLBACK( OnScrollTrans ), translabel );
 
-       adj = gtk_adjustment_new( portals.clip_range, 1, 128, 1, 1, 0 );
-       clipslider = gtk_hscale_new( GTK_ADJUSTMENT( adj ) );
+       adj = ui::Adjustment( portals.clip_range, 1, 128, 1, 1, 0 );
+       clipslider = ui::HScale( adj );
        gtk_widget_show( clipslider );
        gtk_table_attach( GTK_TABLE( table ), clipslider, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_scale_set_draw_value( GTK_SCALE( clipslider ), FALSE );
 
-       cliplabel = gtk_label_new( "" );
+       cliplabel = ui::Label( "" );
        gtk_widget_show( cliplabel );
        gtk_table_attach( GTK_TABLE( table ), cliplabel, 1, 2, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_misc_set_alignment( GTK_MISC( cliplabel ), 0.0, 0.0 );
-       gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( OnScrollClip ), cliplabel );
+       g_signal_connect( GTK_OBJECT(adj), "value_changed", G_CALLBACK( OnScrollClip ), cliplabel );
 
-       hbox = gtk_hbox_new( TRUE, 5 );
+       hbox = ui::HBox( TRUE, 5 );
        gtk_widget_show( hbox );
        gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 );
 
-       show3check = gtk_check_button_new_with_label( "Show" );
+       show3check = ui::CheckButton( "Show" );
        gtk_widget_show( show3check );
        gtk_box_pack_start( GTK_BOX( hbox ), show3check, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( show3check ), "toggled", GTK_SIGNAL_FUNC( OnConfig3d ), NULL );
+       g_signal_connect( GTK_OBJECT( show3check ), "toggled", G_CALLBACK( OnConfig3d ), NULL );
 
-       portalcheck = gtk_check_button_new_with_label( "Portal cubic clipper" );
+       portalcheck = ui::CheckButton( "Portal cubic clipper" );
        gtk_widget_show( portalcheck );
        gtk_box_pack_start( GTK_BOX( hbox ), portalcheck, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( portalcheck ), "toggled", GTK_SIGNAL_FUNC( OnClip ), NULL );
+       g_signal_connect( GTK_OBJECT( portalcheck ), "toggled", G_CALLBACK( OnClip ), NULL );
 
-       frame = gtk_frame_new( "2D View" );
+       frame = ui::Frame( "2D View" );
        gtk_widget_show( frame );
        gtk_box_pack_start( GTK_BOX( vbox ), frame, TRUE, TRUE, 0 );
 
-       vbox2 = gtk_vbox_new( FALSE, 5 );
+       vbox2 = ui::VBox( FALSE, 5 );
        gtk_widget_show( vbox2 );
        gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
        gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_widget_show( hbox );
        gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 );
 
-       adj = gtk_adjustment_new( portals.width_2d, 2, 40, 1, 1, 0 );
-       lw2slider = gtk_hscale_new( GTK_ADJUSTMENT( adj ) );
+       adj = ui::Adjustment( portals.width_2d, 2, 40, 1, 1, 0 );
+       lw2slider = ui::HScale( adj );
        gtk_widget_show( lw2slider );
        gtk_box_pack_start( GTK_BOX( hbox ), lw2slider, TRUE, TRUE, 0 );
        gtk_scale_set_draw_value( GTK_SCALE( lw2slider ), FALSE );
 
-       lw2label = gtk_label_new( "" );
+       lw2label = ui::Label( "" );
        gtk_widget_show( lw2label );
        gtk_box_pack_start( GTK_BOX( hbox ), lw2label, FALSE, TRUE, 0 );
-       gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( OnScroll2d ), lw2label );
+       g_signal_connect( GTK_OBJECT(adj), "value_changed", G_CALLBACK( OnScroll2d ), lw2label );
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_widget_show( hbox );
        gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 );
 
-       button = gtk_button_new_with_label( "Color" );
+       button = ui::Button( "Color" );
        gtk_widget_show( button );
        gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
-       gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( OnColor2d ), NULL );
-       gtk_widget_set_usize( button, 60, -2 );
+       g_signal_connect( GTK_OBJECT( button ), "clicked", G_CALLBACK( OnColor2d ), NULL );
+       gtk_widget_set_size_request( button, 60, -1 );
 
-       aa2check = gtk_check_button_new_with_label( "Anti-Alias (May not work on some video cards)" );
+       aa2check = ui::CheckButton( "Anti-Alias (May not work on some video cards)" );
        gtk_widget_show( aa2check );
        gtk_box_pack_start( GTK_BOX( hbox ), aa2check, TRUE, TRUE, 0 );
-       gtk_signal_connect( GTK_OBJECT( aa2check ), "toggled", GTK_SIGNAL_FUNC( OnAntiAlias2d ), NULL );
+       g_signal_connect( GTK_OBJECT( aa2check ), "toggled", G_CALLBACK( OnAntiAlias2d ), NULL );
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_widget_show( hbox );
        gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 );
 
-       show2check = gtk_check_button_new_with_label( "Show" );
+       show2check = ui::CheckButton( "Show" );
        gtk_widget_show( show2check );
        gtk_box_pack_start( GTK_BOX( hbox ), show2check, FALSE, FALSE, 0 );
-       gtk_signal_connect( GTK_OBJECT( show2check ), "toggled", GTK_SIGNAL_FUNC( OnConfig2d ), NULL );
+       g_signal_connect( GTK_OBJECT( show2check ), "toggled", G_CALLBACK( OnConfig2d ), NULL );
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_widget_show( hbox );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
 
-       button = gtk_button_new_with_label( "OK" );
+       button = ui::Button( "OK" );
        gtk_widget_show( button );
        gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
-       gtk_signal_connect( GTK_OBJECT( button ), "clicked",
-                                               GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
-       gtk_widget_set_usize( button, 60, -2 );
+       g_signal_connect( GTK_OBJECT( button ), "clicked",
+                                               G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
+       gtk_widget_set_size_request( button, 60, -1 );
 
        // initialize dialog
        gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( show2check ), portals.show_2d );
@@ -479,7 +469,7 @@ void DoConfigDialog(){
        gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( polyscheck ), portals.polygons );
        gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( linescheck ), portals.lines );
        gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( aa3check ), portals.aa_3d );
-       gtk_option_menu_set_history( GTK_OPTION_MENU( zlist ), portals.zbuffer );
+       gtk_combo_box_set_active(zlist, portals.zbuffer);
        gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( portalcheck ), portals.clip );
 
        Set3DText( lw3label );
index f3d4df8d06a0104867dd8d1b259e9d9b168a1016..eaee56c4a13a953b2e7a1a22583c12252cda353d 100644 (file)
@@ -55,47 +55,22 @@ static gint dialog_delete_callback( GtkWidget *widget, GdkEvent* event, gpointer
        return TRUE;
 }
 
-static void file_sel_callback( GtkWidget *widget, gpointer data ){
-       GtkWidget *parent;
-       int *loop;
-       char **filename;
-
-       parent = gtk_widget_get_toplevel( widget );
-       loop = (int*)g_object_get_data( G_OBJECT( parent ), "loop" );
-       filename = (char**)g_object_get_data( G_OBJECT( parent ), "filename" );
-
-       *loop = 0;
-       if ( gpointer_to_int( data ) == IDOK ) {
-               *filename = g_strdup( gtk_file_selection_get_filename( GTK_FILE_SELECTION( parent ) ) );
-       }
-}
-
 static void change_clicked( GtkWidget *widget, gpointer data ){
        GtkWidget* file_sel;
        char* filename = NULL;
-       int loop = 1;
 
-       file_sel = gtk_file_selection_new( "Locate portal (.prt) file" );
-       gtk_signal_connect( GTK_OBJECT( GTK_FILE_SELECTION( file_sel )->ok_button ), "clicked",
-                                               GTK_SIGNAL_FUNC( file_sel_callback ), GINT_TO_POINTER( IDOK ) );
-       gtk_signal_connect( GTK_OBJECT( GTK_FILE_SELECTION( file_sel )->cancel_button ), "clicked",
-                                               GTK_SIGNAL_FUNC( file_sel_callback ), GINT_TO_POINTER( IDCANCEL ) );
-       gtk_signal_connect( GTK_OBJECT( file_sel ), "delete_event",
-                                               GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_file_selection_hide_fileop_buttons( GTK_FILE_SELECTION( file_sel ) );
+       file_sel = gtk_file_chooser_dialog_new ( "Locate portal (.prt) file", nullptr, GTK_FILE_CHOOSER_ACTION_OPEN,
+                                                                                        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                                                                                        GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+                                                                                        nullptr);
 
-       g_object_set_data( G_OBJECT( file_sel ), "loop", &loop );
-       g_object_set_data( G_OBJECT( file_sel ), "filename", &filename );
-       gtk_file_selection_set_filename( GTK_FILE_SELECTION( file_sel ), portals.fn );
+       gtk_file_chooser_set_filename( GTK_FILE_CHOOSER(file_sel), portals.fn );
 
-       gtk_grab_add( file_sel );
-       gtk_widget_show( file_sel );
-
-       while ( loop )
-               gtk_main_iteration();
-
-       gtk_grab_remove( file_sel );
-       gtk_widget_destroy( file_sel );
+       if (gtk_dialog_run (GTK_DIALOG (file_sel)) == GTK_RESPONSE_ACCEPT)
+       {
+               filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_sel));
+       }
+       gtk_widget_destroy (file_sel);
 
        if ( filename != NULL ) {
                strcpy( portals.fn, filename );
@@ -108,60 +83,60 @@ int DoLoadPortalFileDialog(){
        GtkWidget *dlg, *vbox, *hbox, *button, *entry, *check2d, *check3d;
        int loop = 1, ret = IDCANCEL;
 
-       dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       dlg = ui::Window( ui::window_type::TOP );
        gtk_window_set_title( GTK_WINDOW( dlg ), "Load .prt" );
-       gtk_signal_connect( GTK_OBJECT( dlg ), "delete_event",
-                                               GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( dlg ), "destroy",
-                                               GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       g_signal_connect( GTK_OBJECT( dlg ), "delete_event",
+                                               G_CALLBACK( dialog_delete_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( dlg ), "destroy",
+                                               G_CALLBACK( gtk_widget_destroy ), NULL );
        g_object_set_data( G_OBJECT( dlg ), "loop", &loop );
        g_object_set_data( G_OBJECT( dlg ), "ret", &ret );
 
-       vbox = gtk_vbox_new( FALSE, 5 );
+       vbox = ui::VBox( FALSE, 5 );
        gtk_widget_show( vbox );
        gtk_container_add( GTK_CONTAINER( dlg ), vbox );
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
 
-       entry = gtk_entry_new();
+       entry = ui::Entry();
        gtk_widget_show( entry );
-       gtk_entry_set_editable( GTK_ENTRY( entry ), FALSE );
+       gtk_editable_set_editable( GTK_EDITABLE( entry ), FALSE );
        gtk_box_pack_start( GTK_BOX( vbox ), entry, FALSE, FALSE, 0 );
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_widget_show( hbox );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
 
-       check3d = gtk_check_button_new_with_label( "Show 3D" );
+       check3d = ui::CheckButton( "Show 3D" );
        gtk_widget_show( check3d );
        gtk_box_pack_start( GTK_BOX( hbox ), check3d, FALSE, FALSE, 0 );
 
-       check2d = gtk_check_button_new_with_label( "Show 2D" );
+       check2d = ui::CheckButton( "Show 2D" );
        gtk_widget_show( check2d );
        gtk_box_pack_start( GTK_BOX( hbox ), check2d, FALSE, FALSE, 0 );
 
-       button = gtk_button_new_with_label( "Change" );
+       button = ui::Button( "Change" );
        gtk_widget_show( button );
        gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
-       gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( change_clicked ), entry );
-       gtk_widget_set_usize( button, 60, -2 );
+       g_signal_connect( GTK_OBJECT( button ), "clicked", G_CALLBACK( change_clicked ), entry );
+       gtk_widget_set_size_request( button, 60, -1 );
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_widget_show( hbox );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
 
-       button = gtk_button_new_with_label( "Cancel" );
+       button = ui::Button( "Cancel" );
        gtk_widget_show( button );
        gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
-       gtk_signal_connect( GTK_OBJECT( button ), "clicked",
-                                               GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
-       gtk_widget_set_usize( button, 60, -2 );
+       g_signal_connect( GTK_OBJECT( button ), "clicked",
+                                               G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
+       gtk_widget_set_size_request( button, 60, -1 );
 
-       button = gtk_button_new_with_label( "OK" );
+       button = ui::Button( "OK" );
        gtk_widget_show( button );
        gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
-       gtk_signal_connect( GTK_OBJECT( button ), "clicked",
-                                               GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
-       gtk_widget_set_usize( button, 60, -2 );
+       g_signal_connect( GTK_OBJECT( button ), "clicked",
+                                               G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
+       gtk_widget_set_size_request( button, 60, -1 );
 
        strcpy( portals.fn, GlobalRadiant().getMapName() );
        char* fn = strrchr( portals.fn, '.' );
index 62e9abe6aa1df261f9bc64515f7783d31690bb05..ebe2e6c674f6539700aade92e7284d159a201cd3 100644 (file)
@@ -57,7 +57,7 @@ ShaderPlugPluginDependencies() :
 
 namespace Shaderplug
 {
-GtkWindow* g_window;
+ui::Window g_window;
 
 std::vector<const char*> archives;
 std::set<std::string> shaders;
@@ -67,7 +67,7 @@ XmlTagBuilder TagBuilder;
 void CreateTagFile();
 
 const char* init( void* hApp, void* pMainWidget ){
-       g_window = GTK_WINDOW( pMainWidget );
+       g_window = ui::Window(GTK_WINDOW( pMainWidget ));
        return "";
 }
 const char* getName(){
@@ -81,7 +81,7 @@ const char* getCommandTitleList(){
 }
 void dispatch( const char* command, float* vMin, float* vMax, bool bSingleBrush ){
        if ( string_equal( command, "About" ) ) {
-               GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_window ), "Shaderplug (1.0)\n\n"
+               GlobalRadiant().m_pfnMessageBox( g_window, "Shaderplug (1.0)\n\n"
                                                                                                                                 "by Shaderman (shaderman@gmx.net)",
                                                                                 "About",
                                                                                 eMB_OK,
@@ -181,23 +181,23 @@ void CreateTagFile(){
                strcat( message, "\nPlease restart Radiant now.\n" );
 
                if ( file_exists( tagFile ) ) {
-                       EMessageBoxReturn result = GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_window ),
+                       EMessageBoxReturn result = GlobalRadiant().m_pfnMessageBox( g_window ,
                                                                                                                                                "WARNING! A tag file already exists! Overwrite it?", "Overwrite tag file?",
                                                                                                                                                eMB_NOYES,
                                                                                                                                                eMB_ICONWARNING );
 
                        if ( result == eIDYES ) {
                                TagBuilder.SaveXmlDoc( tagFile );
-                               GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_window ), message, "INFO", eMB_OK, eMB_ICONASTERISK );
+                               GlobalRadiant().m_pfnMessageBox( g_window, message, "INFO", eMB_OK, eMB_ICONASTERISK );
                        }
                }
                else {
                        TagBuilder.SaveXmlDoc( tagFile );
-                       GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_window ), message, "INFO", eMB_OK, eMB_ICONASTERISK );
+                       GlobalRadiant().m_pfnMessageBox( g_window, message, "INFO", eMB_OK, eMB_ICONASTERISK );
                }
        }
        else {
-               GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_window ),
+               GlobalRadiant().m_pfnMessageBox( g_window,
                                                                                 "No shaders or textures found. No XML tag file created!\n"
                                                                                 "",
                                                                                 "ERROR",
index 50fb2cd8ee681f8abd93d02f2b3596c13251d966..7bc81d345ec5cd8095d78735df9b4c5dd127d8c8 100644 (file)
@@ -255,7 +255,7 @@ extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules( ModuleServer& server
 void about_plugin_window(){
        GtkWidget *window, *vbox, *label, *button;
 
-       window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); // create a window
+       window = ui::Window( ui::window_type::TOP ); // create a window
        gtk_window_set_transient_for( GTK_WINDOW( window ), SunPlug::main_window ); // make the window to stay in front of the main window
        g_signal_connect( G_OBJECT( window ), "delete_event", G_CALLBACK( delete_event ), NULL ); // connect the delete event
        g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( destroy ), NULL ); // connect the destroy event for the window
@@ -264,14 +264,14 @@ void about_plugin_window(){
        gtk_window_set_modal( GTK_WINDOW( window ), TRUE ); // force the user not to do something with the other windows
        gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); // set the border of the window
 
-       vbox = gtk_vbox_new( FALSE, 10 ); // create a box to arrange new objects vertically
+       vbox = ui::VBox( FALSE, 10 ); // create a box to arrange new objects vertically
        gtk_container_add( GTK_CONTAINER( window ), vbox ); // add the box to the window
 
-       label = gtk_label_new( "SunPlug v1.0 for NetRadiant 1.5\nby Topsun" ); // create a label
+       label = ui::Label( "SunPlug v1.0 for NetRadiant 1.5\nby Topsun" ); // create a label
        gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // text align left
        gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, FALSE, 2 ); // insert the label in the box
 
-       button = gtk_button_new_with_label( "OK" ); // create a button with text
+       button = ui::Button( "OK" ); // create a button with text
        g_signal_connect_swapped( G_OBJECT( button ), "clicked", G_CALLBACK( gtk_widget_destroy ), window ); // connect the click event to close the window
        gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 2 ); // insert the button in the box
 
@@ -315,13 +315,12 @@ void GetOptimalCoordinates( AABB *levelBoundingBox ){
 // MapCoordinator dialog window
 void MapCoordinator(){
        GtkWidget *window, *vbox, *table, *label, *spinnerMinX, *spinnerMinY, *spinnerMaxX, *spinnerMaxY, *button;
-       GtkAdjustment *spinner_adj_MinX, *spinner_adj_MinY, *spinner_adj_MaxX, *spinner_adj_MaxY;
        Entity *theWorldspawn = NULL;
        const char *buffer;
        char line[20];
 
        // in any case we need a window to show the user what to do
-       window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); // create the window
+       window = ui::Window( ui::window_type::TOP ); // create the window
        gtk_window_set_transient_for( GTK_WINDOW( window ), SunPlug::main_window ); // make the window to stay in front of the main window
        g_signal_connect( G_OBJECT( window ), "delete_event", G_CALLBACK( delete_event ), NULL ); // connect the delete event for the window
        g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( destroy ), NULL ); // connect the destroy event for the window
@@ -330,7 +329,7 @@ void MapCoordinator(){
        gtk_window_set_modal( GTK_WINDOW( window ), TRUE ); // force the user not to do something with the other windows
        gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); // set the border of the window
 
-       vbox = gtk_vbox_new( FALSE, 10 ); // create a box to arrange new objects vertically
+       vbox = ui::VBox( FALSE, 10 ); // create a box to arrange new objects vertically
        gtk_container_add( GTK_CONTAINER( window ), vbox ); // add the box to the window
 
        scene::Path path = makeReference( GlobalSceneGraph().root() ); // get the path to the root element of the graph
@@ -366,48 +365,48 @@ void MapCoordinator(){
                globalOutputStream() << "SunPlug: adviced mapcoordsmins=" << minX << " " << maxY << "\n"; // console info about mapcoordsmins
                globalOutputStream() << "SunPlug: adviced mapcoordsmaxs=" << maxX << " " << minY << "\n"; // console info about mapcoordsmaxs
 
-               spinner_adj_MinX = (GtkAdjustment *)gtk_adjustment_new( map_minX, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of minimum x value
-               spinner_adj_MinY = (GtkAdjustment *)gtk_adjustment_new( map_minY, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of minimum y value
-               spinner_adj_MaxX = (GtkAdjustment *)gtk_adjustment_new( map_maxX, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of maximum x value
-               spinner_adj_MaxY = (GtkAdjustment *)gtk_adjustment_new( map_maxY, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of maximum y value
+               auto spinner_adj_MinX = ui::Adjustment( map_minX, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of minimum x value
+               auto spinner_adj_MinY = ui::Adjustment( map_minY, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of minimum y value
+               auto spinner_adj_MaxX = ui::Adjustment( map_maxX, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of maximum x value
+               auto spinner_adj_MaxY = ui::Adjustment( map_maxY, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of maximum y value
 
-               button = gtk_button_new_with_label( "Get optimal mapcoords" ); // create button with text
+               button = ui::Button( "Get optimal mapcoords" ); // create button with text
                g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( input_optimal ), NULL ); // connect button with callback function
                gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 2 ); // insert button into vbox
 
                gtk_box_pack_start( GTK_BOX( vbox ), gtk_hseparator_new(), FALSE, FALSE, 2 ); // insert separator into vbox
 
-               table = gtk_table_new( 4, 3, TRUE ); // create table
+               table = ui::Table( 4, 3, TRUE ); // create table
                gtk_table_set_row_spacings( GTK_TABLE( table ), 8 ); // set row spacings
                gtk_table_set_col_spacings( GTK_TABLE( table ), 8 ); // set column spacings
                gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, FALSE, 2 ); // insert table into vbox
 
-               label = gtk_label_new( "x" ); // create label
+               label = ui::Label( "x" ); // create label
                gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // align text to the left side
                gtk_table_attach_defaults( GTK_TABLE( table ), label, 1, 2, 0, 1 ); // insert label into table
 
-               label = gtk_label_new( "y" ); // create label
+               label = ui::Label( "y" ); // create label
                gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // align text to the left side
                gtk_table_attach_defaults( GTK_TABLE( table ), label, 2, 3, 0, 1 ); // insert label into table
 
-               label = gtk_label_new( "mapcoordsmins" ); // create label
+               label = ui::Label( "mapcoordsmins" ); // create label
                gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // align text to the left side
                gtk_table_attach_defaults( GTK_TABLE( table ), label, 0, 1, 1, 2 ); // insert label into table
 
-               spinnerMinX = gtk_spin_button_new( spinner_adj_MinX, 1.0, 0 ); // create textbox wiht value spin, value and value range
+               spinnerMinX = ui::SpinButton( spinner_adj_MinX, 1.0, 0 ); // create textbox wiht value spin, value and value range
                gtk_table_attach_defaults( GTK_TABLE( table ), spinnerMinX, 1, 2, 1, 2 ); // insert spinbox into table
 
-               spinnerMinY = gtk_spin_button_new( spinner_adj_MinY, 1.0, 0 ); // create textbox wiht value spin, value and value range
+               spinnerMinY = ui::SpinButton( spinner_adj_MinY, 1.0, 0 ); // create textbox wiht value spin, value and value range
                gtk_table_attach_defaults( GTK_TABLE( table ), spinnerMinY, 2, 3, 1, 2 ); // insert spinbox into table
 
-               label = gtk_label_new( "mapcoordsmaxs" ); // create label
+               label = ui::Label( "mapcoordsmaxs" ); // create label
                gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // align text to the left side
                gtk_table_attach_defaults( GTK_TABLE( table ), label, 0, 1, 2, 3 ); // insert label into table
 
-               spinnerMaxX = gtk_spin_button_new( spinner_adj_MaxX, 1.0, 0 ); // create textbox wiht value spin, value and value range
+               spinnerMaxX = ui::SpinButton( spinner_adj_MaxX, 1.0, 0 ); // create textbox wiht value spin, value and value range
                gtk_table_attach_defaults( GTK_TABLE( table ), spinnerMaxX, 1, 2, 2, 3 ); // insert spinbox into table
 
-               spinnerMaxY = gtk_spin_button_new( spinner_adj_MaxY, 1.0, 0 ); // create textbox wiht value spin, value and value range
+               spinnerMaxY = ui::SpinButton( spinner_adj_MaxY, 1.0, 0 ); // create textbox wiht value spin, value and value range
                gtk_table_attach_defaults( GTK_TABLE( table ), spinnerMaxY, 2, 3, 2, 3 ); // insert spinbox into table
 
                // put the references to the spinboxes and the worldspawn into the global exchange
@@ -417,22 +416,22 @@ void MapCoordinator(){
                msp.spinner4 = GTK_SPIN_BUTTON( spinnerMaxY );
                msp.worldspawn = theWorldspawn;
 
-               button = gtk_button_new_with_label( "Set" ); // create button with text
+               button = ui::Button( "Set" ); // create button with text
                g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( set_coordinates ), NULL ); // connect button with callback function
                gtk_table_attach_defaults( GTK_TABLE( table ), button, 1, 2, 3, 4 ); // insert button into table
 
-               button = gtk_button_new_with_label( "Cancel" ); // create button with text
+               button = ui::Button( "Cancel" ); // create button with text
                g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( close_window ), NULL ); // connect button with callback function
                gtk_table_attach_defaults( GTK_TABLE( table ), button, 2, 3, 3, 4 ); // insert button into table
        }
        else {
                globalOutputStream() << "SunPlug: no worldspawn found!\n"; // output error to console
 
-               label = gtk_label_new( "ERROR: No worldspawn was found in the map!\nIn order to use this tool the map must have at least one brush in the worldspawn. " ); // create a label
+               label = ui::Label( "ERROR: No worldspawn was found in the map!\nIn order to use this tool the map must have at least one brush in the worldspawn. " ); // create a label
                gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // text align left
                gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, FALSE, 2 ); // insert the label in the box
 
-               button = gtk_button_new_with_label( "OK" ); // create a button with text
+               button = ui::Button( "OK" ); // create a button with text
                g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( close_window ), NULL ); // connect the click event to close the window
                gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 2 ); // insert the button in the box
        }
index bb11866430e1068f9012759f8703c4aa1eefd881..9bfb46eca6899d0e14298ccde198986379e02273 100644 (file)
@@ -59,10 +59,10 @@ UFOAIPluginDependencies( void ) :
 
 namespace UFOAI
 {
-GtkWindow* g_mainwnd;
+       ui::Window g_mainwnd;
 
 const char* init( void* hApp, void* pMainWidget ){
-       g_mainwnd = GTK_WINDOW( pMainWidget );
+       g_mainwnd = ui::Window(GTK_WINDOW( pMainWidget ));
        return "Initializing GTKRadiant UFOAI plugin";
 }
 const char* getName(){
@@ -78,8 +78,12 @@ const char* getCommandTitleList(){
 void dispatch( const char* command, float* vMin, float* vMax, bool bSingleBrush ){
        char *message = NULL;
        if ( string_equal( command, "About" ) ) {
-               GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_mainwnd ),
-                                                                                "UFO:AI Plugin (http://ufoai.sf.net)\nBuild: " __DATE__ "\nRadiant version: " RADIANT_VERSION "\nPlugin version: " PLUGIN_VERSION "\nAuthor: Martin Gerhardy (tlh2000/mattn)\n", "About",
+               char const *version_string = "UFO:AI Plugin (http://ufoai.sf.net)\nBuild: " __DATE__
+                       "\nRadiant version: " RADIANT_VERSION
+                       "\nPlugin version: " PLUGIN_VERSION
+                       "\nAuthor: Martin Gerhardy (tlh2000/mattn)\n";
+               GlobalRadiant().m_pfnMessageBox( g_mainwnd,
+                                                                                version_string, "About",
                                                                                 eMB_OK, eMB_ICONDEFAULT );
        }
        else if ( string_equal( command, "Level 1" ) ) {
@@ -129,7 +133,7 @@ void dispatch( const char* command, float* vMin, float* vMax, bool bSingleBrush
        }
 
        if ( message != NULL ) {
-               GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_mainwnd ),
+               GlobalRadiant().m_pfnMessageBox( g_mainwnd,
                                                                                 message, "Note",
                                                                                 eMB_OK, eMB_ICONDEFAULT );
        }
index 62d82b6ec889e83f5b1641bd92b821067525dc22..7e5daad302a0eae0761d0c51f13a7797bff35819 100644 (file)
@@ -33,7 +33,6 @@ enum EType
        eSpace,
        eButton,
        eToggleButton,
-       eRadioButton,
 };
 
 virtual const char* getImage() const = 0;
index cb6c2ba57da16d38925f67401da30128d2ac8cf1..e97c010723b3eb07689c1b2c1ba1a65b37337ef4 100644 (file)
@@ -26,6 +26,7 @@
 #ifndef __QERPLUGIN_H__
 #define __QERPLUGIN_H__
 
+#include "uilib/uilib.h"
 #include "generic/constant.h"
 
 
@@ -35,7 +36,6 @@
 // NOTE: parent can be 0 in all functions but it's best to set them
 
 // this API does not depend on gtk+ or glib
-typedef struct _GtkWidget GtkWidget;
 
 enum EMessageBoxType
 {
@@ -65,22 +65,22 @@ enum EMessageBoxReturn
 
 // simple Message Box, see above for the 'type' flags
 
-typedef EMessageBoxReturn ( *PFN_QERAPP_MESSAGEBOX )( GtkWidget *parent, const char* text, const char* caption /* = "NetRadiant"*/, EMessageBoxType type /* = eMB_OK*/, EMessageBoxIcon icon /* = eMB_ICONDEFAULT*/ );
+typedef EMessageBoxReturn ( *PFN_QERAPP_MESSAGEBOX )( ui::Widget parent, const char* text, const char* caption /* = "NetRadiant"*/, EMessageBoxType type /* = eMB_OK*/, EMessageBoxIcon icon /* = eMB_ICONDEFAULT*/ );
 
 // file and directory selection functions return null if the user hits cancel
 // - 'title' is the dialog title (can be null)
 // - 'path' is used to set the initial directory (can be null)
 // - 'pattern': the first pattern is for the win32 mode, then comes the Gtk pattern list, see Radiant source for samples
-typedef const char* ( *PFN_QERAPP_FILEDIALOG )( GtkWidget *parent, bool open, const char* title, const char* path /* = 0*/, const char* pattern /* = 0*/, bool want_load /* = false*/, bool want_import /* = false*/, bool want_save /* = false*/ );
+typedef const char* ( *PFN_QERAPP_FILEDIALOG )( ui::Widget parent, bool open, const char* title, const char* path /* = 0*/, const char* pattern /* = 0*/, bool want_load /* = false*/, bool want_import /* = false*/, bool want_save /* = false*/ );
 
 // returns a gchar* string that must be g_free'd by the user
-typedef char* ( *PFN_QERAPP_DIRDIALOG )( GtkWidget *parent, const char* title /* = "Choose Directory"*/, const char* path /* = 0*/ );
+typedef char* ( *PFN_QERAPP_DIRDIALOG )( ui::Widget parent, const char* title /* = "Choose Directory"*/, const char* path /* = 0*/ );
 
 // return true if the user closed the dialog with 'Ok'
 // 'color' is used to set the initial value and store the selected value
 template<typename Element> class BasicVector3;
 typedef BasicVector3<float> Vector3;
-typedef bool ( *PFN_QERAPP_COLORDIALOG )( GtkWidget *parent, Vector3& color,
+typedef bool ( *PFN_QERAPP_COLORDIALOG )( ui::Widget parent, Vector3& color,
                                                                                  const char* title /* = "Choose Color"*/ );
 
 // load a .bmp file and create a GtkImage widget from it
index c359df15f2dea4392cf273ab1ea7dc32662e71b7..390282a72e0f38b3ebfa1a0f21cbed74dbfa3ddd 100644 (file)
@@ -166,5 +166,4 @@ inline void swap( Array<Element, Allocator>& self, Array<Element, Allocator>& ot
        self.swap( other );
 }
 }
-
 #endif
index 880a7a7a57604dd7f90727a124db3c9b488f1197..047e4ea8f94c77a6e7060bab9584282e60f02e38 100644 (file)
@@ -95,83 +95,83 @@ pointer operator->() const {
 template<typename Key, typename Cached, typename Hasher, typename KeyEqual = std::equal_to<Key>, typename CreationPolicy = DefaultCreationPolicy<Cached, Key> >
 class HashedCache : public CreationPolicy
 {
-typedef SharedValue<Cached> Element;
-typedef HashTable<Key, Element, Hasher, KeyEqual> map_type;
+       typedef SharedValue<Cached> Element;
+       typedef HashTable<Key, Element, Hasher, KeyEqual> map_type;
 
-map_type m_map;
+       map_type m_map;
 
 public:
-explicit HashedCache( const CreationPolicy& creation = CreationPolicy() )
-       : CreationPolicy( creation ), m_map( 256 ){
-}
-~HashedCache(){
-       ASSERT_MESSAGE( empty(), "HashedCache::~HashedCache: not empty" );
-}
+       explicit HashedCache( const CreationPolicy& creation = CreationPolicy() )
+               : CreationPolicy( creation ), m_map( 256 ){
+       }
+       ~HashedCache(){
+               ASSERT_MESSAGE( empty(), "HashedCache::~HashedCache: not empty" );
+       }
 
-typedef typename map_type::iterator iterator;
-typedef typename map_type::value_type value_type;
+       typedef typename map_type::iterator iterator;
+       typedef typename map_type::value_type value_type;
 
-iterator begin(){
-       return m_map.begin();
-}
-iterator end(){
-       return m_map.end();
-}
+       iterator begin(){
+               return m_map.begin();
+       }
+       iterator end(){
+               return m_map.end();
+       }
 
-bool empty() const {
-       return m_map.empty();
-}
+       bool empty() const {
+               return m_map.empty();
+       }
 
-iterator find( const Key& key ){
-       return m_map.find( key );
-}
+       iterator find( const Key& key ){
+               return m_map.find( key );
+       }
 
-void capture( iterator i ){
+       void capture( iterator i ){
        ( *i ).value.increment();
-}
-void release( iterator i ){
+       }
+       void release( iterator i ){
        if ( ( *i ).value.decrement() == 0 ) {
                CreationPolicy::destroy( ( *i ).value.get() );
-               m_map.erase( i );
+                       m_map.erase( i );
+               }
        }
-}
 
 #if 1
-Element& capture( const Key& key ){
+       Element& capture( const Key& key ){
 #if 0
        Element& elem = m_map[key];
-       if ( elem.increment() == 1 ) {
-               elem.set( CreationPolicy::construct( key ) );
-       }
+               if ( elem.increment() == 1 ) {
+                       elem.set( CreationPolicy::construct( key ) );
+               }
        return elem;
 #else
        iterator i = m_map.insert( key, Element() );
        if ( ( *i ).value.increment() == 1 ) {
                ( *i ).value.set( CreationPolicy::construct( ( *i ).key ) );
-       }
+               }
        return ( *i ).value;
 #endif
-}
+       }
 #else
 value_type& capture( const Key& key ){
-       iterator i = m_map.find( key );
-       if ( i == m_map.end() ) {
-               i = m_map.insert( key, Element() );
+               iterator i = m_map.find( key );
+               if ( i == m_map.end() ) {
+                       i = m_map.insert( key, Element() );
                ( *i ).value.set( CreationPolicy::construct( ( *i ).key ) );
-       }
+               }
        ( *i ).value.increment();
-       return ( *i );
+               return ( *i );
 }
 #endif
-void release( const Key& key ){
-       iterator i = m_map.find( key );
-       ASSERT_MESSAGE( i != m_map.end(), "releasing a non-existent object\n" );
-       release( i );
-}
+       void release( const Key& key ){
+               iterator i = m_map.find( key );
+               ASSERT_MESSAGE( i != m_map.end(), "releasing a non-existent object\n" );
+               release( i );
+       }
 
-void clear(){
-       m_map.clear();
-}
+       void clear(){
+               m_map.clear();
+       }
 };
 
 
index 0f174d20e87b813d27ac9cd983b161d0ffa54867..7fa7907ee6cefd6de693a75d6c10f0e65ab00e03 100644 (file)
@@ -28,7 +28,6 @@
 #include <memory>
 #include "debugging/debugging.h"
 
-
 namespace HashTableDetail
 {
 inline std::size_t next_power_of_two( std::size_t size ){
index c549a2f2072a9f3e72a62a6ebf5c2e49a94cc348..e05ff31b41ecd10b0a013652979e0ab000be1f52 100644 (file)
@@ -117,6 +117,7 @@ inline DebugMessageHandler& globalDebugMessageHandler(){
                if ( !globalDebugMessageHandler().handleMessage() ) { DEBUGGER_BREAKPOINT(); }} while ( 0 )
 
 #define ASSERT_NOTNULL( ptr ) ASSERT_MESSAGE( ptr != 0, "pointer \"" # ptr "\" is null" )
+#define ASSERT_TRUE( flag ) ASSERT_MESSAGE( !!(flag) == true, "condition \"" # flag "\" is false" )
 
 #else
 
index bba9ebe3434967f745066aa779cf3f9b89b96573..c00dcf605c87bf2fdf58445e599ae5f1f0fe165a 100644 (file)
@@ -25,8 +25,7 @@
 
 #include <map>
 #include <set>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkaccelgroup.h>
+#include <gtk/gtk.h>
 
 #include "generic/callback.h"
 #include "generic/bitfield.h"
@@ -240,7 +239,7 @@ bool Buttons_press( ButtonMask& buttons, guint button, guint state ){
                {
                        GtkWindow* toplevel = *i;
                        ASSERT_MESSAGE( window_has_accel( toplevel ), "ERROR" );
-                       ASSERT_MESSAGE( GTK_WIDGET_TOPLEVEL( toplevel ), "disabling accel for non-toplevel window" );
+                       ASSERT_MESSAGE( gtk_widget_is_toplevel( GTK_WIDGET(toplevel) ), "disabling accel for non-toplevel window" );
                        gtk_window_remove_accel_group( toplevel,  global_accel );
 #if 0
                        globalOutputStream() << reinterpret_cast<unsigned int>( toplevel ) << ": disabled global accelerators\n";
@@ -266,7 +265,7 @@ bool Buttons_release( ButtonMask& buttons, guint button, guint state ){
                {
                        GtkWindow* toplevel = *i;
                        ASSERT_MESSAGE( !window_has_accel( toplevel ), "ERROR" );
-                       ASSERT_MESSAGE( GTK_WIDGET_TOPLEVEL( toplevel ), "enabling accel for non-toplevel window" );
+                       ASSERT_MESSAGE( gtk_widget_is_toplevel( GTK_WIDGET(toplevel) ), "enabling accel for non-toplevel window" );
                        gtk_window_add_accel_group( toplevel, global_accel );
 #if 0
                        globalOutputStream() << reinterpret_cast<unsigned int>( toplevel ) << ": enabled global accelerators\n";
@@ -327,6 +326,7 @@ PressedButtons g_pressedButtons;
 
 
 #include <set>
+#include <uilib/uilib.h>
 
 struct PressedKeys
 {
@@ -484,7 +484,7 @@ void accel_group_remove_accelerator( GtkAccelGroup* group, Accelerator accelerat
 GtkAccelGroup* global_accel = 0;
 
 void global_accel_init(){
-       global_accel = gtk_accel_group_new();
+       global_accel = ui::AccelGroup();
 }
 
 void global_accel_destroy(){
index d1cd344e5e130c53cbc664a5d470d8f804cc2fd0..a02572e7985f363dd40fe5066225feb639386c5a 100644 (file)
@@ -22,9 +22,7 @@
 #if !defined( INCLUDED_GTKUTIL_ACCELERATOR_H )
 #define INCLUDED_GTKUTIL_ACCELERATOR_H
 
-#include <gdk/gdktypes.h>
-#include <gdk/gdkkeysyms.h>
-#include <gdk/gdkkeys.h>
+#include <gdk/gdk.h>
 
 #include "generic/callback.h"
 
index fc1e58d7bb955b4d06d9789a90b21b1a336275bf..08744ff485a39fc8406aefc565c8af4dee3e6b55 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "button.h"
 
-#include <gtk/gtkradiobutton.h>
+#include <gtk/gtk.h>
 
 #include "stream/textstream.h"
 #include "stream/stringstream.h"
@@ -42,6 +42,14 @@ void button_connect_callback( GtkButton* button, const Callback& callback ){
 #endif
 }
 
+void button_connect_callback( GtkToolButton* button, const Callback& callback ){
+#if 1
+       g_signal_connect_swapped( G_OBJECT( button ), "clicked", G_CALLBACK( callback.getThunk() ), callback.getEnvironment() );
+#else
+       g_signal_connect_closure( G_OBJECT( button ), "clicked", create_cclosure( G_CALLBACK( clicked_closure_callback ), callback ), FALSE );
+#endif
+}
+
 guint toggle_button_connect_callback( GtkToggleButton* button, const Callback& callback ){
 #if 1
        guint handler = g_signal_connect_swapped( G_OBJECT( button ), "toggled", G_CALLBACK( callback.getThunk() ), callback.getEnvironment() );
@@ -52,6 +60,16 @@ guint toggle_button_connect_callback( GtkToggleButton* button, const Callback& c
        return handler;
 }
 
+guint toggle_button_connect_callback( GtkToggleToolButton* button, const Callback& callback ){
+#if 1
+       guint handler = g_signal_connect_swapped( G_OBJECT( button ), "toggled", G_CALLBACK( callback.getThunk() ), callback.getEnvironment() );
+#else
+       guint handler = g_signal_connect_closure( G_OBJECT( button ), "toggled", create_cclosure( G_CALLBACK( clicked_closure_callback ), callback ), TRUE );
+#endif
+       g_object_set_data( G_OBJECT( button ), "handler", gint_to_pointer( handler ) );
+       return handler;
+}
+
 void button_set_icon( GtkButton* button, const char* icon ){
        GtkImage* image = new_local_image( icon );
        gtk_widget_show( GTK_WIDGET( image ) );
@@ -70,10 +88,17 @@ void toggle_button_set_active_no_signal( GtkToggleButton* button, gboolean activ
        g_signal_handler_unblock( G_OBJECT( button ), handler_id );
 }
 
+void toggle_button_set_active_no_signal( GtkToggleToolButton* button, gboolean active ){
+       guint handler_id = gpointer_to_int( g_object_get_data( G_OBJECT( button ), "handler" ) );
+       g_signal_handler_block( G_OBJECT( button ), handler_id );
+       gtk_toggle_tool_button_set_active( button, active );
+       g_signal_handler_unblock( G_OBJECT( button ), handler_id );
+}
+
 
 void radio_button_print_state( GtkRadioButton* button ){
        globalOutputStream() << "toggle button: ";
-       for ( GSList* radio = gtk_radio_button_group( button ); radio != 0; radio = g_slist_next( radio ) )
+       for ( GSList* radio = gtk_radio_button_get_group( button ); radio != 0; radio = g_slist_next( radio ) )
        {
                globalOutputStream() << gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radio->data ) );
        }
@@ -81,7 +106,7 @@ void radio_button_print_state( GtkRadioButton* button ){
 }
 
 GtkToggleButton* radio_button_get_nth( GtkRadioButton* radio, int index ){
-       GSList *group = gtk_radio_button_group( radio );
+       GSList *group = gtk_radio_button_get_group( radio );
        return GTK_TOGGLE_BUTTON( g_slist_nth_data( group, g_slist_length( group ) - index - 1 ) );
 }
 
@@ -109,7 +134,7 @@ void radio_button_set_active_no_signal( GtkRadioButton* radio, int index ){
 
 int radio_button_get_active( GtkRadioButton* radio ){
        //radio_button_print_state(radio);
-       GSList *group = gtk_radio_button_group( radio );
+       GSList *group = gtk_radio_button_get_group( radio );
        int index = g_slist_length( group ) - 1;
        for (; group != 0; group = g_slist_next( group ) )
        {
index 15a9f2e8cd4513d10894710d12a92ccf6f8e5a9e..1ffb025cdd06528d5a4730544f2b62d8982b87fc 100644 (file)
@@ -22,6 +22,7 @@
 #if !defined( INCLUDED_GTKUTIL_BUTTON_H )
 #define INCLUDED_GTKUTIL_BUTTON_H
 
+#include <gtk/gtk.h>
 #include "generic/callbackfwd.h"
 
 typedef struct _GtkButton GtkButton;
@@ -32,10 +33,13 @@ typedef gint gboolean;
 typedef unsigned int guint;
 
 void button_connect_callback( GtkButton* button, const Callback& callback );
+void button_connect_callback( GtkToolButton* button, const Callback& callback );
 guint toggle_button_connect_callback( GtkToggleButton* button, const Callback& callback );
+guint toggle_button_connect_callback( GtkToggleToolButton* button, const Callback& callback );
 
 void button_set_icon( GtkButton* button, const char* icon );
 void toggle_button_set_active_no_signal( GtkToggleButton* item, gboolean active );
+void toggle_button_set_active_no_signal( GtkToggleToolButton* item, gboolean active );
 
 void radio_button_set_active( GtkRadioButton* radio, int index );
 void radio_button_set_active_no_signal( GtkRadioButton* radio, int index );
index c8073aba478bf6922a77be881b769c4461544de9..2914875332eacc49cedae042efbe8e0f7a8f990a 100644 (file)
@@ -83,7 +83,7 @@ void clipboard_paste( ClipboardPasteFunc paste ){
 
 #else
 
-#include <gtk/gtkclipboard.h>
+#include <gtk/gtk.h>
 
 enum
 {
@@ -111,11 +111,11 @@ static void clipboard_clear( GtkClipboard *clipboard, gpointer data ){
 }
 
 static void clipboard_received( GtkClipboard *clipboard, GtkSelectionData *data, gpointer user_data ){
-       if ( data->length < 0 ) {
+       if ( gtk_selection_data_get_length(data) < 0 ) {
                globalErrorStream() << "Error retrieving selection\n";
        }
-       else if ( strcmp( gdk_atom_name( data->type ), clipboard_targets[0].target ) == 0 ) {
-               BufferInputStream istream( reinterpret_cast<const char*>( data->data ), data->length );
+       else if ( strcmp( gdk_atom_name( gtk_selection_data_get_data_type(data) ), clipboard_targets[0].target ) == 0 ) {
+               BufferInputStream istream( reinterpret_cast<const char*>( gtk_selection_data_get_data(data) ), gtk_selection_data_get_length(data) );
                ( *reinterpret_cast<ClipboardPasteFunc*>( user_data ) )( istream );
        }
 }
index b6b6afa4f43e1199e1e269ffd3bf7797bc272d86..e633d81c841ad7a03043b04b2486256b6efbd89a 100644 (file)
@@ -22,7 +22,7 @@
 #if !defined( INCLUDED_GTKUTIL_CONTAINER_H )
 #define INCLUDED_GTKUTIL_CONTAINER_H
 
-#include <gtk/gtkcontainer.h>
+#include <gtk/gtk.h>
 
 inline GtkWidget* container_add_widget( GtkContainer* container, GtkWidget* widget ){
        gtk_container_add( container, widget );
index f0538a5089963bad6a1c7f5279b2bce7c73c4daa..431f60fe80f86b2de88871367cdfedae2ffcb7b7 100644 (file)
 #include "stream/textstream.h"
 
 #include <string.h>
-#include <gdk/gdkcursor.h>
-#include <gdk/gdkpixmap.h>
+#include <gdk/gdk.h>
 
 
 GdkCursor* create_blank_cursor(){
-       GdkPixmap *pixmap;
-       GdkBitmap *mask;
-       char buffer [( 32 * 32 ) / 8];
-       memset( buffer, 0, ( 32 * 32 ) / 8 );
-       GdkColor white = {0, 0xffff, 0xffff, 0xffff};
-       GdkColor black = {0, 0x0000, 0x0000, 0x0000};
-       pixmap = gdk_bitmap_create_from_data( 0, buffer, 32, 32 );
-       mask   = gdk_bitmap_create_from_data( 0, buffer, 32, 32 );
-       GdkCursor *cursor = gdk_cursor_new_from_pixmap( pixmap, mask, &white, &black, 1, 1 );
-       gdk_drawable_unref( pixmap );
-       gdk_drawable_unref( mask );
-
-       return cursor;
+       return gdk_cursor_new(GDK_BLANK_CURSOR);
 }
 
 void blank_cursor( GtkWidget* widget ){
        GdkCursor* cursor = create_blank_cursor();
-       gdk_window_set_cursor( widget->window, cursor );
+       gdk_window_set_cursor( gtk_widget_get_window(widget), cursor );
        gdk_cursor_unref( cursor );
 }
 
 void default_cursor( GtkWidget* widget ){
-       gdk_window_set_cursor( widget->window, 0 );
+       gdk_window_set_cursor( gtk_widget_get_window(widget), 0 );
 }
 
 
index dfcc962c1d1d8ff1a02b3a9500c921b2023222d3..bf4f6ee887f7d53d19219df5622290af23ff39ca 100644 (file)
@@ -23,9 +23,7 @@
 #define INCLUDED_GTKUTIL_CURSOR_H
 
 #include <glib.h>
-#include <gdk/gdkevents.h>
-#include <gtk/gtkwidget.h>
-#include <gtk/gtkwindow.h>
+#include <gtk/gtk.h>
 
 #include "debugging/debugging.h"
 
@@ -157,7 +155,7 @@ void freeze_pointer( GtkWindow* window, MotionDeltaFunction function, void* data
 
        GdkCursor* cursor = create_blank_cursor();
        //GdkGrabStatus status =
-       gdk_pointer_grab( GTK_WIDGET( window )->window, TRUE, mask, 0, cursor, GDK_CURRENT_TIME );
+       gdk_pointer_grab( gtk_widget_get_window(GTK_WIDGET(window)), TRUE, mask, 0, cursor, GDK_CURRENT_TIME );
        gdk_cursor_unref( cursor );
 
        Sys_GetCursorPos( window, &recorded_x, &recorded_y );
index 59f5c5d9328161c359f4f37836eb38778c0fd7dd..fce53163ebf66f3f36896db3424b961447006265 100644 (file)
 
 #include "dialog.h"
 
-#include <gtk/gtkmain.h>
-#include <gtk/gtkalignment.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkradiobutton.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtklabel.h>
+#include <gtk/gtk.h>
 
 #include "button.h"
 #include "window.h"
 
 GtkVBox* create_dialog_vbox( int spacing, int border ){
-       GtkVBox* vbox = GTK_VBOX( gtk_vbox_new( FALSE, spacing ) );
+       GtkVBox* vbox = ui::VBox( FALSE, spacing );
        gtk_widget_show( GTK_WIDGET( vbox ) );
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), border );
        return vbox;
 }
 
 GtkHBox* create_dialog_hbox( int spacing, int border ){
-       GtkHBox* hbox = GTK_HBOX( gtk_hbox_new( FALSE, spacing ) );
+       GtkHBox* hbox = ui::HBox( FALSE, spacing );
        gtk_widget_show( GTK_WIDGET( hbox ) );
        gtk_container_set_border_width( GTK_CONTAINER( hbox ), border );
        return hbox;
 }
 
 GtkFrame* create_dialog_frame( const char* label, GtkShadowType shadow ){
-       GtkFrame* frame = GTK_FRAME( gtk_frame_new( label ) );
+       GtkFrame* frame = ui::Frame( label );
        gtk_widget_show( GTK_WIDGET( frame ) );
        gtk_frame_set_shadow_type( frame, shadow );
        return frame;
 }
 
 GtkTable* create_dialog_table( unsigned int rows, unsigned int columns, unsigned int row_spacing, unsigned int col_spacing, int border ){
-       GtkTable* table = GTK_TABLE( gtk_table_new( rows, columns, FALSE ) );
+       GtkTable* table = ui::Table( rows, columns, FALSE );
        gtk_widget_show( GTK_WIDGET( table ) );
        gtk_table_set_row_spacings( table, row_spacing );
        gtk_table_set_col_spacings( table, col_spacing );
@@ -66,7 +57,7 @@ GtkTable* create_dialog_table( unsigned int rows, unsigned int columns, unsigned
 }
 
 GtkButton* create_dialog_button( const char* label, GCallback func, gpointer data ){
-       GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( label ) );
+       GtkButton* button = ui::Button( label );
        gtk_widget_set_size_request( GTK_WIDGET( button ), 64, -1 );
        gtk_widget_show( GTK_WIDGET( button ) );
        g_signal_connect( G_OBJECT( button ), "clicked", func, data );
@@ -174,7 +165,7 @@ GtkWindow* create_simple_modal_dialog_window( const char* title, ModalDialog& di
 
        gtk_container_add( GTK_CONTAINER( vbox1 ), contents );
 
-       GtkAlignment* alignment = GTK_ALIGNMENT( gtk_alignment_new( 0.5, 0.0, 0.0, 0.0 ) );
+       ui::Alignment alignment = ui::Alignment( 0.5, 0.0, 0.0, 0.0 );
        gtk_widget_show( GTK_WIDGET( alignment ) );
        gtk_box_pack_start( GTK_BOX( vbox1 ), GTK_WIDGET( alignment ), FALSE, FALSE, 0 );
 
@@ -185,7 +176,7 @@ GtkWindow* create_simple_modal_dialog_window( const char* title, ModalDialog& di
 }
 
 RadioHBox RadioHBox_new( StringArrayRange names ){
-       GtkHBox* hbox = GTK_HBOX( gtk_hbox_new( TRUE, 4 ) );
+       GtkHBox* hbox = ui::HBox( TRUE, 4 );
        gtk_widget_show( GTK_WIDGET( hbox ) );
 
        GSList* group = 0;
@@ -204,21 +195,21 @@ RadioHBox RadioHBox_new( StringArrayRange names ){
 
 
 PathEntry PathEntry_new(){
-       GtkFrame* frame = GTK_FRAME( gtk_frame_new( NULL ) );
+       GtkFrame* frame = ui::Frame();
        gtk_widget_show( GTK_WIDGET( frame ) );
        gtk_frame_set_shadow_type( frame, GTK_SHADOW_IN );
 
        // path entry
-       GtkHBox* hbox = GTK_HBOX( gtk_hbox_new( FALSE, 0 ) );
+       GtkHBox* hbox = ui::HBox( FALSE, 0 );
        gtk_widget_show( GTK_WIDGET( hbox ) );
 
-       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+       GtkEntry* entry = ui::Entry();
        gtk_entry_set_has_frame( entry, FALSE );
        gtk_widget_show( GTK_WIDGET( entry ) );
        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
 
        // browse button
-       GtkButton* button = GTK_BUTTON( gtk_button_new() );
+       GtkButton* button = ui::Button();
        button_set_icon( button, "ellipsis.bmp" );
        gtk_widget_show( GTK_WIDGET( button ) );
        gtk_box_pack_end( GTK_BOX( hbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
@@ -245,8 +236,8 @@ BrowsedPathEntry::BrowsedPathEntry( const BrowseCallback& browse ) :
 
 
 GtkLabel* DialogLabel_new( const char* name ){
-       GtkLabel* label = GTK_LABEL( gtk_label_new( name ) );
-       gtk_widget_show( GTK_WIDGET( label ) );
+       ui::Label label = ui::Label( name );
+       gtk_widget_show(label);
        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
        gtk_label_set_justify( label, GTK_JUSTIFY_LEFT );
 
@@ -254,7 +245,7 @@ GtkLabel* DialogLabel_new( const char* name ){
 }
 
 GtkTable* DialogRow_new( const char* name, GtkWidget* widget ){
-       GtkTable* table = GTK_TABLE( gtk_table_new( 1, 3, TRUE ) );
+       GtkTable* table = ui::Table( 1, 3, TRUE );
        gtk_widget_show( GTK_WIDGET( table ) );
 
        gtk_table_set_col_spacings( table, 4 );
index 5a87731e1819ba0c2bd53fdb3770b6e8865c9319..b3e5017c5a9dcce1d9e726a724b6c90ed6e445c8 100644 (file)
@@ -25,7 +25,7 @@
 #include "generic/callback.h"
 #include "generic/arrayrange.h"
 #include "qerplugin.h"
-#include <gtk/gtkenums.h>
+#include <gtk/gtk.h>
 
 typedef int gint;
 typedef gint gboolean;
index 814be152bfd901791839b3224ce51acd91223b53..66beace123c47e6fe54be267ba24b6f1bb26797e 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <gtk/gtkentry.h>
+#include <gtk/gtk.h>
 
 inline void entry_set_string( GtkEntry* entry, const char* string ){
        gtk_entry_set_text( entry, string );
index d65d310ca567dc3eac3d47da95ccb6b946f37b56..a06c4c93e76b30cc21c9e9efa3782918a600a376 100644 (file)
 
 #include <list>
 #include <vector>
-#include <gtk/gtkwidget.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkfilechooser.h>
-#include <gtk/gtkfilechooserdialog.h>
-#include <gtk/gtkstock.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
 
 #include "string/string.h"
 #include "stream/stringstream.h"
@@ -243,7 +240,7 @@ const char* file_dialog_show( GtkWidget* parent, bool open, const char* title, c
        return g_file_dialog_file;
 }
 
-char* dir_dialog( GtkWidget* parent, const char* title, const char* path ){
+char* dir_dialog( ui::Widget parent, const char* title, const char* path ){
        GtkWidget* dialog = gtk_file_chooser_dialog_new( title,
                                                                                                         GTK_WINDOW( parent ),
                                                                                                         GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
@@ -268,7 +265,7 @@ char* dir_dialog( GtkWidget* parent, const char* title, const char* path ){
        return filename;
 }
 
-const char* file_dialog( GtkWidget* parent, bool open, const char* title, const char* path, const char* pattern, bool want_load, bool want_import, bool want_save ){
+const char* file_dialog( ui::Widget parent, bool open, const char* title, const char* path, const char* pattern, bool want_load, bool want_import, bool want_save ){
        for (;; )
        {
                const char* file = file_dialog_show( parent, open, title, path, pattern, want_load, want_import, want_save );
@@ -276,7 +273,7 @@ const char* file_dialog( GtkWidget* parent, bool open, const char* title, const
                if ( open
                         || file == 0
                         || !file_exists( file )
-                        || gtk_MessageBox( parent, "The file specified already exists.\nDo you want to replace it?", title, eMB_NOYES, eMB_ICONQUESTION ) == eIDYES ) {
+                        || parent.alert("The file specified already exists.\nDo you want to replace it?", title, ui::alert_type::NOYES, ui::alert_icon::Question ) == ui::alert_response::YES ) {
                        return file;
                }
        }
index f4610bea33b2661a03f89166781f901395b86b80..ae7c0b346d508892b8b16441ce2644d549b119dd 100644 (file)
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <uilib/uilib.h>
+
 #if !defined( INCLUDED_GTKUTIL_FILECHOOSER_H )
 #define INCLUDED_GTKUTIL_FILECHOOSER_H
 
 /// \file
 /// GTK+ file-chooser dialogs.
 
-typedef struct _GtkWidget GtkWidget;
-const char* file_dialog( GtkWidget *parent, bool open, const char* title, const char* path = 0, const char* pattern = 0, bool want_load = false, bool want_import = false, bool want_save = false );
+const char* file_dialog( ui::Widget parent, bool open, const char* title, const char* path = 0, const char* pattern = 0, bool want_load = false, bool want_import = false, bool want_save = false );
 
 
 /// \brief Prompts the user to browse for a directory.
 /// The prompt window will be transient to \p parent.
 /// The directory will initially default to \p path, which must be an absolute path.
 /// The returned string is allocated with \c g_malloc and must be freed with \c g_free.
-char* dir_dialog( GtkWidget *parent, const char* title = "Choose Directory", const char* path = "" );
+char* dir_dialog( ui::Widget parent, const char* title = "Choose Directory", const char* path = "" );
 
 #endif
index 8914fb707937980da8fa4984771c969ef0d02cdc..87f75f3654669309a02e80deb8ffe6db87c47fd3 100644 (file)
 
 #include "frame.h"
 
-#include <gtk/gtkframe.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
 
 GtkFrame* create_framed_widget( GtkWidget* widget ){
-       GtkFrame* frame = GTK_FRAME( gtk_frame_new( 0 ) );
+       GtkFrame* frame = ui::Frame();
        gtk_widget_show( GTK_WIDGET( frame ) );
        gtk_frame_set_shadow_type( frame, GTK_SHADOW_IN );
        gtk_container_add( GTK_CONTAINER( frame ), widget );
index 746b8f0f9202d34b92a8a0c079ff98591a0ff4e4..3f9b9a00ac1dc9ab1c3387d251734fe0313c1e7a 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "igl.h"
 
-#include <gtk/gtkdrawingarea.h>
+#include <gtk/gtk.h>
 #include <gtk/gtkglwidget.h>
 
 #include "pointer.h"
@@ -187,7 +187,7 @@ GtkWidget* g_shared = 0;
 gint glwidget_context_created( GtkWidget* widget, gpointer data ){
        if ( ++g_context_count == 1 ) {
                g_shared = widget;
-               gtk_widget_ref( g_shared );
+               g_object_ref( g_shared );
 
                glwidget_make_current( g_shared );
                GlobalOpenGL().contextValid = true;
@@ -203,7 +203,7 @@ gint glwidget_context_destroyed( GtkWidget* widget, gpointer data ){
 
                GLWidget_sharedContextDestroyed();
 
-               gtk_widget_unref( g_shared );
+               g_object_unref( g_shared );
                g_shared = 0;
        }
        return FALSE;
index b8cd7bef97fa1d958cf7eec2f55cea93b8db3324..961d2e73651db9808e2f9d0cc480b1e2bb6e9150 100644 (file)
@@ -21,8 +21,7 @@
 
 #include "image.h"
 
-#include <gtk/gtkimage.h>
-#include <gtk/gtkstock.h>
+#include <gtk/gtk.h>
 
 #include "string/string.h"
 #include "stream/stringstream.h"
@@ -46,7 +45,7 @@ GdkPixbuf* pixbuf_new_from_file_with_mask( const char* filename ){
        else
        {
                GdkPixbuf* rgba = gdk_pixbuf_add_alpha( rgb, FALSE, 255, 0, 255 );
-               gdk_pixbuf_unref( rgb );
+               g_object_unref( rgb );
                return rgba;
        }
 }
@@ -59,7 +58,7 @@ GtkImage* image_new_from_file_with_mask( const char* filename ){
        else
        {
                GtkImage* image = GTK_IMAGE( gtk_image_new_from_pixbuf( rgba ) );
-               gdk_pixbuf_unref( rgba );
+               g_object_unref( rgba );
                return image;
        }
 }
index cbb07df8fef5518fbee2238258c9c05cb9b1d451..7ef18911942a0aec9b3d6ec410d52fe69b9227d3 100644 (file)
 #include "menu.h"
 
 #include <ctype.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkmenubar.h>
-#include <gtk/gtkradiomenuitem.h>
-#include <gtk/gtktearoffmenuitem.h>
-#include <gtk/gtkaccellabel.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
+#include <debugging/debugging.h>
 
 #include "generic/callback.h"
 
@@ -56,10 +54,10 @@ GtkTearoffMenuItem* menu_tearoff( GtkMenu* menu ){
 }
 
 GtkMenuItem* new_sub_menu_item_with_mnemonic( const char* mnemonic ){
-       GtkMenuItem* item = GTK_MENU_ITEM( gtk_menu_item_new_with_mnemonic( mnemonic ) );
+       GtkMenuItem* item = ui::MenuItem( mnemonic, true );
        gtk_widget_show( GTK_WIDGET( item ) );
 
-       GtkWidget* sub_menu = gtk_menu_new();
+       GtkWidget* sub_menu = ui::Menu();
        gtk_menu_item_set_submenu( item, sub_menu );
 
        return item;
@@ -102,7 +100,7 @@ guint check_menu_item_connect_callback( GtkCheckMenuItem* item, const Callback&
 }
 
 GtkMenuItem* new_menu_item_with_mnemonic( const char *mnemonic, const Callback& callback ){
-       GtkMenuItem* item = GTK_MENU_ITEM( gtk_menu_item_new_with_mnemonic( mnemonic ) );
+       GtkMenuItem* item = ui::MenuItem( mnemonic, true );
        gtk_widget_show( GTK_WIDGET( item ) );
        menu_item_connect_callback( item, callback );
        return item;
@@ -130,9 +128,9 @@ GtkCheckMenuItem* create_check_menu_item_with_mnemonic( GtkMenu* menu, const cha
 GtkRadioMenuItem* new_radio_menu_item_with_mnemonic( GSList** group, const char* mnemonic, const Callback& callback ){
        GtkRadioMenuItem* item = GTK_RADIO_MENU_ITEM( gtk_radio_menu_item_new_with_mnemonic( *group, mnemonic ) );
        if ( *group == 0 ) {
-               gtk_check_menu_item_set_state( GTK_CHECK_MENU_ITEM( item ), TRUE );
+               gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), TRUE );
        }
-       *group = gtk_radio_menu_item_group( item );
+       *group = gtk_radio_menu_item_get_group( item );
        gtk_widget_show( GTK_WIDGET( item ) );
        check_menu_item_connect_callback( GTK_CHECK_MENU_ITEM( item ), callback );
        return item;
@@ -226,38 +224,11 @@ void accelerator_name( const Accelerator& accelerator, GString* gstring ){
        }
 }
 
-void menu_item_set_accelerator( GtkMenuItem* item, Accelerator accelerator ){
-       GtkAccelLabel* accel_label = GTK_ACCEL_LABEL( gtk_bin_get_child( GTK_BIN( item ) ) );
-
-       g_free( accel_label->accel_string );
-       accel_label->accel_string = 0;
-
-       GString* gstring = g_string_new( accel_label->accel_string );
-       g_string_append( gstring, "   " );
-
-       accelerator_name( accelerator, gstring );
-
-       g_free( accel_label->accel_string );
-       accel_label->accel_string = gstring->str;
-       g_string_free( gstring, FALSE );
-
-       if ( !accel_label->accel_string ) {
-               accel_label->accel_string = g_strdup( "" );
-       }
-
-       gtk_widget_queue_resize( GTK_WIDGET( accel_label ) );
-}
-
 void menu_item_add_accelerator( GtkMenuItem* item, Accelerator accelerator ){
        if ( accelerator.key != 0 ) {
                GClosure* closure = global_accel_group_find( accelerator );
-               if ( closure != 0 ) {
-                       menu_item_set_accelerator( item, closure );
-               }
-               else
-               {
-                       menu_item_set_accelerator( item, accelerator );
-               }
+               ASSERT_NOTNULL(closure);
+               menu_item_set_accelerator( item, closure );
        }
 }
 
index 8f9fb7fa02a812442f398b4927b0e70b6e8f6275..2ae955c72fe9423a332dcdc1c789a246606f85c2 100644 (file)
 #include "messagebox.h"
 
 #include <gdk/gdkkeysyms.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkalignment.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtkstock.h>
+#include <gtk/gtk.h>
 
 #include "dialog.h"
 #include "widget.h"
 
 GtkWidget* create_padding( int width, int height ){
-       GtkWidget* widget = gtk_alignment_new( 0.0, 0.0, 0.0, 0.0 );
+       ui::Alignment widget = ui::Alignment( 0.0, 0.0, 0.0, 0.0 );
        gtk_widget_show( widget );
        gtk_widget_set_size_request( widget, width, height );
        return widget;
@@ -59,14 +51,14 @@ const char* messagebox_stock_icon( EMessageBoxIcon type ){
        }
 }
 
-EMessageBoxReturn gtk_MessageBox( GtkWidget *parent, const char* text, const char* title, EMessageBoxType type, EMessageBoxIcon icon ){
+EMessageBoxReturn gtk_MessageBox( ui::Widget parent, const char* text, const char* title, EMessageBoxType type, EMessageBoxIcon icon ){
        ModalDialog dialog;
        ModalDialogButton ok_button( dialog, eIDOK );
        ModalDialogButton cancel_button( dialog, eIDCANCEL );
        ModalDialogButton yes_button( dialog, eIDYES );
        ModalDialogButton no_button( dialog, eIDNO );
 
-       GtkWindow* parentWindow = parent != 0 ? GTK_WINDOW( parent ) : 0;
+       GtkWindow* parentWindow = parent ? GTK_WINDOW( parent ) : 0;
 
        GtkWindow* window = create_fixedsize_modal_dialog_window( parentWindow, title, dialog, 400, 100 );
 
@@ -75,7 +67,7 @@ EMessageBoxReturn gtk_MessageBox( GtkWidget *parent, const char* text, const cha
                gtk_window_deiconify( parentWindow );
        }
 
-       GtkAccelGroup* accel = gtk_accel_group_new();
+       GtkAccelGroup* accel = ui::AccelGroup();
        gtk_window_add_accel_group( window, accel );
 
        GtkVBox* vbox = create_dialog_vbox( 8, 8 );
@@ -94,7 +86,7 @@ EMessageBoxReturn gtk_MessageBox( GtkWidget *parent, const char* text, const cha
        gtk_widget_show( GTK_WIDGET( image ) );
        gtk_box_pack_start( GTK_BOX( iconBox ), GTK_WIDGET( image ), FALSE, FALSE, 0 );
 
-       GtkLabel* label = GTK_LABEL( gtk_label_new( text ) );
+       GtkLabel* label = GTK_LABEL( ui::Label( text ) );
        gtk_widget_show( GTK_WIDGET( label ) );
        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
        gtk_label_set_justify( label, GTK_JUSTIFY_LEFT );
@@ -105,7 +97,7 @@ EMessageBoxReturn gtk_MessageBox( GtkWidget *parent, const char* text, const cha
        GtkVBox* vboxDummy = create_dialog_vbox( 0, 0 );
        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( vboxDummy ), FALSE, FALSE, 0 );
 
-       GtkAlignment* alignment = GTK_ALIGNMENT( gtk_alignment_new( 0.5, 0.0, 0.0, 0.0 ) );
+       GtkAlignment* alignment = ui::Alignment( 0.5, 0.0, 0.0, 0.0 );
        gtk_widget_show( GTK_WIDGET( alignment ) );
        gtk_box_pack_start( GTK_BOX( vboxDummy ), GTK_WIDGET( alignment ), FALSE, FALSE, 0 );
 
index 8bdc0ba2e6fb63848262e96b5d6b5448ceb2b727..699399393c08c5b9e7d580d2acf14fe1365b0a56 100644 (file)
@@ -24,8 +24,7 @@
 
 #include "qerplugin.h"
 
-typedef struct _GtkWidget GtkWidget;
 /// \brief Shows a modal message-box.
-EMessageBoxReturn gtk_MessageBox( GtkWidget *parent, const char* text, const char* title = "NetRadiant", EMessageBoxType type = eMB_OK, EMessageBoxIcon icon = eMB_ICONDEFAULT );
+EMessageBoxReturn gtk_MessageBox( ui::Widget parent, const char* text, const char* title = "NetRadiant", EMessageBoxType type = eMB_OK, EMessageBoxIcon icon = eMB_ICONDEFAULT );
 
 #endif
index 864779bd1603e8a6912723dacffb426a9ca15a23..4baf54b54fb6b5e704d2bdf420141e325a61d4cf 100644 (file)
@@ -22,9 +22,7 @@
 #if !defined( INCLUDED_GTKUTIL_NONMODAL_H )
 #define INCLUDED_GTKUTIL_NONMODAL_H
 
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkspinbutton.h>
-#include <gtk/gtkradiobutton.h>
+#include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 
 #include "generic/callback.h"
@@ -36,7 +34,7 @@ typedef struct _GtkEntry GtkEntry;
 
 
 inline gboolean escape_clear_focus_widget( GtkWidget* widget, GdkEventKey* event, gpointer data ){
-       if ( event->keyval == GDK_Escape ) {
+       if ( event->keyval == GDK_KEY_Escape ) {
                gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), NULL );
                return TRUE;
        }
@@ -60,7 +58,7 @@ static gboolean focus_in( GtkEntry* entry, GdkEventFocus *event, NonModalEntry*
 }
 
 static gboolean focus_out( GtkEntry* entry, GdkEventFocus *event, NonModalEntry* self ){
-       if ( self->m_editing && GTK_WIDGET_VISIBLE( entry ) ) {
+       if ( self->m_editing && gtk_widget_get_visible( GTK_WIDGET(entry) ) ) {
                self->m_apply();
        }
        self->m_editing = false;
@@ -152,7 +150,7 @@ public:
 NonModalRadio( const Callback& changed ) : m_changed( changed ){
 }
 void connect( GtkRadioButton* radio ){
-       GSList* group = gtk_radio_button_group( radio );
+       GSList* group = gtk_radio_button_get_group( radio );
        for (; group != 0; group = g_slist_next( group ) )
        {
                toggle_button_connect_callback( GTK_TOGGLE_BUTTON( group->data ), m_changed );
index c5adc09cd7ce71b1e28932d1790fb007af0bf740..446a8bb4f2d409984cbf79101d29bda5402ebaef 100644 (file)
@@ -21,8 +21,8 @@
 
 #include "paned.h"
 
-#include <gtk/gtkhpaned.h>
-#include <gtk/gtkvpaned.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
 
 #include "frame.h"
 
@@ -62,14 +62,14 @@ PanedState g_vpaned1 = { 0.5f, -1, };
 PanedState g_vpaned2 = { 0.5f, -1, };
 
 GtkHPaned* create_split_views( GtkWidget* topleft, GtkWidget* topright, GtkWidget* botleft, GtkWidget* botright ){
-       GtkHPaned* hsplit = GTK_HPANED( gtk_hpaned_new() );
+       GtkHPaned* hsplit = ui::HPaned();
        gtk_widget_show( GTK_WIDGET( hsplit ) );
 
        g_signal_connect( G_OBJECT( hsplit ), "size_allocate", G_CALLBACK( hpaned_allocate ), &g_hpaned );
        g_signal_connect( G_OBJECT( hsplit ), "notify::position", G_CALLBACK( paned_position ), &g_hpaned );
 
        {
-               GtkVPaned* vsplit = GTK_VPANED( gtk_vpaned_new() );
+               GtkVPaned* vsplit = ui::VPaned();
                gtk_paned_add1( GTK_PANED( hsplit ), GTK_WIDGET( vsplit ) );
                gtk_widget_show( GTK_WIDGET( vsplit ) );
 
@@ -80,7 +80,7 @@ GtkHPaned* create_split_views( GtkWidget* topleft, GtkWidget* topright, GtkWidge
                gtk_paned_add2( GTK_PANED( vsplit ), GTK_WIDGET( create_framed_widget( topright ) ) );
        }
        {
-               GtkVPaned* vsplit = GTK_VPANED( gtk_vpaned_new() );
+               GtkVPaned* vsplit = ui::VPaned();
                gtk_paned_add2( GTK_PANED( hsplit ), GTK_WIDGET( vsplit ) );
                gtk_widget_show( GTK_WIDGET( vsplit ) );
 
index 3ac74f610451be6cd95ddb7795059774f42c7f7d..c06594012b523a1900ca41a1893a869bc2401648 100644 (file)
 
 #include "toolbar.h"
 
-#include <gtk/gtktoolbar.h>
-#include <gtk/gtktogglebutton.h>
+#include <uilib/uilib.h>
 
 #include "generic/callback.h"
 
 #include "accelerator.h"
 #include "button.h"
-#include "closure.h"
-#include "pointer.h"
+#include "image.h"
 
 
-void toolbar_append( GtkToolbar* toolbar, GtkButton* button, const char* description ){
-       gtk_widget_show( GTK_WIDGET( button ) );
-       gtk_button_set_relief( button, GTK_RELIEF_NONE );
-       GTK_WIDGET_UNSET_FLAGS( GTK_WIDGET( button ), GTK_CAN_FOCUS );
-       GTK_WIDGET_UNSET_FLAGS( GTK_WIDGET( button ), GTK_CAN_DEFAULT );
-       gtk_toolbar_append_element( toolbar, GTK_TOOLBAR_CHILD_WIDGET, GTK_WIDGET( button ), "", description, "", 0, 0, 0 );
+void toolbar_append( GtkToolbar* toolbar, GtkToolItem* button, const char* description ){
+       gtk_widget_show_all(GTK_WIDGET(button));
+       gtk_widget_set_tooltip_text(GTK_WIDGET(button), description);
+       gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button));
 }
 
-GtkButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const Callback& callback ){
-       GtkButton* button = GTK_BUTTON( gtk_button_new() );
-       button_set_icon( button, icon );
-       button_connect_callback( button, callback );
-       toolbar_append( toolbar, button, description );
+GtkToolButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const Callback& callback ){
+       auto button = GTK_TOOL_BUTTON(gtk_tool_button_new(GTK_WIDGET(new_local_image(icon)), nullptr));
+       button_connect_callback(button, callback);
+       toolbar_append(toolbar, GTK_TOOL_ITEM(button), description);
        return button;
 }
 
-GtkToggleButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const Callback& callback ){
-       GtkToggleButton* button = GTK_TOGGLE_BUTTON( gtk_toggle_button_new() );
-       button_set_icon( GTK_BUTTON( button ), icon );
-       toggle_button_connect_callback( button, callback );
-       toolbar_append( toolbar, GTK_BUTTON( button ), description );
+GtkToggleToolButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const Callback& callback ){
+       auto button = GTK_TOGGLE_TOOL_BUTTON(gtk_toggle_tool_button_new());
+       toggle_button_connect_callback(button, callback);
+       gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(button), GTK_WIDGET(new_local_image(icon)));
+       gtk_tool_button_set_label(GTK_TOOL_BUTTON(button), description);
+       toolbar_append(toolbar, GTK_TOOL_ITEM(button), description);
        return button;
 }
 
-GtkButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const Command& command ){
+GtkToolButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const Command& command ){
        return toolbar_append_button( toolbar, description, icon, command.m_callback );
 }
 
-void toggle_button_set_active_callback( GtkToggleButton& button, bool active ){
+void toggle_button_set_active_callback( GtkToggleToolButton& button, bool active ){
        toggle_button_set_active_no_signal( &button, active );
 }
-typedef ReferenceCaller1<GtkToggleButton, bool, toggle_button_set_active_callback> ToggleButtonSetActiveCaller;
+using ToggleButtonSetActiveCaller = ReferenceCaller1<GtkToggleToolButton, bool, toggle_button_set_active_callback>;
 
-GtkToggleButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const Toggle& toggle ){
-       GtkToggleButton* button = toolbar_append_toggle_button( toolbar, description, icon, toggle.m_command.m_callback );
+GtkToggleToolButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const Toggle& toggle ){
+       auto button = toolbar_append_toggle_button( toolbar, description, icon, toggle.m_command.m_callback );
        toggle.m_exportCallback( ToggleButtonSetActiveCaller( *button ) );
        return button;
 }
index 6b9e32fb71f118c377bf5393a72e7db32646fcee..687fa0a3beb6f1179ef4e848409567bbc47e3379 100644 (file)
@@ -22,6 +22,7 @@
 #if !defined( INCLUDED_GTKUTIL_TOOLBAR_H )
 #define INCLUDED_GTKUTIL_TOOLBAR_H
 
+#include <gtk/gtk.h>
 #include "generic/callbackfwd.h"
 
 typedef struct _GtkButton GtkButton;
@@ -30,9 +31,9 @@ typedef struct _GtkToolbar GtkToolbar;
 class Command;
 class Toggle;
 
-GtkButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const Callback& callback );
-GtkButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const Command& command );
-GtkToggleButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const Callback& callback );
-GtkToggleButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const Toggle& toggle );
+GtkToolButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const Callback& callback );
+GtkToolButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const Command& command );
+GtkToggleToolButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const Callback& callback );
+GtkToggleToolButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const Toggle& toggle );
 
 #endif
index ceb92409f8bf9c6553fdc193812ca3b41f43ecdf..bf84eef0fd644f23f1ce85833577a37f0f722788 100644 (file)
@@ -23,7 +23,7 @@
 #define INCLUDED_GTKUTIL_WIDGET_H
 
 #include <list>
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
 #include "generic/callback.h"
 #include "warnings.h"
 #include "debugging/debugging.h"
@@ -39,7 +39,7 @@ inline void widget_set_visible( GtkWidget* widget, bool shown ){
 }
 
 inline bool widget_is_visible( GtkWidget* widget ){
-       return GTK_WIDGET_VISIBLE( widget ) != FALSE;
+       return gtk_widget_get_visible( widget ) != FALSE;
 }
 
 inline void widget_toggle_visible( GtkWidget* widget ){
@@ -81,7 +81,7 @@ static gboolean notify_visible( GtkWidget* widget, gpointer dummy, ToggleShown*
        return FALSE;
 }
 static gboolean destroy( GtkWidget* widget, ToggleShown* self ){
-       self->m_shownDeferred = GTK_WIDGET_VISIBLE( self->m_widget ) != FALSE;
+       self->m_shownDeferred = gtk_widget_get_visible( self->m_widget ) != FALSE;
        self->m_widget = 0;
        return FALSE;
 }
@@ -101,7 +101,7 @@ bool active() const {
        }
        else
        {
-               return GTK_WIDGET_VISIBLE( m_widget ) != FALSE;
+               return gtk_widget_get_visible( m_widget ) != FALSE;
        }
 }
 void exportActive( const BoolImportCallback& importCallback ){
@@ -138,7 +138,7 @@ typedef ReferenceCaller<GtkWidget, widget_queue_draw> WidgetQueueDrawCaller;
 
 
 inline void widget_make_default( GtkWidget* widget ){
-       GTK_WIDGET_SET_FLAGS( widget, GTK_CAN_DEFAULT );
+       gtk_widget_set_can_default( widget, true );
        gtk_widget_grab_default( widget );
 }
 
index 48b174b37a6c24baf7b9e17f313cb6987d248aca..07e04e5672905052c4d6f6d985db659133ddbd98 100644 (file)
@@ -21,7 +21,8 @@
 
 #include "window.h"
 
-#include <gtk/gtkscrolledwindow.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
 
 #include "pointer.h"
 #include "accelerator.h"
@@ -33,7 +34,7 @@ inline void CHECK_RESTORE( GtkWidget* w ){
 }
 
 inline void CHECK_MINIMIZE( GtkWidget* w ){
-       g_object_set_data( G_OBJECT( w ), "was_mapped", gint_to_pointer( GTK_WIDGET_VISIBLE( w ) ) );
+       g_object_set_data( G_OBJECT( w ), "was_mapped", gint_to_pointer( gtk_widget_get_visible( w ) ) );
        gtk_widget_hide( w );
 }
 
@@ -82,7 +83,7 @@ guint connect_floating_window_destroy_present( GtkWindow* floating, GtkWindow* m
 }
 
 GtkWindow* create_floating_window( const char* title, GtkWindow* parent ){
-       GtkWindow* window = GTK_WINDOW( gtk_window_new( GTK_WINDOW_TOPLEVEL ) );
+       GtkWindow* window = ui::Window( ui::window_type::TOP );
        gtk_window_set_title( window, title );
 
        if ( parent != 0 ) {
@@ -100,7 +101,7 @@ void destroy_floating_window( GtkWindow* window ){
 }
 
 gint window_realize_remove_sysmenu( GtkWidget* widget, gpointer data ){
-       gdk_window_set_decorations( widget->window, (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MENU ) );
+       gdk_window_set_decorations( gtk_widget_get_window(widget), (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MENU ) );
        return FALSE;
 }
 
@@ -127,7 +128,7 @@ GtkWindow* create_persistent_floating_window( const char* title, GtkWindow* main
 }
 
 gint window_realize_remove_minmax( GtkWidget* widget, gpointer data ){
-       gdk_window_set_decorations( widget->window, (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE ) );
+       gdk_window_set_decorations( gtk_widget_get_window(widget), (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE ) );
        return FALSE;
 }
 
@@ -137,7 +138,7 @@ void window_remove_minmax( GtkWindow* window ){
 
 
 GtkScrolledWindow* create_scrolled_window( GtkPolicyType hscrollbar_policy, GtkPolicyType vscrollbar_policy, int border ){
-       GtkScrolledWindow* scr = GTK_SCROLLED_WINDOW( gtk_scrolled_window_new( 0, 0 ) );
+       GtkScrolledWindow* scr = ui::ScrolledWindow();
        gtk_widget_show( GTK_WIDGET( scr ) );
        gtk_scrolled_window_set_policy( scr, hscrollbar_policy, vscrollbar_policy );
        gtk_scrolled_window_set_shadow_type( scr, GTK_SHADOW_IN );
index 1a7161e6dfd34d1b32c63889d86002995b7ac4c6..96b9be00fdf0d567fcc2aced266ccd717d4cda1a 100644 (file)
@@ -22,7 +22,7 @@
 #if !defined( INCLUDED_GTKUTIL_WINDOW_H )
 #define INCLUDED_GTKUTIL_WINDOW_H
 
-#include <gtk/gtkwindow.h>
+#include <gtk/gtk.h>
 
 #include "debugging/debugging.h"
 #include "generic/callback.h"
index 6c4d64fcc081906b38b380ba2693919a58c48262..6c6abdf531c6512eed6e5792b9afc1c27366a69f 100644 (file)
@@ -22,7 +22,8 @@
 #if !defined ( INCLUDED_XORRECTANGLE_H )
 #define INCLUDED_XORRECTANGLE_H
 
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
 #include "math/vector.h"
 
 class rectangle_t
@@ -64,23 +65,14 @@ class XORRectangle
 rectangle_t m_rectangle;
 
 GtkWidget* m_widget;
-GdkGC* m_gc;
+cairo_t *cr;
 
 bool initialised() const {
-       return m_gc != 0;
+       return cr != nullptr;
 }
 void lazy_init(){
        if ( !initialised() ) {
-               m_gc = gdk_gc_new( m_widget->window );
-
-               GdkColor color = { 0, 0xffff, 0xffff, 0xffff, };
-               GdkColormap* colormap = gdk_window_get_colormap( m_widget->window );
-               gdk_colormap_alloc_color( colormap, &color, FALSE, TRUE );
-               gdk_gc_copy( m_gc, m_widget->style->white_gc );
-               gdk_gc_set_foreground( m_gc, &color );
-               gdk_gc_set_background( m_gc, &color );
-
-               gdk_gc_set_function( m_gc, GDK_INVERT );
+               cr = gdk_cairo_create(gtk_widget_get_window(m_widget));
        }
 }
 void draw() const {
@@ -88,19 +80,24 @@ void draw() const {
        const int y = float_to_integer( m_rectangle.y );
        const int w = float_to_integer( m_rectangle.w );
        const int h = float_to_integer( m_rectangle.h );
-       gdk_draw_rectangle( m_widget->window, m_gc, FALSE, x, -( h ) - ( y - m_widget->allocation.height ), w, h );
+       GtkAllocation allocation;
+       gtk_widget_get_allocation(m_widget, &allocation);
+       cairo_rectangle(cr, x, -(h) - (y - allocation.height), w, h);
+       cairo_set_source_rgb(cr, 1, 1, 1);
+       cairo_set_operator(cr, CAIRO_OPERATOR_DIFFERENCE);
+       cairo_stroke(cr);
 }
 
 public:
-XORRectangle( GtkWidget* widget ) : m_widget( widget ), m_gc( 0 ){
+XORRectangle( ui::Widget widget ) : m_widget( widget ), cr( 0 ) {
 }
 ~XORRectangle(){
        if ( initialised() ) {
-               gdk_gc_unref( m_gc );
+               cairo_destroy(cr);
        }
 }
 void set( rectangle_t rectangle ){
-       if ( GTK_WIDGET_REALIZED( m_widget ) ) {
+       if ( gtk_widget_get_realized( m_widget ) ) {
                lazy_init();
                draw();
                m_rectangle = rectangle;
index abea5a055daba31330d14efed3e0d28dab2bb808..7cd84f975d9153807ac9cf9ef2a258f45842f28d 100644 (file)
 class ModuleRegisterable
 {
 public:
-virtual void selfRegister() = 0;
+       virtual void selfRegister() = 0;
 };
 
 class ModuleRegistryList
 {
-typedef std::list<ModuleRegisterable*> RegisterableModules;
-RegisterableModules m_modules;
+       typedef std::list<ModuleRegisterable*> RegisterableModules;
+       RegisterableModules m_modules;
 public:
-void addModule( ModuleRegisterable& module ){
-       m_modules.push_back( &module );
-}
-void registerModules() const {
-       for ( RegisterableModules::const_iterator i = m_modules.begin(); i != m_modules.end(); ++i )
-       {
-               ( *i )->selfRegister();
+       void addModule( ModuleRegisterable& module ){
+               m_modules.push_back( &module );
+       }
+       void registerModules() const {
+               for ( RegisterableModules::const_iterator i = m_modules.begin(); i != m_modules.end(); ++i )
+               {
+                       ( *i )->selfRegister();
+               }
        }
-}
 };
 
 typedef SmartStatic<ModuleRegistryList> StaticModuleRegistryList;
@@ -53,9 +53,9 @@ typedef SmartStatic<ModuleRegistryList> StaticModuleRegistryList;
 class StaticRegisterModule : public StaticModuleRegistryList
 {
 public:
-StaticRegisterModule( ModuleRegisterable& module ){
-       StaticModuleRegistryList::instance().addModule( module );
-}
+       StaticRegisterModule( ModuleRegisterable& module ){
+               StaticModuleRegistryList::instance().addModule( module );
+       }
 };
 
 
index 6dd9c52a62c2cfdf8e2b32cd14393bf6bd90665e..8dcd88de17c708c82161abbd78052e0c1f68874b 100644 (file)
@@ -88,7 +88,7 @@ explicit SingletonModule( const APIConstructor& constructor )
 
 void selfRegister(){
        globalModuleServer().registerModule( typename Type::Name(), typename Type::Version(), APIConstructor::getName(), *this );
-}
+       }
 
 Dependencies& getDependencies(){
        return *m_dependencies;
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..eb49165a8969a7834150db2929ef0eb3c6de289e 100644 (file)
@@ -0,0 +1,205 @@
+#include "uilib.h"
+
+#include <tuple>
+
+#include <gtk/gtk.h>
+
+#include "gtkutil/dialog.h"
+#include "gtkutil/filechooser.h"
+#include "gtkutil/messagebox.h"
+#include "gtkutil/window.h"
+
+namespace ui {
+
+    void init(int argc, char *argv[])
+    {
+        gtk_disable_setlocale();
+        gtk_init(&argc, &argv);
+    }
+
+    void main()
+    {
+        gtk_main();
+    }
+
+    Widget root;
+
+    alert_response Widget::alert(std::string text, std::string title, alert_type type, alert_icon icon)
+    {
+        auto ret = gtk_MessageBox(*this, text.c_str(),
+                                  title.c_str(),
+                                  type == alert_type::OK ? eMB_OK :
+                                  type == alert_type::OKCANCEL ? eMB_OKCANCEL :
+                                  type == alert_type::YESNO ? eMB_YESNO :
+                                  type == alert_type::YESNOCANCEL ? eMB_YESNOCANCEL :
+                                  type == alert_type::NOYES ? eMB_NOYES :
+                                  eMB_OK,
+                                  icon == alert_icon::Default ? eMB_ICONDEFAULT :
+                                  icon == alert_icon::Error ? eMB_ICONERROR :
+                                  icon == alert_icon::Warning ? eMB_ICONWARNING :
+                                  icon == alert_icon::Question ? eMB_ICONQUESTION :
+                                  icon == alert_icon::Asterisk ? eMB_ICONASTERISK :
+                                  eMB_ICONDEFAULT
+        );
+        return
+                ret == eIDOK ? alert_response::OK :
+                ret == eIDCANCEL ? alert_response::CANCEL :
+                ret == eIDYES ? alert_response::YES :
+                ret == eIDNO ? alert_response::NO :
+                alert_response::OK;
+    }
+
+    const char *Widget::file_dialog(bool open, const char *title, const char *path,
+                                    const char *pattern, bool want_load, bool want_import,
+                                    bool want_save)
+    {
+        return ::file_dialog(*this, open, title, path, pattern, want_load, want_import, want_save);
+    }
+
+    Window::Window(window_type type)
+            : Window(GTK_WINDOW(gtk_window_new(
+            type == window_type::TOP ? GTK_WINDOW_TOPLEVEL :
+            type == window_type::POPUP ? GTK_WINDOW_POPUP :
+            GTK_WINDOW_TOPLEVEL)))
+    { };
+
+    Window Window::create_dialog_window(const char *title, void func(), void *data, int default_w, int default_h)
+    {
+        return Window(::create_dialog_window(*this, title, func, data, default_w, default_h));
+    }
+
+    Window Window::create_modal_dialog_window(const char *title, ui_modal &dialog, int default_w, int default_h)
+    {
+        return Window(::create_modal_dialog_window(*this, title, dialog, default_w, default_h));
+    }
+
+    Window Window::create_floating_window(const char *title)
+    {
+        return Window(::create_floating_window(title, *this));
+    }
+
+    std::uint64_t Window::on_key_press(bool (*f)(Widget widget, ui_evkey *event, void *extra), void *extra)
+    {
+        using f_t = decltype(f);
+        struct user_data {
+            f_t f;
+            void *extra;
+        } *pass = new user_data{f, extra};
+        auto dtor = [](user_data *data, GClosure *) {
+            delete data;
+        };
+        auto func = [](ui_widget *widget, GdkEventKey *event, user_data *args) -> bool {
+            return args->f(Widget(widget), event, args->extra);
+        };
+        auto clos = g_cclosure_new(G_CALLBACK(+func), pass, reinterpret_cast<GClosureNotify>(+dtor));
+        return g_signal_connect_closure(G_OBJECT(*this), "key-press-event", clos, false);
+    }
+
+    AccelGroup::AccelGroup() : AccelGroup(GTK_ACCEL_GROUP(gtk_accel_group_new()))
+    { }
+
+    Adjustment::Adjustment(double value,
+                           double lower, double upper,
+                           double step_increment, double page_increment,
+                           double page_size)
+            : Adjustment(
+            GTK_ADJUSTMENT(gtk_adjustment_new(value, lower, upper, step_increment, page_increment, page_size)))
+    { }
+
+    Alignment::Alignment(float xalign, float yalign, float xscale, float yscale)
+            : Alignment(GTK_ALIGNMENT(gtk_alignment_new(xalign, yalign, xscale, yscale)))
+    { }
+
+    Button::Button() : Button(GTK_BUTTON(gtk_button_new()))
+    { }
+
+    Button::Button(const char *label) : Button(GTK_BUTTON(gtk_button_new_with_label(label)))
+    { }
+
+    CellRendererText::CellRendererText() : CellRendererText(GTK_CELL_RENDERER_TEXT(gtk_cell_renderer_text_new()))
+    { }
+
+    ComboBoxText::ComboBoxText() : ComboBoxText(GTK_COMBO_BOX_TEXT(gtk_combo_box_text_new()))
+    { }
+
+    CheckButton::CheckButton(const char *label) : CheckButton(GTK_CHECK_BUTTON(gtk_check_button_new_with_label(label)))
+    { }
+
+    Entry::Entry() : Entry(GTK_ENTRY(gtk_entry_new()))
+    { }
+
+    Entry::Entry(std::size_t max_length) : Entry()
+    {
+        gtk_entry_set_max_length(*this, static_cast<gint>(max_length));
+    }
+
+    Frame::Frame(const char *label) : Frame(GTK_FRAME(gtk_frame_new(label)))
+    { }
+
+    HBox::HBox(bool homogenous, int spacing) : HBox(GTK_HBOX(gtk_hbox_new(homogenous, spacing)))
+    { }
+
+    HScale::HScale(Adjustment adjustment) : HScale(GTK_HSCALE(gtk_hscale_new(adjustment)))
+    { }
+
+    HScale::HScale(double min, double max, double step) : HScale(GTK_HSCALE(gtk_hscale_new_with_range(min, max, step)))
+    { }
+
+    Image::Image() : Image(GTK_IMAGE(gtk_image_new()))
+    { }
+
+    Label::Label(const char *label) : Label(GTK_LABEL(gtk_label_new(label)))
+    { }
+
+    Menu::Menu() : Menu(GTK_MENU(gtk_menu_new()))
+    { }
+
+    MenuItem::MenuItem(const char *label, bool mnemonic) : MenuItem(
+            GTK_MENU_ITEM((mnemonic ? gtk_menu_item_new_with_mnemonic : gtk_menu_item_new_with_label)(label)))
+    { }
+
+    HPaned::HPaned() : HPaned(GTK_HPANED(gtk_hpaned_new()))
+    { }
+
+    VPaned::VPaned() : VPaned(GTK_VPANED(gtk_vpaned_new()))
+    { }
+
+    ScrolledWindow::ScrolledWindow() : ScrolledWindow(GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(nullptr, nullptr)))
+    { }
+
+    SpinButton::SpinButton(Adjustment adjustment, double climb_rate, std::size_t digits) : SpinButton(
+            GTK_SPIN_BUTTON(gtk_spin_button_new(adjustment, climb_rate, digits)))
+    { }
+
+    Table::Table(std::size_t rows, std::size_t columns, bool homogenous) : Table(
+            GTK_TABLE(gtk_table_new(rows, columns, homogenous)))
+    { }
+
+    TextView::TextView() : TextView(GTK_TEXT_VIEW(gtk_text_view_new()))
+    { }
+
+    TreePath::TreePath() : TreePath(gtk_tree_path_new())
+    { }
+
+    TreePath::TreePath(const char *path) : TreePath(gtk_tree_path_new_from_string(path))
+    { }
+
+    TreeView::TreeView() : TreeView(GTK_TREE_VIEW(gtk_tree_view_new()))
+    { }
+
+    TreeView::TreeView(TreeModel model) : TreeView(GTK_TREE_VIEW(gtk_tree_view_new_with_model(model)))
+    { }
+
+    TreeViewColumn::TreeViewColumn(const char *title, CellRenderer renderer,
+                                   std::initializer_list<TreeViewColumnAttribute> attributes)
+            : TreeViewColumn(gtk_tree_view_column_new_with_attributes(title, renderer, nullptr))
+    {
+        for (auto &it : attributes) {
+            gtk_tree_view_column_add_attribute(*this, renderer, it.attribute, it.column);
+        }
+    };
+
+    VBox::VBox(bool homogenous, int spacing) : VBox(GTK_VBOX(gtk_vbox_new(homogenous, spacing)))
+    { }
+
+}
diff --git a/libs/uilib/uilib.h b/libs/uilib/uilib.h
new file mode 100644 (file)
index 0000000..562d0b0
--- /dev/null
@@ -0,0 +1,281 @@
+#ifndef INCLUDED_UILIB_H
+#define INCLUDED_UILIB_H
+
+#include <string>
+
+using ui_accelgroup = struct _GtkAccelGroup;
+using ui_adjustment = struct _GtkAdjustment;
+using ui_alignment = struct _GtkAlignment;
+using ui_box = struct _GtkBox;
+using ui_button = struct _GtkButton;
+using ui_checkbutton = struct _GtkCheckButton;
+using ui_combobox = struct _GtkComboBox;
+using ui_comboboxtext = struct _GtkComboBoxText;
+using ui_cellrenderer = struct _GtkCellRenderer;
+using ui_cellrenderertext = struct _GtkCellRendererText;
+using ui_entry = struct _GtkEntry;
+using ui_evkey = struct _GdkEventKey;
+using ui_frame = struct _GtkFrame;
+using ui_hbox = struct _GtkHBox;
+using ui_hscale = struct _GtkHScale;
+using ui_hpaned = struct _GtkHPaned;
+using ui_image = struct _GtkImage;
+using ui_label = struct _GtkLabel;
+using ui_menu = struct _GtkMenu;
+using ui_menuitem = struct _GtkMenuItem;
+using ui_modal = struct ModalDialog;
+using ui_object = struct _GtkObject;
+using ui_paned = struct _GtkPaned;
+using ui_scrolledwindow = struct _GtkScrolledWindow;
+using ui_spinbutton = struct _GtkSpinButton;
+using ui_table = struct _GtkTable;
+using ui_textview = struct _GtkTextView;
+using ui_treemodel = struct _GtkTreeModel;
+using ui_treepath = struct _GtkTreePath;
+using ui_treeview = struct _GtkTreeView;
+using ui_treeviewcolumn = struct _GtkTreeViewColumn;
+using ui_typeinst = struct _GTypeInstance;
+using ui_vbox = struct _GtkVBox;
+using ui_vpaned = struct _GtkVPaned;
+using ui_widget = struct _GtkWidget;
+using ui_window = struct _GtkWindow;
+
+namespace ui {
+
+    void init(int argc, char *argv[]);
+
+    void main();
+
+    enum class alert_type {
+        OK,
+        OKCANCEL,
+        YESNO,
+        YESNOCANCEL,
+        NOYES,
+    };
+
+    enum class alert_icon {
+        Default,
+        Error,
+        Warning,
+        Question,
+        Asterisk,
+    };
+
+    enum class alert_response {
+        OK,
+        CANCEL,
+        YES,
+        NO,
+    };
+
+    enum class window_type {
+        TOP,
+        POPUP
+    };
+
+    template<class Self, class T, bool implicit = true>
+    struct Convertible;
+
+    template<class Self, class T>
+    struct Convertible<Self, T, true> {
+        operator T *() const
+        { return reinterpret_cast<T *>(static_cast<const Self *>(this)->_handle); }
+    };
+
+    template<class Self, class T>
+    struct Convertible<Self, T, false> {
+        explicit operator T *() const
+        { return reinterpret_cast<T *>(static_cast<const Self *>(this)->_handle); }
+    };
+
+    class Object : public Convertible<Object, ui_object, false> {
+    public:
+        using native = ui_object;
+        void *_handle;
+
+        Object(void *h) : _handle(h)
+        { }
+
+        explicit operator bool() const
+        { return _handle != nullptr; }
+
+        explicit operator ui_typeinst *() const
+        { return (ui_typeinst *) _handle; }
+
+        explicit operator void *() const
+        { return _handle; }
+    };
+
+    static_assert(sizeof(Object) == sizeof(ui_widget *), "object slicing");
+
+    class Widget : public Object, public Convertible<Widget, ui_widget> {
+    public:
+        using native = ui_widget;
+        explicit Widget(ui_widget *h = nullptr) : Object((void *) h)
+        { }
+
+        alert_response alert(std::string text, std::string title = "NetRadiant",
+                             alert_type type = alert_type::OK, alert_icon icon = alert_icon::Default);
+
+        const char *file_dialog(bool open, const char *title, const char *path = nullptr,
+                                const char *pattern = nullptr, bool want_load = false, bool want_import = false,
+                                bool want_save = false);
+    };
+
+    static_assert(sizeof(Widget) == sizeof(Object), "object slicing");
+
+    extern Widget root;
+
+#define WRAP(name, super, impl, methods) \
+    class name : public super, public Convertible<name, impl> { \
+        public: \
+            using native = impl; \
+            explicit name(impl *h) : super(reinterpret_cast<super::native *>(h)) {} \
+        methods \
+    }; \
+    static_assert(sizeof(name) == sizeof(super), "object slicing")
+
+    WRAP(AccelGroup, Object, ui_accelgroup,
+         AccelGroup();
+    );
+
+    WRAP(Adjustment, Widget, ui_adjustment,
+         Adjustment(double value,
+                    double lower, double upper,
+                    double step_increment, double page_increment,
+                    double page_size);
+    );
+
+    WRAP(Alignment, Widget, ui_alignment,
+         Alignment(float xalign, float yalign, float xscale, float yscale);
+    );
+
+    WRAP(Box, Widget, ui_box,);
+
+    WRAP(Button, Widget, ui_button,
+         Button();
+         Button(const char *label);
+    );
+
+    WRAP(CellRenderer, Object, ui_cellrenderer,);
+
+    WRAP(CellRendererText, CellRenderer, ui_cellrenderertext,
+         CellRendererText();
+    );
+
+    WRAP(CheckButton, Widget, ui_checkbutton,
+         CheckButton(const char *label);
+    );
+
+    WRAP(ComboBox, Widget, ui_combobox,);
+
+    WRAP(ComboBoxText, ComboBox, ui_comboboxtext,
+         ComboBoxText();
+    );
+
+    WRAP(Entry, Widget, ui_entry,
+         Entry();
+         Entry(std::size_t max_length);
+    );
+
+    WRAP(Frame, Widget, ui_frame,
+         Frame(const char *label = nullptr);
+    );
+
+    WRAP(HBox, Box, ui_hbox,
+         HBox(bool homogenous, int spacing);
+    );
+
+    WRAP(HScale, Widget, ui_hscale,
+         HScale(Adjustment adjustment);
+         HScale(double min, double max, double step);
+    );
+
+    WRAP(Image, Widget, ui_image,
+         Image();
+    );
+
+    WRAP(Label, Widget, ui_label,
+         Label(const char *label);
+    );
+
+    WRAP(Menu, Widget, ui_menu,
+         Menu();
+    );
+
+    WRAP(MenuItem, Widget, ui_menuitem,
+         MenuItem(const char *label, bool mnemonic = false);
+    );
+
+    WRAP(Paned, Widget, ui_paned,);
+
+        WRAP(HPaned, Paned, ui_hpaned,
+             HPaned();
+        );
+
+        WRAP(VPaned, Paned, ui_vpaned,
+             VPaned();
+        );
+
+    WRAP(ScrolledWindow, Widget, ui_scrolledwindow,
+         ScrolledWindow();
+    );
+
+    WRAP(SpinButton, Widget, ui_spinbutton,
+         SpinButton(Adjustment adjustment, double climb_rate, std::size_t digits);
+    );
+
+    WRAP(Table, Widget, ui_table,
+         Table(std::size_t rows, std::size_t columns, bool homogenous);
+    );
+
+    WRAP(TextView, Widget, ui_textview,
+         TextView();
+    );
+
+    WRAP(TreeModel, Widget, ui_treemodel,);
+
+    WRAP(TreePath, Object, ui_treepath,
+         TreePath();
+         TreePath(const char *path);
+    );
+
+    WRAP(TreeView, Widget, ui_treeview,
+         TreeView();
+         TreeView(TreeModel model);
+    );
+
+    struct TreeViewColumnAttribute {
+        const char *attribute;
+        int column;
+    };
+    WRAP(TreeViewColumn, Widget, ui_treeviewcolumn,
+         TreeViewColumn(const char *title, CellRenderer renderer, std::initializer_list<TreeViewColumnAttribute> attributes);
+    );
+
+    WRAP(VBox, Box, ui_vbox,
+         VBox(bool homogenous, int spacing);
+    );
+
+    WRAP(Window, Widget, ui_window,
+         Window() : Window(nullptr) {};
+         Window(window_type type);
+
+         Window create_dialog_window(const char *title, void func(), void *data, int default_w = -1,
+                                     int default_h = -1);
+
+         Window create_modal_dialog_window(const char *title, ui_modal &dialog, int default_w = -1,
+                                           int default_h = -1);
+
+         Window create_floating_window(const char *title);
+
+         std::uint64_t on_key_press(bool (*f)(Widget widget, ui_evkey *event, void *extra),
+                                    void *extra = nullptr);
+    );
+
+#undef WRAP
+
+}
+
+#endif
index 4da3fab3b91d203a64daac3745e9e3ffbe170fd9..a01172a1b397d5253b34a61f98aae76fefd114a5 100644 (file)
@@ -114,25 +114,25 @@ bool C2DView::OnRButtonUp( int x, int y ){
                if ( m_bPopup ) {
                        GtkWidget *menu, *item;
 
-                       menu = gtk_menu_new();
+                       menu = ui::Menu();
 
-                       item = gtk_menu_item_new_with_label( "Validate (RETURN)" );
-                       gtk_signal_connect( GTK_OBJECT( item ), "activate", GTK_SIGNAL_FUNC( Textool_Validate ), NULL );
+                       item = ui::MenuItem( "Validate (RETURN)" );
+                       g_signal_connect( GTK_OBJECT( item ), "activate", G_CALLBACK( Textool_Validate ), NULL );
                        gtk_widget_show( item );
                        gtk_menu_append( GTK_MENU( menu ), item );
 
-                       item = gtk_menu_item_new_with_label( "Zoom in (INSERT)" );
-                       gtk_signal_connect( GTK_OBJECT( item ), "activate", GTK_SIGNAL_FUNC( view_ZoomIn ), this );
+                       item = ui::MenuItem( "Zoom in (INSERT)" );
+                       g_signal_connect( GTK_OBJECT( item ), "activate", G_CALLBACK( view_ZoomIn ), this );
                        gtk_widget_show( item );
                        gtk_menu_append( GTK_MENU( menu ), item );
 
-                       item = gtk_menu_item_new_with_label( "Zoom out (DELETE)" );
-                       gtk_signal_connect( GTK_OBJECT( item ), "activate", GTK_SIGNAL_FUNC( view_ZoomOut ), this );
+                       item = ui::MenuItem( "Zoom out (DELETE)" );
+                       g_signal_connect( GTK_OBJECT( item ), "activate", G_CALLBACK( view_ZoomOut ), this );
                        gtk_widget_show( item );
                        gtk_menu_append( GTK_MENU( menu ), item );
 
-                       item = gtk_menu_item_new_with_label( "Cancel (ESC)" );
-                       gtk_signal_connect( GTK_OBJECT( item ), "activate", GTK_SIGNAL_FUNC( Textool_Cancel ), NULL );
+                       item = ui::MenuItem( "Cancel (ESC)" );
+                       g_signal_connect( GTK_OBJECT( item ), "activate", G_CALLBACK( Textool_Cancel ), NULL );
                        gtk_widget_show( item );
                        gtk_menu_append( GTK_MENU( menu ), item );
 
index 50fbf12566a76a120bc00aee0fdcc833ddc1246f..63f77b7f91585c999afc86548608fa812f27a929 100644 (file)
@@ -54,22 +54,22 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){
        GtkWidget *window, *w, *vbox, *hbox;
        int mode = ( uType & MB_TYPEMASK ), ret, loop = 1;
 
-       window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
-       gtk_signal_connect( GTK_OBJECT( window ), "delete_event",
-                                               GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
-       gtk_signal_connect( GTK_OBJECT( window ), "destroy",
-                                               GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+       window = ui::Window( ui::window_type::TOP );
+       g_signal_connect( GTK_OBJECT( window ), "delete_event",
+                                               G_CALLBACK( dialog_delete_callback ), NULL );
+       g_signal_connect( GTK_OBJECT( window ), "destroy",
+                                               G_CALLBACK( gtk_widget_destroy ), NULL );
        gtk_window_set_title( GTK_WINDOW( window ), lpCaption );
-       gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+       gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
        g_object_set_data( G_OBJECT( window ), "loop", &loop );
        g_object_set_data( G_OBJECT( window ), "ret", &ret );
        gtk_widget_realize( window );
 
-       vbox = gtk_vbox_new( FALSE, 10 );
+       vbox = ui::VBox( FALSE, 10 );
        gtk_container_add( GTK_CONTAINER( window ), vbox );
        gtk_widget_show( vbox );
 
-       w = gtk_label_new( lpText );
+       w = ui::Label( lpText );
        gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
        gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
        gtk_widget_show( w );
@@ -78,72 +78,72 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){
        gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
        gtk_widget_show( w );
 
-       hbox = gtk_hbox_new( FALSE, 10 );
+       hbox = ui::HBox( FALSE, 10 );
        gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
        gtk_widget_show( hbox );
 
        if ( mode == MB_OK ) {
-               w = gtk_button_new_with_label( "Ok" );
+               w = ui::Button( "Ok" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
-               GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
+               gtk_widget_set_can_default( w, true );
                gtk_widget_grab_default( w );
                gtk_widget_show( w );
                ret = IDOK;
        }
        else if ( mode ==  MB_OKCANCEL ) {
-               w = gtk_button_new_with_label( "Ok" );
+               w = ui::Button( "Ok" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
-               GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
+               gtk_widget_set_can_default( w, true );
                gtk_widget_grab_default( w );
                gtk_widget_show( w );
 
-               w = gtk_button_new_with_label( "Cancel" );
+               w = ui::Button( "Cancel" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
                gtk_widget_show( w );
                ret = IDCANCEL;
        }
        else if ( mode == MB_YESNOCANCEL ) {
-               w = gtk_button_new_with_label( "Yes" );
+               w = ui::Button( "Yes" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDYES ) );
-               GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) );
+               gtk_widget_set_can_default( w, true );
                gtk_widget_grab_default( w );
                gtk_widget_show( w );
 
-               w = gtk_button_new_with_label( "No" );
+               w = ui::Button( "No" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDNO ) );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) );
                gtk_widget_show( w );
 
-               w = gtk_button_new_with_label( "Cancel" );
+               w = ui::Button( "Cancel" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
                gtk_widget_show( w );
                ret = IDCANCEL;
        }
        else /* if (mode == MB_YESNO) */
        {
-               w = gtk_button_new_with_label( "Yes" );
+               w = ui::Button( "Yes" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDYES ) );
-               GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) );
+               gtk_widget_set_can_default( w, true );
                gtk_widget_grab_default( w );
                gtk_widget_show( w );
 
-               w = gtk_button_new_with_label( "No" );
+               w = ui::Button( "No" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
-               gtk_signal_connect( GTK_OBJECT( w ), "clicked",
-                                                       GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDNO ) );
+               g_signal_connect( GTK_OBJECT( w ), "clicked",
+                                                       G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) );
                gtk_widget_show( w );
                ret = IDNO;
        }
@@ -643,17 +643,17 @@ static GtkWidget* CreateOpenGLWidget(){
                                                   GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK );
 
        // Connect signal handlers
-       gtk_signal_connect( GTK_OBJECT( g_pToolWidget ), "expose_event", GTK_SIGNAL_FUNC( expose ), NULL );
-       gtk_signal_connect( GTK_OBJECT( g_pToolWidget ), "motion_notify_event",
-                                               GTK_SIGNAL_FUNC( motion ), NULL );
-       gtk_signal_connect( GTK_OBJECT( g_pToolWidget ), "button_press_event",
-                                               GTK_SIGNAL_FUNC( button_press ), NULL );
-       gtk_signal_connect( GTK_OBJECT( g_pToolWidget ), "button_release_event",
-                                               GTK_SIGNAL_FUNC( button_release ), NULL );
-
-       gtk_signal_connect( GTK_OBJECT( g_pToolWnd ), "delete_event", GTK_SIGNAL_FUNC( close ), NULL );
-       gtk_signal_connect( GTK_OBJECT( g_pToolWnd ), "key_press_event",
-                                               GTK_SIGNAL_FUNC( keypress ), NULL );
+       g_signal_connect( GTK_OBJECT( g_pToolWidget ), "expose_event", G_CALLBACK( expose ), NULL );
+       g_signal_connect( GTK_OBJECT( g_pToolWidget ), "motion_notify_event",
+                                               G_CALLBACK( motion ), NULL );
+       g_signal_connect( GTK_OBJECT( g_pToolWidget ), "button_press_event",
+                                               G_CALLBACK( button_press ), NULL );
+       g_signal_connect( GTK_OBJECT( g_pToolWidget ), "button_release_event",
+                                               G_CALLBACK( button_release ), NULL );
+
+       g_signal_connect( GTK_OBJECT( g_pToolWnd ), "delete_event", G_CALLBACK( close ), NULL );
+       g_signal_connect( GTK_OBJECT( g_pToolWnd ), "key_press_event",
+                                               G_CALLBACK( keypress ), NULL );
 
        return g_pToolWidget;
 }
index 9fd1542894b2e3793c88453050f981efda80d715..cf2bdeeea792ebbfebf394a706aa5ac18b72300d 100644 (file)
@@ -37,6 +37,7 @@
 #include "archivelib.h"
 #include "fs_path.h"
 
+
 class DirectoryArchive : public Archive
 {
 CopiedString m_root;
index fe42687cc640d12bb2e877cea69c4f669074407e..b9f9b824abd26a5e71c0d0880f842994e38049f8 100644 (file)
@@ -19,6 +19,7 @@
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <uilib/uilib.h>
 #include "autosave.h"
 
 #include "os/file.h"
@@ -91,7 +92,7 @@ void Map_Snapshot(){
        {
                StringOutputStream strMsg( 256 );
                strMsg << "Snapshot save failed.. unabled to create directory\n" << snapshotsDir.c_str();
-               gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), strMsg.c_str() );
+               MainFrame_getWindow().alert( strMsg.c_str() );
        }
 }
 /*
@@ -174,8 +175,8 @@ void QE_CheckAutoSave( void ){
 }
 
 void Autosave_constructPreferences( PreferencesPage& page ){
-       GtkWidget* autosave_enabled = page.appendCheckBox( "Autosave", "Enable Autosave", g_AutoSave_Enabled );
-       GtkWidget* autosave_frequency = page.appendSpinner( "Autosave Frequency (minutes)", m_AutoSave_Frequency, 1, 1, 60 );
+       ui::CheckButton autosave_enabled = page.appendCheckBox( "Autosave", "Enable Autosave", g_AutoSave_Enabled );
+       ui::SpinButton autosave_frequency = page.appendSpinner( "Autosave Frequency (minutes)", m_AutoSave_Frequency, 1, 1, 60 );
        Widget_connectToggleDependency( autosave_frequency, autosave_enabled );
        page.appendCheckBox( "", "Save Snapshots", g_SnapShots_Enabled );
 }
index c49464bed1e438537e6a29dcc7bd89b20b7f8bd3..3979f6a8f3f3815ead189618e32dcf1e927fd9d3 100644 (file)
@@ -36,6 +36,7 @@
 #include "preferences.h"
 
 #include <list>
+#include <gdk/gdkkeysyms.h>
 
 void Brush_ConstructCuboid( Brush& brush, const AABB& bounds, const char* shader, const TextureProjection& projection ){
        const unsigned char box[3][2] = { { 0, 1 }, { 2, 0 }, { 1, 2 } };
@@ -1367,9 +1368,9 @@ void Brush_registerCommands(){
        GlobalCommands_insert( "Brush8Sided", BrushMakeSided::SetCaller( g_brushmakesided8 ), Accelerator( '8', (GdkModifierType)GDK_CONTROL_MASK ) );
        GlobalCommands_insert( "Brush9Sided", BrushMakeSided::SetCaller( g_brushmakesided9 ), Accelerator( '9', (GdkModifierType)GDK_CONTROL_MASK ) );
 
-       GlobalCommands_insert( "ClipSelected", FreeCaller<ClipSelected>(), Accelerator( GDK_Return ) );
-       GlobalCommands_insert( "SplitSelected", FreeCaller<SplitSelected>(), Accelerator( GDK_Return, (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "FlipClip", FreeCaller<FlipClipper>(), Accelerator( GDK_Return, (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "ClipSelected", FreeCaller<ClipSelected>(), Accelerator( GDK_KEY_Return ) );
+       GlobalCommands_insert( "SplitSelected", FreeCaller<SplitSelected>(), Accelerator( GDK_KEY_Return, (GdkModifierType)GDK_SHIFT_MASK ) );
+       GlobalCommands_insert( "FlipClip", FreeCaller<FlipClipper>(), Accelerator( GDK_KEY_Return, (GdkModifierType)GDK_CONTROL_MASK ) );
 
        GlobalCommands_insert( "MakeDetail", FreeCaller<Select_MakeDetail>(), Accelerator( 'M', (GdkModifierType)GDK_CONTROL_MASK ) );
        GlobalCommands_insert( "MakeStructural", FreeCaller<Select_MakeStructural>(), Accelerator( 'S', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
index 073e0ddf12049b467afdb4b7b32a0cbec375e8b5..1a4149882e12b739e44e89804dab4518cffb1f38 100644 (file)
@@ -633,14 +633,7 @@ void build_commands_write( const char* filename ){
 
 
 #include <gdk/gdkkeysyms.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkbox.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtkscrolledwindow.h>
+#include <gtk/gtk.h>
 
 #include "gtkutil/dialog.h"
 #include "gtkutil/closure.h"
@@ -679,7 +672,7 @@ ProjectList( Project& project ) : m_project( project ), m_changed( false ){
 gboolean project_cell_edited( GtkCellRendererText* cell, gchar* path_string, gchar* new_text, ProjectList* projectList ){
        Project& project = projectList->m_project;
 
-       GtkTreePath* path = gtk_tree_path_new_from_string( path_string );
+       GtkTreePath* path = ui::TreePath( path_string );
 
        ASSERT_MESSAGE( gtk_tree_path_get_depth( path ) == 1, "invalid path length" );
 
@@ -715,7 +708,7 @@ gboolean project_cell_edited( GtkCellRendererText* cell, gchar* path_string, gch
        return FALSE;
 }
 
-gboolean project_key_press( GtkWidget* widget, GdkEventKey* event, ProjectList* projectList ){
+gboolean project_key_press( ui::Widget widget, GdkEventKey* event, ProjectList* projectList ){
        Project& project = projectList->m_project;
 
        if ( event->keyval == GDK_Delete ) {
@@ -786,7 +779,7 @@ gboolean commands_cell_edited( GtkCellRendererText* cell, gchar* path_string, gc
        }
        Build& build = *g_current_build;
 
-       GtkTreePath* path = gtk_tree_path_new_from_string( path_string );
+       GtkTreePath* path = ui::TreePath( path_string );
 
        ASSERT_MESSAGE( gtk_tree_path_get_depth( path ) == 1, "invalid path length" );
 
@@ -817,7 +810,7 @@ gboolean commands_cell_edited( GtkCellRendererText* cell, gchar* path_string, gc
        return FALSE;
 }
 
-gboolean commands_key_press( GtkWidget* widget, GdkEventKey* event, GtkListStore* store ){
+gboolean commands_key_press( ui::Widget widget, GdkEventKey* event, GtkListStore* store ){
        if ( g_current_build == 0 ) {
                return FALSE;
        }
@@ -844,10 +837,10 @@ gboolean commands_key_press( GtkWidget* widget, GdkEventKey* event, GtkListStore
 }
 
 
-GtkWindow* BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectList ){
-       GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Build Menu", G_CALLBACK( dialog_delete_callback ), &modal, -1, 400 );
+ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectList ){
+       ui::Window window = MainFrame_getWindow().create_dialog_window("Build Menu", G_CALLBACK(dialog_delete_callback ), &modal, -1, 400 );
 
-       GtkWidget* buildView = 0;
+       ui::Widget buildView;
 
        {
                GtkTable* table1 = create_dialog_table( 2, 2, 4, 4, 4 );
@@ -878,14 +871,14 @@ GtkWindow* BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi
                                {
                                        GtkListStore* store = gtk_list_store_new( 1, G_TYPE_STRING );
 
-                                       GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+                                       ui::Widget view = ui::TreeView( ui::TreeModel(GTK_TREE_MODEL( store ) ));
                                        gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
 
-                                       GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
+                                       auto renderer = ui::CellRendererText();
                                        object_set_boolean_property( G_OBJECT( renderer ), "editable", TRUE );
-                                       g_signal_connect( renderer, "edited", G_CALLBACK( project_cell_edited ), &projectList );
+                                       g_signal_connect( G_OBJECT(renderer), "edited", G_CALLBACK( project_cell_edited ), &projectList );
 
-                                       GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, 0 );
+                                       GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
                                        gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
 
                                        GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) );
@@ -915,14 +908,14 @@ GtkWindow* BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi
                                {
                                        GtkListStore* store = gtk_list_store_new( 1, G_TYPE_STRING );
 
-                                       GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+                                       ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
                                        gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
 
-                                       GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
+                                       auto renderer = ui::CellRendererText();
                                        object_set_boolean_property( G_OBJECT( renderer ), "editable", TRUE );
-                                       g_signal_connect( renderer, "edited", G_CALLBACK( commands_cell_edited ), store );
+                                       g_signal_connect( G_OBJECT(renderer), "edited", G_CALLBACK( commands_cell_edited ), store );
 
-                                       GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, 0 );
+                                       GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
                                        gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
 
                                        GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) );
@@ -959,7 +952,7 @@ void DoBuildMenu(){
 
        ProjectList projectList( g_build_project );
 
-       GtkWindow* window = BuildMenuDialog_construct( modal, projectList );
+       ui::Window window = BuildMenuDialog_construct( modal, projectList );
 
        if ( modal_dialog_show( window, modal ) == eIDCANCEL ) {
                build_commands_clear();
index 9e97ce966e39ea4a49b1e3a014ac28d4266a2c0a..d250f873750a5778efc012cbb5a95cbe2758f6ef 100644 (file)
@@ -25,6 +25,7 @@
 // Leonardo Zide (leo@lokigames.com)
 //
 
+#include <gdk/gdkkeysyms.h>
 #include "camwindow.h"
 
 #include "debugging/debugging.h"
@@ -669,8 +670,8 @@ static Shader* m_state_select2;
 FreezePointer m_freezePointer;
 
 public:
-GtkWidget* m_gl_widget;
-GtkWindow* m_parent;
+ui::Widget m_gl_widget;
+ui::Window m_parent;
 
 SelectionSystemWindowObserver* m_window_observer;
 XORRectangle m_XORRectangle;
@@ -756,17 +757,17 @@ void GlobalCamera_setCamWnd( CamWnd& camwnd ){
 }
 
 
-GtkWidget* CamWnd_getWidget( CamWnd& camwnd ){
+ui::Widget CamWnd_getWidget( CamWnd& camwnd ){
        return camwnd.m_gl_widget;
 }
 
-GtkWindow* CamWnd_getParent( CamWnd& camwnd ){
+ui::Window CamWnd_getParent( CamWnd& camwnd ){
        return camwnd.m_parent;
 }
 
 ToggleShown g_camera_shown( true );
 
-void CamWnd_setParent( CamWnd& camwnd, GtkWindow* parent ){
+void CamWnd_setParent( CamWnd& camwnd, ui::Window parent ){
        camwnd.m_parent = parent;
        g_camera_shown.connect( GTK_WIDGET( camwnd.m_parent ) );
 }
@@ -799,7 +800,7 @@ void Camera_setAngles( CamWnd& camwnd, const Vector3& angles ){
 // =============================================================================
 // CamWnd class
 
-gboolean enable_freelook_button_press( GtkWidget* widget, GdkEventButton* event, CamWnd* camwnd ){
+gboolean enable_freelook_button_press( ui::Widget widget, GdkEventButton* event, CamWnd* camwnd ){
        if ( event->type == GDK_BUTTON_PRESS && event->button == 3 ) {
                camwnd->EnableFreeMove();
                return TRUE;
@@ -807,7 +808,7 @@ gboolean enable_freelook_button_press( GtkWidget* widget, GdkEventButton* event,
        return FALSE;
 }
 
-gboolean disable_freelook_button_press( GtkWidget* widget, GdkEventButton* event, CamWnd* camwnd ){
+gboolean disable_freelook_button_press( ui::Widget widget, GdkEventButton* event, CamWnd* camwnd ){
        if ( event->type == GDK_BUTTON_PRESS && event->button == 3 ) {
                camwnd->DisableFreeMove();
                return TRUE;
@@ -816,7 +817,7 @@ gboolean disable_freelook_button_press( GtkWidget* widget, GdkEventButton* event
 }
 
 #if 0
-gboolean mousecontrol_button_press( GtkWidget* widget, GdkEventButton* event, CamWnd* camwnd ){
+gboolean mousecontrol_button_press( ui::Widget widget, GdkEventButton* event, CamWnd* camwnd ){
        if ( event->type == GDK_BUTTON_PRESS && event->button == 3 ) {
                Cam_MouseControl( camwnd->getCamera(), event->x, widget->allocation.height - 1 - event->y );
        }
@@ -825,20 +826,20 @@ gboolean mousecontrol_button_press( GtkWidget* widget, GdkEventButton* event, Ca
 #endif
 
 void camwnd_update_xor_rectangle( CamWnd& self, rect_t area ){
-       if ( GTK_WIDGET_VISIBLE( self.m_gl_widget ) ) {
+       if ( gtk_widget_get_visible( self.m_gl_widget ) ) {
                self.m_XORRectangle.set( rectangle_from_area( area.min, area.max, self.getCamera().width, self.getCamera().height ) );
        }
 }
 
 
-gboolean selection_button_press( GtkWidget* widget, GdkEventButton* event, WindowObserver* observer ){
+gboolean selection_button_press( ui::Widget widget, GdkEventButton* event, WindowObserver* observer ){
        if ( event->type == GDK_BUTTON_PRESS ) {
                observer->onMouseDown( WindowVector_forDouble( event->x, event->y ), button_for_button( event->button ), modifiers_for_state( event->state ) );
        }
        return FALSE;
 }
 
-gboolean selection_button_release( GtkWidget* widget, GdkEventButton* event, WindowObserver* observer ){
+gboolean selection_button_release( ui::Widget widget, GdkEventButton* event, WindowObserver* observer ){
        if ( event->type == GDK_BUTTON_RELEASE ) {
                observer->onMouseUp( WindowVector_forDouble( event->x, event->y ), button_for_button( event->button ), modifiers_for_state( event->state ) );
        }
@@ -850,30 +851,32 @@ void selection_motion( gdouble x, gdouble y, guint state, void* data ){
        reinterpret_cast<WindowObserver*>( data )->onMouseMotion( WindowVector_forDouble( x, y ), modifiers_for_state( state ) );
 }
 
-inline WindowVector windowvector_for_widget_centre( GtkWidget* widget ){
-       return WindowVector( static_cast<float>( widget->allocation.width / 2 ), static_cast<float>( widget->allocation.height / 2 ) );
+inline WindowVector windowvector_for_widget_centre( ui::Widget widget ){
+       GtkAllocation allocation;
+       gtk_widget_get_allocation(widget, &allocation);
+       return WindowVector( static_cast<float>( allocation.width / 2 ), static_cast<float>(allocation.height / 2 ) );
 }
 
-gboolean selection_button_press_freemove( GtkWidget* widget, GdkEventButton* event, WindowObserver* observer ){
+gboolean selection_button_press_freemove( ui::Widget widget, GdkEventButton* event, WindowObserver* observer ){
        if ( event->type == GDK_BUTTON_PRESS ) {
                observer->onMouseDown( windowvector_for_widget_centre( widget ), button_for_button( event->button ), modifiers_for_state( event->state ) );
        }
        return FALSE;
 }
 
-gboolean selection_button_release_freemove( GtkWidget* widget, GdkEventButton* event, WindowObserver* observer ){
+gboolean selection_button_release_freemove( ui::Widget widget, GdkEventButton* event, WindowObserver* observer ){
        if ( event->type == GDK_BUTTON_RELEASE ) {
                observer->onMouseUp( windowvector_for_widget_centre( widget ), button_for_button( event->button ), modifiers_for_state( event->state ) );
        }
        return FALSE;
 }
 
-gboolean selection_motion_freemove( GtkWidget *widget, GdkEventMotion *event, WindowObserver* observer ){
+gboolean selection_motion_freemove( ui::Widget widget, GdkEventMotion *event, WindowObserver* observer ){
        observer->onMouseMotion( windowvector_for_widget_centre( widget ), modifiers_for_state( event->state ) );
        return FALSE;
 }
 
-gboolean wheelmove_scroll( GtkWidget* widget, GdkEventScroll* event, CamWnd* camwnd ){
+gboolean wheelmove_scroll( ui::Widget widget, GdkEventScroll* event, CamWnd* camwnd ){
        if ( event->direction == GDK_SCROLL_UP ) {
                Camera_Freemove_updateAxes( camwnd->getCamera() );
                Camera_setOrigin( *camwnd, vector3_added( Camera_getOrigin( *camwnd ), vector3_scaled( camwnd->getCamera().forward, static_cast<float>( g_camwindow_globals_private.m_nMoveSpeed ) ) ) );
@@ -886,7 +889,7 @@ gboolean wheelmove_scroll( GtkWidget* widget, GdkEventScroll* event, CamWnd* cam
        return FALSE;
 }
 
-gboolean camera_size_allocate( GtkWidget* widget, GtkAllocation* allocation, CamWnd* camwnd ){
+gboolean camera_size_allocate( ui::Widget widget, GtkAllocation* allocation, CamWnd* camwnd ){
        camwnd->getCamera().width = allocation->width;
        camwnd->getCamera().height = allocation->height;
        Camera_updateProjection( camwnd->getCamera() );
@@ -895,7 +898,7 @@ gboolean camera_size_allocate( GtkWidget* widget, GtkAllocation* allocation, Cam
        return FALSE;
 }
 
-gboolean camera_expose( GtkWidget* widget, GdkEventExpose* event, gpointer data ){
+gboolean camera_expose( ui::Widget widget, GdkEventExpose* event, gpointer data ){
        reinterpret_cast<CamWnd*>( data )->draw();
        return FALSE;
 }
@@ -913,27 +916,27 @@ void KeyEvent_disconnect( const char* name ){
 }
 
 void CamWnd_registerCommands( CamWnd& camwnd ){
-       GlobalKeyEvents_insert( "CameraForward", Accelerator( GDK_Up ),
+       GlobalKeyEvents_insert( "CameraForward", Accelerator( GDK_KEY_Up ),
                                                        ReferenceCaller<camera_t, Camera_MoveForward_KeyDown>( camwnd.getCamera() ),
                                                        ReferenceCaller<camera_t, Camera_MoveForward_KeyUp>( camwnd.getCamera() )
                                                        );
-       GlobalKeyEvents_insert( "CameraBack", Accelerator( GDK_Down ),
+       GlobalKeyEvents_insert( "CameraBack", Accelerator( GDK_KEY_Down ),
                                                        ReferenceCaller<camera_t, Camera_MoveBack_KeyDown>( camwnd.getCamera() ),
                                                        ReferenceCaller<camera_t, Camera_MoveBack_KeyUp>( camwnd.getCamera() )
                                                        );
-       GlobalKeyEvents_insert( "CameraLeft", Accelerator( GDK_Left ),
+       GlobalKeyEvents_insert( "CameraLeft", Accelerator( GDK_KEY_Left ),
                                                        ReferenceCaller<camera_t, Camera_RotateLeft_KeyDown>( camwnd.getCamera() ),
                                                        ReferenceCaller<camera_t, Camera_RotateLeft_KeyUp>( camwnd.getCamera() )
                                                        );
-       GlobalKeyEvents_insert( "CameraRight", Accelerator( GDK_Right ),
+       GlobalKeyEvents_insert( "CameraRight", Accelerator( GDK_KEY_Right ),
                                                        ReferenceCaller<camera_t, Camera_RotateRight_KeyDown>( camwnd.getCamera() ),
                                                        ReferenceCaller<camera_t, Camera_RotateRight_KeyUp>( camwnd.getCamera() )
                                                        );
-       GlobalKeyEvents_insert( "CameraStrafeRight", Accelerator( GDK_period ),
+       GlobalKeyEvents_insert( "CameraStrafeRight", Accelerator( GDK_KEY_period ),
                                                        ReferenceCaller<camera_t, Camera_MoveRight_KeyDown>( camwnd.getCamera() ),
                                                        ReferenceCaller<camera_t, Camera_MoveRight_KeyUp>( camwnd.getCamera() )
                                                        );
-       GlobalKeyEvents_insert( "CameraStrafeLeft", Accelerator( GDK_comma ),
+       GlobalKeyEvents_insert( "CameraStrafeLeft", Accelerator( GDK_KEY_comma ),
                                                        ReferenceCaller<camera_t, Camera_MoveLeft_KeyDown>( camwnd.getCamera() ),
                                                        ReferenceCaller<camera_t, Camera_MoveLeft_KeyUp>( camwnd.getCamera() )
                                                        );
@@ -1142,7 +1145,7 @@ CamWnd::CamWnd() :
        m_view( true ),
        m_Camera( &m_view, CamWndQueueDraw( *this ) ),
        m_cameraview( m_Camera, &m_view, ReferenceCaller<CamWnd, CamWnd_Update>( *this ) ),
-       m_gl_widget( glwidget_new( TRUE ) ),
+       m_gl_widget( ui::Widget(glwidget_new( TRUE )) ),
        m_window_observer( NewWindowObserver() ),
        m_XORRectangle( m_gl_widget ),
        m_deferredDraw( WidgetQueueDrawCaller( *m_gl_widget ) ),
@@ -1160,10 +1163,10 @@ CamWnd::CamWnd() :
        m_window_observer->setRectangleDrawCallback( ReferenceCaller1<CamWnd, rect_t, camwnd_update_xor_rectangle>( *this ) );
        m_window_observer->setView( m_view );
 
-       gtk_widget_ref( m_gl_widget );
+       g_object_ref( m_gl_widget );
 
        gtk_widget_set_events( m_gl_widget, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK );
-       GTK_WIDGET_SET_FLAGS( m_gl_widget, GTK_CAN_FOCUS );
+       gtk_widget_set_can_focus( m_gl_widget, true );
 
        m_sizeHandler = g_signal_connect( G_OBJECT( m_gl_widget ), "size_allocate", G_CALLBACK( camera_size_allocate ), this );
        m_exposeHandler = g_signal_connect( G_OBJECT( m_gl_widget ), "expose_event", G_CALLBACK( camera_expose ), this );
@@ -1191,7 +1194,7 @@ CamWnd::~CamWnd(){
        g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_sizeHandler );
        g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_exposeHandler );
 
-       gtk_widget_unref( m_gl_widget );
+       g_object_unref( m_gl_widget );
 
        m_window_observer->release();
 }
@@ -1278,7 +1281,7 @@ void CamWnd::Cam_PositionDrag(){
 
 // NOTE TTimo if there's an OS-level focus out of the application
 //   then we can release the camera cursor grab
-static gboolean camwindow_freemove_focusout( GtkWidget* widget, GdkEventFocus* event, gpointer data ){
+static gboolean camwindow_freemove_focusout( ui::Widget widget, GdkEventFocus* event, gpointer data ){
        reinterpret_cast<CamWnd*>( data )->DisableFreeMove();
        return FALSE;
 }
index 8e578c8598fb830eba65750c7d9773065370e4af..bfe449e567d2a21bbc877f8d76ed55b98284cb2e 100644 (file)
 #if !defined( INCLUDED_CAMWINDOW_H )
 #define INCLUDED_CAMWINDOW_H
 
+#include <uilib/uilib.h>
 #include "math/vector.h"
 #include "signal/signalfwd.h"
 
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-
 class CamWnd;
 CamWnd* NewCamWnd();
 void DeleteCamWnd( CamWnd* camwnd );
@@ -36,8 +34,8 @@ void AddCameraMovedCallback( const SignalHandler& handler );
 
 void CamWnd_Update( CamWnd& camwnd );
 
-GtkWidget* CamWnd_getWidget( CamWnd& camwnd );
-void CamWnd_setParent( CamWnd& camwnd, GtkWindow* parent );
+ui::Widget CamWnd_getWidget( CamWnd& camwnd );
+void CamWnd_setParent( CamWnd& camwnd, ui::Window parent );
 
 void GlobalCamera_setCamWnd( CamWnd& camwnd );
 
index f608ea49709348fbc4574bdb7d062ccd7312b18f..f463503e04ac95878256a8ab6550cb856f783f6c 100644 (file)
 #include <map>
 #include "string/string.h"
 #include "versionlib.h"
-#include "gtkutil/accelerator.h"
 #include "gtkutil/messagebox.h"
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkbutton.h>
+#include <gtk/gtk.h>
 #include "gtkmisc.h"
 
 typedef std::pair<Accelerator, int> ShortcutValue; // accelerator, isRegistered
@@ -150,13 +148,8 @@ void connect_accelerator( const char *name ){
 }
 
 
-#include <cctype>
-
-#include <gtk/gtkbox.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtktreemodel.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtkcellrenderertext.h>
+#include <uilib/uilib.h>
+#include <gdk/gdkkeysyms.h>
 
 #include "gtkutil/dialog.h"
 #include "mainframe.h"
@@ -239,7 +232,7 @@ void accelerator_edit_button_clicked( GtkButton *btn, gpointer dialogptr ){
        dialog.m_waiting_for_key = true;
 }
 
-gboolean accelerator_window_key_press( GtkWidget *widget, GdkEventKey *event, gpointer dialogptr ){
+bool accelerator_window_key_press( ui::Widget widget, GdkEventKey *event, gpointer dialogptr ){
        command_list_dialog_t &dialog = *(command_list_dialog_t *) dialogptr;
 
        if ( !dialog.m_waiting_for_key ) {
@@ -253,20 +246,20 @@ gboolean accelerator_window_key_press( GtkWidget *widget, GdkEventKey *event, gp
 #else
        switch ( event->keyval )
        {
-       case GDK_Shift_L:
-       case GDK_Shift_R:
-       case GDK_Control_L:
-       case GDK_Control_R:
-       case GDK_Caps_Lock:
-       case GDK_Shift_Lock:
-       case GDK_Meta_L:
-       case GDK_Meta_R:
-       case GDK_Alt_L:
-       case GDK_Alt_R:
-       case GDK_Super_L:
-       case GDK_Super_R:
-       case GDK_Hyper_L:
-       case GDK_Hyper_R:
+       case GDK_KEY_Shift_L:
+       case GDK_KEY_Shift_R:
+       case GDK_KEY_Control_L:
+       case GDK_KEY_Control_R:
+       case GDK_KEY_Caps_Lock:
+       case GDK_KEY_Shift_Lock:
+       case GDK_KEY_Meta_L:
+       case GDK_KEY_Meta_R:
+       case GDK_KEY_Alt_L:
+       case GDK_KEY_Alt_R:
+       case GDK_KEY_Super_L:
+       case GDK_KEY_Super_R:
+       case GDK_KEY_Hyper_L:
+       case GDK_KEY_Hyper_R:
                return false;
        }
 #endif
@@ -293,11 +286,11 @@ gboolean accelerator_window_key_press( GtkWidget *widget, GdkEventKey *event, gp
        {
        const char *commandName;
        const Accelerator &newAccel;
-       GtkWidget *widget;
+       ui::Widget widget;
        GtkTreeModel *model;
 public:
        bool allow;
-       VerifyAcceleratorNotTaken( const char *name, const Accelerator &accelerator, GtkWidget *w, GtkTreeModel *m ) : commandName( name ), newAccel( accelerator ), widget( w ), model( m ), allow( true ){
+       VerifyAcceleratorNotTaken( const char *name, const Accelerator &accelerator, ui::Widget w, GtkTreeModel *m ) : commandName( name ), newAccel( accelerator ), widget( w ), model( m ), allow( true ){
        }
        void visit( const char* name, Accelerator& accelerator ){
                if ( !strcmp( name, commandName ) ) {
@@ -313,8 +306,8 @@ public:
                        StringOutputStream msg;
                        msg << "The command " << name << " is already assigned to the key " << accelerator << ".\n\n"
                                << "Do you want to unassign " << name << " first?";
-                       EMessageBoxReturn r = gtk_MessageBox( widget, msg.c_str(), "Key already used", eMB_YESNOCANCEL );
-                       if ( r == eIDYES ) {
+                       auto r = widget.alert( msg.c_str(), "Key already used", ui::alert_type::YESNOCANCEL );
+                       if ( r == ui::alert_response::YES ) {
                                // clear the ACTUAL accelerator too!
                                disconnect_accelerator( name );
                                // delete the modifier
@@ -338,7 +331,7 @@ public:
                                        }
                                }
                        }
-                       else if ( r == eIDCANCEL ) {
+                       else if ( r == ui::alert_response::CANCEL ) {
                                // aborted
                                allow = false;
                        }
@@ -394,10 +387,12 @@ public:
 void DoCommandListDlg(){
        command_list_dialog_t dialog;
 
-       GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "Mapped Commands", dialog, -1, 400 );
-       g_signal_connect( G_OBJECT( window ), "key-press-event", (GCallback) accelerator_window_key_press, &dialog );
+       ui::Window window = MainFrame_getWindow().create_modal_dialog_window("Mapped Commands", dialog, -1, 400);
+       window.on_key_press([](ui::Widget widget, GdkEventKey *event, gpointer dialogptr) {
+               return accelerator_window_key_press(widget, event, dialogptr);
+       }, &dialog);
 
-       GtkAccelGroup* accel = gtk_accel_group_new();
+       GtkAccelGroup* accel = ui::AccelGroup();
        gtk_window_add_accel_group( window, accel );
 
        GtkHBox* hbox = create_dialog_hbox( 4, 4 );
@@ -410,20 +405,20 @@ void DoCommandListDlg(){
                {
                        GtkListStore* store = gtk_list_store_new( 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INT );
 
-                       GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+                       ui::Widget view = ui::TreeView(ui::TreeModel(GTK_TREE_MODEL(store)));
                        dialog.m_list = GTK_TREE_VIEW( view );
 
                        gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), false ); // annoying
 
                        {
-                               GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
-                               GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Command", renderer, "text", 0, "weight-set", 2, "weight", 3, NULL );
+                               auto renderer = ui::CellRendererText();
+                               GtkTreeViewColumn* column = ui::TreeViewColumn( "Command", renderer, {{"text", 0}, {"weight-set", 2}, {"weight", 3}} );
                                gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
                        }
 
                        {
-                               GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
-                               GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Key", renderer, "text", 1, "weight-set", 2, "weight", 3, NULL );
+                               auto renderer = ui::CellRendererText();
+                               GtkTreeViewColumn* column = ui::TreeViewColumn( "Key", renderer, {{"text", 1}, {"weight-set", 2}, {"weight", 3}} );
                                gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
                        }
 
@@ -478,7 +473,7 @@ public:
                GtkButton* clearbutton = create_dialog_button( "Clear", (GCallback) accelerator_clear_button_clicked, &dialog );
                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( clearbutton ), FALSE, FALSE, 0 );
 
-               GtkWidget *spacer = gtk_image_new();
+               ui::Widget spacer = ui::Image();
                gtk_widget_show( spacer );
                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( spacer ), TRUE, TRUE, 0 );
 
index 72a64140fd0ba4af78aa8475cd06bb89551ea87e..b8968d0c4bdf79306b23d5d2bbd48a1429e54515 100644 (file)
 #include "console.h"
 
 #include <time.h>
-#include <gtk/gtktextbuffer.h>
-#include <gtk/gtktextview.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkscrolledwindow.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
 
 #include "gtkutil/accelerator.h"
 #include "gtkutil/messagebox.h"
@@ -69,8 +67,8 @@ void Sys_LogFile( bool enable ){
                                                                 << "This is NetRadiant '" RADIANT_VERSION "' compiled " __DATE__ "\n" RADIANT_ABOUTMSG "\n";
                }
                else{
-                       gtk_MessageBox( 0, "Failed to create log file, check write permissions in Radiant directory.\n",
-                                                       "Console logging", eMB_OK, eMB_ICONERROR );
+                       ui::root.alert( "Failed to create log file, check write permissions in Radiant directory.\n",
+                                                       "Console logging", ui::alert_type::OK, ui::alert_icon::Error );
                }
        }
        else if ( !enable && g_hLogFile != 0 ) {
@@ -83,7 +81,7 @@ void Sys_LogFile( bool enable ){
        }
 }
 
-GtkWidget* g_console = 0;
+ui::Widget g_console;
 
 void console_clear(){
        GtkTextBuffer* buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( g_console ) );
@@ -93,27 +91,27 @@ void console_clear(){
 void console_populate_popup( GtkTextView* textview, GtkMenu* menu, gpointer user_data ){
        menu_separator( menu );
 
-       GtkWidget* item = gtk_menu_item_new_with_label( "Clear" );
+       ui::Widget item(ui::MenuItem( "Clear" ));
        g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( console_clear ), 0 );
        gtk_widget_show( item );
        container_add_widget( GTK_CONTAINER( menu ), item );
 }
 
-gboolean destroy_set_null( GtkWindow* widget, GtkWidget** p ){
-       *p = 0;
+gboolean destroy_set_null( ui::Window widget, ui::Widget* p ){
+       *p = ui::Widget();
        return FALSE;
 }
 
 WidgetFocusPrinter g_consoleWidgetFocusPrinter( "console" );
 
-GtkWidget* Console_constructWindow( GtkWindow* toplevel ){
-       GtkWidget* scr = gtk_scrolled_window_new( 0, 0 );
+ui::Widget Console_constructWindow( ui::Window toplevel ){
+       ui::Widget scr = ui::ScrolledWindow();
        gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
        gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
        gtk_widget_show( scr );
 
        {
-               GtkWidget* text = gtk_text_view_new();
+               ui::Widget text = ui::TextView();
                gtk_widget_set_size_request( text, 0, -1 ); // allow shrinking
                gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( text ), GTK_WRAP_WORD );
                gtk_text_view_set_editable( GTK_TEXT_VIEW( text ), FALSE );
@@ -212,7 +210,7 @@ std::size_t Sys_Print( int level, const char* buf, std::size_t length ){
                        if ( contains_newline ) {
                                gtk_text_view_scroll_mark_onscreen( GTK_TEXT_VIEW( g_console ), end );
 
-                               if ( !ScreenUpdates_Enabled() && GTK_WIDGET_REALIZED( g_console ) ) {
+                               if ( !ScreenUpdates_Enabled() && gtk_widget_get_realized( g_console ) ) {
                                        ScreenUpdates_process();
                                }
                        }
index 38e479fd5a96e12902c7aeba827b88d75f83059c..8bbe71e1c512ab05777f8e64de01a444892c7b49 100644 (file)
@@ -23,6 +23,7 @@
 #define INCLUDED_CONSOLE_H
 
 #include <cstddef>
+#include <uilib/uilib.h>
 
 #define SYS_VRB 0 ///< verbose support (on/off)
 #define SYS_STD 1 ///< standard print level - this is the default
@@ -35,9 +36,7 @@ class TextOutputStream;
 TextOutputStream& getSysPrintOutputStream();
 TextOutputStream& getSysPrintErrorStream();
 
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-GtkWidget* Console_constructWindow( GtkWindow* toplevel );
+ui::Widget Console_constructWindow( ui::Window toplevel );
 
 // will open/close the log file based on the parameter
 void Sys_LogFile( bool enable );
index e98cac9212901178a72b793658ae43405ba9f71e..51c2b10749efdb7d30653f06d3329b0e5a6b08c2 100644 (file)
 
 #include <stdlib.h>
 
-#include <gtk/gtkmain.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtkspinbutton.h>
-#include <gtk/gtkradiobutton.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkcombobox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkhscale.h>
-#include <gtk/gtkalignment.h>
+#include <gtk/gtk.h>
 
 #include "stream/stringstream.h"
 #include "convert.h"
@@ -59,7 +48,7 @@
 
 
 GtkEntry* DialogEntry_new(){
-       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+       GtkEntry* entry = ui::Entry();
        gtk_widget_show( GTK_WIDGET( entry ) );
        gtk_widget_set_size_request( GTK_WIDGET( entry ), 64, -1 );
        return entry;
@@ -68,20 +57,20 @@ GtkEntry* DialogEntry_new(){
 class DialogEntryRow
 {
 public:
-DialogEntryRow( GtkWidget* row, GtkEntry* entry ) : m_row( row ), m_entry( entry ){
+DialogEntryRow( ui::Widget row, GtkEntry* entry ) : m_row( row ), m_entry( entry ){
 }
-GtkWidget* m_row;
+ui::Widget m_row;
 GtkEntry* m_entry;
 };
 
 DialogEntryRow DialogEntryRow_new( const char* name ){
-       GtkWidget* alignment = gtk_alignment_new( 0.0, 0.5, 0.0, 0.0 );
+       ui::Widget alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 );
        gtk_widget_show( alignment );
 
        GtkEntry* entry = DialogEntry_new();
        gtk_container_add( GTK_CONTAINER( alignment ), GTK_WIDGET( entry ) );
 
-       return DialogEntryRow( GTK_WIDGET( DialogRow_new( name, alignment ) ), entry );
+       return DialogEntryRow( ui::Widget(GTK_WIDGET( DialogRow_new( name, alignment ) )), entry );
 }
 
 
@@ -92,7 +81,7 @@ GtkSpinButton* DialogSpinner_new( double value, double lower, double upper, int
        {
                ++digits;
        }
-       GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( value, lower, upper, step, 10, 0 ) ), step, digits ) );
+       GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( value, lower, upper, step, 10, 0 ), step, digits );
        gtk_widget_show( GTK_WIDGET( spin ) );
        gtk_widget_set_size_request( GTK_WIDGET( spin ), 64, -1 );
        return spin;
@@ -101,20 +90,20 @@ GtkSpinButton* DialogSpinner_new( double value, double lower, double upper, int
 class DialogSpinnerRow
 {
 public:
-DialogSpinnerRow( GtkWidget* row, GtkSpinButton* spin ) : m_row( row ), m_spin( spin ){
+DialogSpinnerRow( ui::Widget row, GtkSpinButton* spin ) : m_row( row ), m_spin( spin ){
 }
-GtkWidget* m_row;
+ui::Widget m_row;
 GtkSpinButton* m_spin;
 };
 
 DialogSpinnerRow DialogSpinnerRow_new( const char* name, double value, double lower, double upper, int fraction ){
-       GtkWidget* alignment = gtk_alignment_new( 0.0, 0.5, 0.0, 0.0 );
+       ui::Widget alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 );
        gtk_widget_show( alignment );
 
        GtkSpinButton* spin = DialogSpinner_new( value, lower, upper, fraction );
        gtk_container_add( GTK_CONTAINER( alignment ), GTK_WIDGET( spin ) );
 
-       return DialogSpinnerRow( GTK_WIDGET( DialogRow_new( name, alignment ) ), spin );
+       return DialogSpinnerRow( ui::Widget(GTK_WIDGET( DialogRow_new( name, alignment ) )), spin );
 }
 
 
@@ -204,7 +193,7 @@ void FloatSpinnerImport( GtkSpinButton& widget, float value ){
        gtk_spin_button_set_value( &widget, value );
 }
 void FloatSpinnerExport( GtkSpinButton& widget, const FloatImportCallback& importCallback ){
-       importCallback( float(gtk_spin_button_get_value_as_float( &widget ) ) );
+       importCallback( float(gtk_spin_button_get_value( &widget ) ) );
 }
 typedef ImportExport<GtkSpinButton, float, FloatSpinnerImport, FloatSpinnerExport> FloatSpinnerImportExport;
 
@@ -318,39 +307,39 @@ Dialog::~Dialog(){
                ( *i )->release();
        }
 
-       ASSERT_MESSAGE( m_window == 0, "dialog window not destroyed" );
+       ASSERT_MESSAGE( !m_window, "dialog window not destroyed" );
 }
 
 void Dialog::ShowDlg(){
-       ASSERT_MESSAGE( m_window != 0, "dialog was not constructed" );
+       ASSERT_MESSAGE( m_window, "dialog was not constructed" );
        importData();
        gtk_widget_show( GTK_WIDGET( m_window ) );
 }
 
 void Dialog::HideDlg(){
-       ASSERT_MESSAGE( m_window != 0, "dialog was not constructed" );
+       ASSERT_MESSAGE( m_window, "dialog was not constructed" );
        exportData();
        gtk_widget_hide( GTK_WIDGET( m_window ) );
 }
 
-static gint delete_event_callback( GtkWidget *widget, GdkEvent* event, gpointer data ){
+static gint delete_event_callback( ui::Widget widget, GdkEvent* event, gpointer data ){
        reinterpret_cast<Dialog*>( data )->HideDlg();
        reinterpret_cast<Dialog*>( data )->EndModal( eIDCANCEL );
        return TRUE;
 }
 
 void Dialog::Create(){
-       ASSERT_MESSAGE( m_window == 0, "dialog cannot be constructed" );
+       ASSERT_MESSAGE( !m_window, "dialog cannot be constructed" );
 
        m_window = BuildDialog();
        g_signal_connect( G_OBJECT( m_window ), "delete_event", G_CALLBACK( delete_event_callback ), this );
 }
 
 void Dialog::Destroy(){
-       ASSERT_MESSAGE( m_window != 0, "dialog cannot be destroyed" );
+       ASSERT_MESSAGE( m_window, "dialog cannot be destroyed" );
 
        gtk_widget_destroy( GTK_WIDGET( m_window ) );
-       m_window = 0;
+       m_window = ui::Window();
 }
 
 
@@ -451,7 +440,7 @@ EMessageBoxReturn Dialog::DoModal(){
        PreModal();
 
        EMessageBoxReturn ret = modal_dialog_show( m_window, m_modal );
-       ASSERT_NOTNULL( m_window );
+       ASSERT_TRUE( (bool) m_window );
        if ( ret == eIDOK ) {
                exportData();
        }
@@ -464,8 +453,8 @@ EMessageBoxReturn Dialog::DoModal(){
 }
 
 
-GtkWidget* Dialog::addCheckBox( GtkWidget* vbox, const char* name, const char* flag, const BoolImportCallback& importViewer, const BoolExportCallback& exportViewer ){
-       GtkWidget* check = gtk_check_button_new_with_label( flag );
+ui::CheckButton Dialog::addCheckBox( ui::Widget vbox, const char* name, const char* flag, const BoolImportCallback& importViewer, const BoolExportCallback& exportViewer ){
+       auto check = ui::CheckButton( flag );
        gtk_widget_show( check );
        AddBoolToggleData( *GTK_TOGGLE_BUTTON( check ), importViewer, exportViewer );
 
@@ -473,19 +462,19 @@ GtkWidget* Dialog::addCheckBox( GtkWidget* vbox, const char* name, const char* f
        return check;
 }
 
-GtkWidget* Dialog::addCheckBox( GtkWidget* vbox, const char* name, const char* flag, bool& data ){
+ui::CheckButton Dialog::addCheckBox( ui::Widget vbox, const char* name, const char* flag, bool& data ){
        return addCheckBox( vbox, name, flag, BoolImportCaller( data ), BoolExportCaller( data ) );
 }
 
-void Dialog::addCombo( GtkWidget* vbox, const char* name, StringArrayRange values, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
-       GtkWidget* alignment = gtk_alignment_new( 0.0, 0.5, 0.0, 0.0 );
+void Dialog::addCombo( ui::Widget vbox, const char* name, StringArrayRange values, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
+       ui::Widget alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 );
        gtk_widget_show( alignment );
        {
-               GtkWidget* combo = gtk_combo_box_new_text();
+               ui::Widget combo = ui::ComboBoxText();
 
                for ( StringArrayRange::Iterator i = values.first; i != values.last; ++i )
                {
-                       gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), *i );
+                       gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( combo ), *i );
                }
 
                AddIntComboData( *GTK_COMBO_BOX( combo ), importViewer, exportViewer );
@@ -498,23 +487,23 @@ void Dialog::addCombo( GtkWidget* vbox, const char* name, StringArrayRange value
        DialogVBox_packRow( GTK_VBOX( vbox ), GTK_WIDGET( row ) );
 }
 
-void Dialog::addCombo( GtkWidget* vbox, const char* name, int& data, StringArrayRange values ){
+void Dialog::addCombo( ui::Widget vbox, const char* name, int& data, StringArrayRange values ){
        addCombo( vbox, name, values, IntImportCaller( data ), IntExportCaller( data ) );
 }
 
-void Dialog::addSlider( GtkWidget* vbox, const char* name, int& data, gboolean draw_value, const char* low, const char* high, double value, double lower, double upper, double step_increment, double page_increment ){
+void Dialog::addSlider( ui::Widget vbox, const char* name, int& data, gboolean draw_value, const char* low, const char* high, double value, double lower, double upper, double step_increment, double page_increment ){
 #if 0
        if ( draw_value == FALSE ) {
-               GtkWidget* hbox2 = gtk_hbox_new( FALSE, 0 );
+               ui::Widget hbox2 = ui::HBox( FALSE, 0 );
                gtk_widget_show( hbox2 );
                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox2 ), FALSE, FALSE, 0 );
                {
-                       GtkWidget* label = gtk_label_new( low );
+                       ui::Widget label = ui::Label( low );
                        gtk_widget_show( label );
                        gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 );
                }
                {
-                       GtkWidget* label = gtk_label_new( high );
+                       ui::Widget label = ui::Label( high );
                        gtk_widget_show( label );
                        gtk_box_pack_end( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 );
                }
@@ -522,14 +511,14 @@ void Dialog::addSlider( GtkWidget* vbox, const char* name, int& data, gboolean d
 #endif
 
        // adjustment
-       GtkObject* adj = gtk_adjustment_new( value, lower, upper, step_increment, page_increment, 0 );
-       AddIntAdjustmentData( *GTK_ADJUSTMENT( adj ), IntImportCaller( data ), IntExportCaller( data ) );
+       auto adj = ui::Adjustment( value, lower, upper, step_increment, page_increment, 0 );
+       AddIntAdjustmentData( *GTK_ADJUSTMENT(adj), IntImportCaller( data ), IntExportCaller( data ) );
 
        // scale
-       GtkWidget* alignment = gtk_alignment_new( 0.0, 0.5, 1.0, 0.0 );
+       ui::Widget alignment = ui::Alignment( 0.0, 0.5, 1.0, 0.0 );
        gtk_widget_show( alignment );
 
-       GtkWidget* scale = gtk_hscale_new( GTK_ADJUSTMENT( adj ) );
+       ui::Widget scale = ui::HScale( adj );
        gtk_scale_set_value_pos( GTK_SCALE( scale ), GTK_POS_LEFT );
        gtk_widget_show( scale );
        gtk_container_add( GTK_CONTAINER( alignment ), scale );
@@ -541,8 +530,8 @@ void Dialog::addSlider( GtkWidget* vbox, const char* name, int& data, gboolean d
        DialogVBox_packRow( GTK_VBOX( vbox ), GTK_WIDGET( row ) );
 }
 
-void Dialog::addRadio( GtkWidget* vbox, const char* name, StringArrayRange names, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
-       GtkWidget* alignment = gtk_alignment_new( 0.0, 0.5, 0.0, 0.0 );
+void Dialog::addRadio( ui::Widget vbox, const char* name, StringArrayRange names, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
+       ui::Widget alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 );
        gtk_widget_show( alignment );
        {
                RadioHBox radioBox = RadioHBox_new( names );
@@ -554,19 +543,19 @@ void Dialog::addRadio( GtkWidget* vbox, const char* name, StringArrayRange names
        DialogVBox_packRow( GTK_VBOX( vbox ), GTK_WIDGET( row ) );
 }
 
-void Dialog::addRadio( GtkWidget* vbox, const char* name, int& data, StringArrayRange names ){
+void Dialog::addRadio( ui::Widget vbox, const char* name, int& data, StringArrayRange names ){
        addRadio( vbox, name, names, IntImportCaller( data ), IntExportCaller( data ) );
 }
 
-void Dialog::addRadioIcons( GtkWidget* vbox, const char* name, StringArrayRange icons, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
-       GtkWidget* table = gtk_table_new( 2, static_cast<guint>( icons.last - icons.first ), FALSE );
+void Dialog::addRadioIcons( ui::Widget vbox, const char* name, StringArrayRange icons, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
+       ui::Widget table = ui::Table( 2, icons.last - icons.first, FALSE );
        gtk_widget_show( table );
 
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
        gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
 
        GSList* group = 0;
-       GtkWidget* radio = 0;
+       ui::Widget radio;
        for ( StringArrayRange::Iterator icon = icons.first; icon != icons.last; ++icon )
        {
                guint pos = static_cast<guint>( icon - icons.first );
@@ -576,7 +565,7 @@ void Dialog::addRadioIcons( GtkWidget* vbox, const char* name, StringArrayRange
                                                  (GtkAttachOptions) ( 0 ),
                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
 
-               radio = gtk_radio_button_new( group );
+               radio = ui::Widget(gtk_radio_button_new( group ));
                gtk_widget_show( radio );
                gtk_table_attach( GTK_TABLE( table ), radio, pos, pos + 1, 1, 2,
                                                  (GtkAttachOptions) ( 0 ),
@@ -590,32 +579,32 @@ void Dialog::addRadioIcons( GtkWidget* vbox, const char* name, StringArrayRange
        DialogVBox_packRow( GTK_VBOX( vbox ), GTK_WIDGET( DialogRow_new( name, table ) ) );
 }
 
-void Dialog::addRadioIcons( GtkWidget* vbox, const char* name, int& data, StringArrayRange icons ){
+void Dialog::addRadioIcons( ui::Widget vbox, const char* name, int& data, StringArrayRange icons ){
        addRadioIcons( vbox, name, icons, IntImportCaller( data ), IntExportCaller( data ) );
 }
 
-GtkWidget* Dialog::addIntEntry( GtkWidget* vbox, const char* name, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
+ui::Widget Dialog::addIntEntry( ui::Widget vbox, const char* name, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
        DialogEntryRow row( DialogEntryRow_new( name ) );
        AddIntEntryData( *row.m_entry, importViewer, exportViewer );
        DialogVBox_packRow( GTK_VBOX( vbox ), row.m_row );
        return row.m_row;
 }
 
-GtkWidget* Dialog::addSizeEntry( GtkWidget* vbox, const char* name, const SizeImportCallback& importViewer, const SizeExportCallback& exportViewer ){
+ui::Widget Dialog::addSizeEntry( ui::Widget vbox, const char* name, const SizeImportCallback& importViewer, const SizeExportCallback& exportViewer ){
        DialogEntryRow row( DialogEntryRow_new( name ) );
        AddSizeEntryData( *row.m_entry, importViewer, exportViewer );
        DialogVBox_packRow( GTK_VBOX( vbox ), row.m_row );
        return row.m_row;
 }
 
-GtkWidget* Dialog::addFloatEntry( GtkWidget* vbox, const char* name, const FloatImportCallback& importViewer, const FloatExportCallback& exportViewer ){
+ui::Widget Dialog::addFloatEntry( ui::Widget vbox, const char* name, const FloatImportCallback& importViewer, const FloatExportCallback& exportViewer ){
        DialogEntryRow row( DialogEntryRow_new( name ) );
        AddFloatEntryData( *row.m_entry, importViewer, exportViewer );
        DialogVBox_packRow( GTK_VBOX( vbox ), row.m_row );
        return row.m_row;
 }
 
-GtkWidget* Dialog::addPathEntry( GtkWidget* vbox, const char* name, bool browse_directory, const StringImportCallback& importViewer, const StringExportCallback& exportViewer ){
+ui::Widget Dialog::addPathEntry( ui::Widget vbox, const char* name, bool browse_directory, const StringImportCallback& importViewer, const StringExportCallback& exportViewer ){
        PathEntry pathEntry = PathEntry_new();
        g_signal_connect( G_OBJECT( pathEntry.m_button ), "clicked", G_CALLBACK( browse_directory ? button_clicked_entry_browse_directory : button_clicked_entry_browse_file ), pathEntry.m_entry );
 
@@ -624,27 +613,27 @@ GtkWidget* Dialog::addPathEntry( GtkWidget* vbox, const char* name, bool browse_
        GtkTable* row = DialogRow_new( name, GTK_WIDGET( pathEntry.m_frame ) );
        DialogVBox_packRow( GTK_VBOX( vbox ), GTK_WIDGET( row ) );
 
-       return GTK_WIDGET( row );
+       return ui::Widget(GTK_WIDGET( row ));
 }
 
-GtkWidget* Dialog::addPathEntry( GtkWidget* vbox, const char* name, CopiedString& data, bool browse_directory ){
+ui::Widget Dialog::addPathEntry( ui::Widget vbox, const char* name, CopiedString& data, bool browse_directory ){
        return addPathEntry( vbox, name, browse_directory, StringImportCallback( StringImportCaller( data ) ), StringExportCallback( StringExportCaller( data ) ) );
 }
 
-GtkWidget* Dialog::addSpinner( GtkWidget* vbox, const char* name, double value, double lower, double upper, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
+ui::SpinButton Dialog::addSpinner( ui::Widget vbox, const char* name, double value, double lower, double upper, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
        DialogSpinnerRow row( DialogSpinnerRow_new( name, value, lower, upper, 1 ) );
        AddIntSpinnerData( *row.m_spin, importViewer, exportViewer );
        DialogVBox_packRow( GTK_VBOX( vbox ), row.m_row );
-       return row.m_row;
+       return ui::SpinButton(row.m_spin);
 }
 
-GtkWidget* Dialog::addSpinner( GtkWidget* vbox, const char* name, int& data, double value, double lower, double upper ){
+ui::SpinButton Dialog::addSpinner( ui::Widget vbox, const char* name, int& data, double value, double lower, double upper ){
        return addSpinner( vbox, name, value, lower, upper, IntImportCallback( IntImportCaller( data ) ), IntExportCallback( IntExportCaller( data ) ) );
 }
 
-GtkWidget* Dialog::addSpinner( GtkWidget* vbox, const char* name, double value, double lower, double upper, const FloatImportCallback& importViewer, const FloatExportCallback& exportViewer ){
+ui::SpinButton Dialog::addSpinner( ui::Widget vbox, const char* name, double value, double lower, double upper, const FloatImportCallback& importViewer, const FloatExportCallback& exportViewer ){
        DialogSpinnerRow row( DialogSpinnerRow_new( name, value, lower, upper, 10 ) );
        AddFloatSpinnerData( *row.m_spin, importViewer, exportViewer );
        DialogVBox_packRow( GTK_VBOX( vbox ), row.m_row );
-       return row.m_row;
+       return ui::SpinButton(row.m_spin);
 }
index 2a0454ebad33afe1d3208a7edeff3d5411383d39..3e68095f11513943b5c5cddd42168ddd44ef0dc2 100644 (file)
@@ -23,6 +23,7 @@
 #define INCLUDED_DIALOG_H
 
 #include <list>
+#include <uilib/uilib.h>
 
 #include "gtkutil/dialog.h"
 #include "generic/callback.h"
@@ -107,11 +108,11 @@ typedef std::list<DLG_DATA*> DialogDataList;
 
 class Dialog
 {
-GtkWindow* m_window;
+ui::Window m_window;
 DialogDataList m_data;
 public:
 ModalDialog m_modal;
-GtkWindow* m_parent;
+ui::Window m_parent;
 
 Dialog();
 virtual ~Dialog();
@@ -122,7 +123,7 @@ virtual ~Dialog();
  */
 EMessageBoxReturn DoModal();
 void EndModal( EMessageBoxReturn code );
-virtual GtkWindow* BuildDialog() = 0;
+virtual ui::Window BuildDialog() = 0;
 virtual void exportData();
 virtual void importData();
 virtual void PreModal() { };
@@ -131,39 +132,39 @@ virtual void ShowDlg();
 virtual void HideDlg();
 void Create();
 void Destroy();
-GtkWindow* GetWidget(){
+ui::Window GetWidget(){
        return m_window;
 }
-const GtkWindow* GetWidget() const {
+const ui::Window GetWidget() const {
        return m_window;
 }
 
-GtkWidget* addCheckBox( GtkWidget* vbox, const char* name, const char* flag, const BoolImportCallback& importCallback, const BoolExportCallback& exportCallback );
-GtkWidget* addCheckBox( GtkWidget* vbox, const char* name, const char* flag, bool& data );
-void addCombo( GtkWidget* vbox, const char* name, StringArrayRange values, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
-void addCombo( GtkWidget* vbox, const char* name, int& data, StringArrayRange values );
-void addSlider( GtkWidget* vbox, const char* name, int& data, gboolean draw_value, const char* low, const char* high, double value, double lower, double upper, double step_increment, double page_increment );
-void addRadio( GtkWidget* vbox, const char* name, StringArrayRange names, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
-void addRadio( GtkWidget* vbox, const char* name, int& data, StringArrayRange names );
-void addRadioIcons( GtkWidget* vbox, const char* name, StringArrayRange icons, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
-void addRadioIcons( GtkWidget* vbox, const char* name, int& data, StringArrayRange icons );
-GtkWidget* addIntEntry( GtkWidget* vbox, const char* name, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
-GtkWidget* addEntry( GtkWidget* vbox, const char* name, int& data ){
+ui::CheckButton addCheckBox( ui::Widget vbox, const char* name, const char* flag, const BoolImportCallback& importCallback, const BoolExportCallback& exportCallback );
+ui::CheckButton addCheckBox( ui::Widget vbox, const char* name, const char* flag, bool& data );
+void addCombo( ui::Widget vbox, const char* name, StringArrayRange values, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
+void addCombo( ui::Widget vbox, const char* name, int& data, StringArrayRange values );
+void addSlider( ui::Widget vbox, const char* name, int& data, gboolean draw_value, const char* low, const char* high, double value, double lower, double upper, double step_increment, double page_increment );
+void addRadio( ui::Widget vbox, const char* name, StringArrayRange names, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
+void addRadio( ui::Widget vbox, const char* name, int& data, StringArrayRange names );
+void addRadioIcons( ui::Widget vbox, const char* name, StringArrayRange icons, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
+void addRadioIcons( ui::Widget vbox, const char* name, int& data, StringArrayRange icons );
+ui::Widget addIntEntry( ui::Widget vbox, const char* name, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
+ui::Widget addEntry( ui::Widget vbox, const char* name, int& data ){
        return addIntEntry( vbox, name, IntImportCaller( data ), IntExportCaller( data ) );
 }
-GtkWidget* addSizeEntry( GtkWidget* vbox, const char* name, const SizeImportCallback& importCallback, const SizeExportCallback& exportCallback );
-GtkWidget* addEntry( GtkWidget* vbox, const char* name, std::size_t& data ){
+ui::Widget addSizeEntry( ui::Widget vbox, const char* name, const SizeImportCallback& importCallback, const SizeExportCallback& exportCallback );
+ui::Widget addEntry( ui::Widget vbox, const char* name, std::size_t& data ){
        return addSizeEntry( vbox, name, SizeImportCaller( data ), SizeExportCaller( data ) );
 }
-GtkWidget* addFloatEntry( GtkWidget* vbox, const char* name, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback );
-GtkWidget* addEntry( GtkWidget* vbox, const char* name, float& data ){
+ui::Widget addFloatEntry( ui::Widget vbox, const char* name, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback );
+ui::Widget addEntry( ui::Widget vbox, const char* name, float& data ){
        return addFloatEntry( vbox, name, FloatImportCaller( data ), FloatExportCaller( data ) );
 }
-GtkWidget* addPathEntry( GtkWidget* vbox, const char* name, bool browse_directory, const StringImportCallback& importCallback, const StringExportCallback& exportCallback );
-GtkWidget* addPathEntry( GtkWidget* vbox, const char* name, CopiedString& data, bool directory );
-GtkWidget* addSpinner( GtkWidget* vbox, const char* name, int& data, double value, double lower, double upper );
-GtkWidget* addSpinner( GtkWidget* vbox, const char* name, double value, double lower, double upper, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
-GtkWidget* addSpinner( GtkWidget* vbox, const char* name, double value, double lower, double upper, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback );
+ui::Widget addPathEntry( ui::Widget vbox, const char* name, bool browse_directory, const StringImportCallback& importCallback, const StringExportCallback& exportCallback );
+ui::Widget addPathEntry( ui::Widget vbox, const char* name, CopiedString& data, bool directory );
+ui::SpinButton addSpinner( ui::Widget vbox, const char* name, int& data, double value, double lower, double upper );
+ui::SpinButton addSpinner( ui::Widget vbox, const char* name, double value, double lower, double upper, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
+ui::SpinButton addSpinner( ui::Widget vbox, const char* name, double value, double lower, double upper, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback );
 
 protected:
 
index ab3243b0a8f8ea3465ebfe85a8cde0c31e6ea9ab..49ed045bff2aef015e37b8409f7a237e81891ea4 100644 (file)
@@ -45,6 +45,8 @@
 #include "qe3.h"
 #include "commands.h"
 
+#include "uilib/uilib.h"
+
 struct entity_globals_t
 {
        Vector3 color_entity;
@@ -287,7 +289,7 @@ int g_iLastLightIntensity;
 void Entity_createFromSelection( const char* name, const Vector3& origin ){
 #if 0
        if ( string_equal_nocase( name, "worldspawn" ) ) {
-               gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), "Can't create an entity with worldspawn.", "info" );
+               ui::alert( GTK_WIDGET( MainFrame_getWindow() ), "Can't create an entity with worldspawn.", "info" );
                return;
        }
 #endif
@@ -381,7 +383,7 @@ void Entity_createFromSelection( const char* name, const Vector3& origin ){
        }
 
        if ( isModel ) {
-               const char* model = misc_model_dialog( GTK_WIDGET( MainFrame_getWindow() ) );
+               const char* model = misc_model_dialog(MainFrame_getWindow());
                if ( model != 0 ) {
                        Node_getEntity( node )->setKeyValue( "model", model );
                }
@@ -501,7 +503,7 @@ void Entity_setColour(){
                                normalize = false;
                        }
 
-                       if ( color_dialog( GTK_WIDGET( MainFrame_getWindow() ), g_entity_globals.color_entity ) ) {
+                       if ( color_dialog( MainFrame_getWindow(), g_entity_globals.color_entity ) ) {
                                if ( normalize ) {
                                        NormalizeColor( g_entity_globals.color_entity );
                                }
@@ -517,7 +519,7 @@ void Entity_setColour(){
        }
 }
 
-const char* misc_model_dialog( GtkWidget* parent ){
+const char* misc_model_dialog( ui::Widget parent ){
        StringOutputStream buffer( 1024 );
 
        buffer << g_qeglobals.m_userGamePath.c_str() << "models/";
@@ -528,7 +530,7 @@ const char* misc_model_dialog( GtkWidget* parent ){
                buffer << g_qeglobals.m_userGamePath.c_str() << "/";
        }
 
-       const char *filename = file_dialog( parent, TRUE, "Choose Model", buffer.c_str(), ModelLoader::Name() );
+       const char *filename = parent.file_dialog( TRUE, "Choose Model", buffer.c_str(), ModelLoader::Name() );
        if ( filename != 0 ) {
                // use VFS to get the correct relative path
                const char* relative = path_make_relative( filename, GlobalFileSystem().findRoot( filename ) );
index eaf73cbb47041be9664248e8db6361cb2e28ed5c..752ff189af3a3aeac3cf6f18514a7085cb68bdb7 100644 (file)
@@ -22,6 +22,8 @@
 #if !defined( INCLUDED_ENTITY_H )
 #define INCLUDED_ENTITY_H
 
+#include <uilib/uilib.h>
+
 template<typename Element> class BasicVector3;
 typedef BasicVector3<float> Vector3;
 void Entity_createFromSelection( const char* name, const Vector3& origin );
@@ -30,8 +32,7 @@ void Scene_EntitySetKeyValue_Selected( const char* key, const char* value );
 void Scene_EntitySetClassname_Selected( const char* classname );
 
 
-typedef struct _GtkWidget GtkWidget;
-const char* misc_model_dialog( GtkWidget* parent );
+const char* misc_model_dialog( ui::Widget parent );
 
 typedef struct _GtkMenu GtkMenu;
 void Entity_constructMenu( GtkMenu* menu );
index 5c1c330b913f7d6966550eb10dc7ff2db07741c3..3c21a47d20620fe0116d5455dbceab8965a34c74 100644 (file)
 #include <map>
 #include <set>
 #include <gdk/gdkkeysyms.h>
-#include <gtk/gtktreemodel.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtktextview.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtkcheckbutton.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkvpaned.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkcombobox.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
 
 
 #include "os/path.h"
@@ -79,7 +65,7 @@
 #include "groupdialog.h"
 
 GtkEntry* numeric_entry_new(){
-       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+       GtkEntry* entry = ui::Entry();
        gtk_widget_show( GTK_WIDGET( entry ) );
        gtk_widget_set_size_request( GTK_WIDGET( entry ), 64, -1 );
        return entry;
@@ -118,7 +104,7 @@ void Scene_EntitySetKeyValue_Selected_Undoable( const char* key, const char* val
 class EntityAttribute
 {
 public:
-virtual GtkWidget* getWidget() const = 0;
+virtual ui::Widget getWidget() const = 0;
 virtual void update() = 0;
 virtual void release() = 0;
 };
@@ -128,7 +114,7 @@ class BooleanAttribute : public EntityAttribute
 CopiedString m_key;
 GtkCheckButton* m_check;
 
-static gboolean toggled( GtkWidget *widget, BooleanAttribute* self ){
+static gboolean toggled( ui::Widget widget, BooleanAttribute* self ){
        self->apply();
        return FALSE;
 }
@@ -146,8 +132,8 @@ BooleanAttribute( const char* key ) :
 
        update();
 }
-GtkWidget* getWidget() const {
-       return GTK_WIDGET( m_check );
+ui::Widget getWidget() const {
+       return ui::Widget(GTK_WIDGET( m_check ));
 }
 void release(){
        delete this;
@@ -181,15 +167,15 @@ StringAttribute( const char* key ) :
        m_key( key ),
        m_entry( 0 ),
        m_nonModal( ApplyCaller( *this ), UpdateCaller( *this ) ){
-       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+       GtkEntry* entry = ui::Entry();
        gtk_widget_show( GTK_WIDGET( entry ) );
        gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
 
        m_entry = entry;
        m_nonModal.connect( m_entry );
 }
-GtkWidget* getWidget() const {
-       return GTK_WIDGET( m_entry );
+ui::Widget getWidget() const {
+       return ui::Widget(GTK_WIDGET( m_entry ));
 }
 GtkEntry* getEntry() const {
        return m_entry;
@@ -237,8 +223,8 @@ ModelAttribute( const char* key ) :
 void release(){
        delete this;
 }
-GtkWidget* getWidget() const {
-       return GTK_WIDGET( m_entry.m_entry.m_frame );
+ui::Widget getWidget() const {
+       return ui::Widget(GTK_WIDGET( m_entry.m_entry.m_frame ));
 }
 void apply(){
        StringOutputStream value( 64 );
@@ -253,7 +239,7 @@ void update(){
 }
 typedef MemberCaller<ModelAttribute, &ModelAttribute::update> UpdateCaller;
 void browse( const BrowsedPathEntry::SetPathCallback& setPath ){
-       const char *filename = misc_model_dialog( gtk_widget_get_toplevel( GTK_WIDGET( m_entry.m_entry.m_frame ) ) );
+       const char *filename = misc_model_dialog( ui::Widget(gtk_widget_get_toplevel( GTK_WIDGET( m_entry.m_entry.m_frame ) ) ));
 
        if ( filename != 0 ) {
                setPath( filename );
@@ -263,7 +249,7 @@ void browse( const BrowsedPathEntry::SetPathCallback& setPath ){
 typedef MemberCaller1<ModelAttribute, const BrowsedPathEntry::SetPathCallback&, &ModelAttribute::browse> BrowseCaller;
 };
 
-const char* browse_sound( GtkWidget* parent ){
+const char* browse_sound( ui::Widget parent ){
        StringOutputStream buffer( 1024 );
 
        buffer << g_qeglobals.m_userGamePath.c_str() << "sound/";
@@ -274,7 +260,7 @@ const char* browse_sound( GtkWidget* parent ){
                buffer << g_qeglobals.m_userGamePath.c_str() << "/";
        }
 
-       const char* filename = file_dialog( parent, TRUE, "Open Wav File", buffer.c_str(), "sound" );
+       const char* filename = parent.file_dialog(TRUE, "Open Wav File", buffer.c_str(), "sound" );
        if ( filename != 0 ) {
                const char* relative = path_make_relative( filename, GlobalFileSystem().findRoot( filename ) );
                if ( relative == filename ) {
@@ -300,8 +286,8 @@ SoundAttribute( const char* key ) :
 void release(){
        delete this;
 }
-GtkWidget* getWidget() const {
-       return GTK_WIDGET( m_entry.m_entry.m_frame );
+ui::Widget getWidget() const {
+       return ui::Widget(GTK_WIDGET( m_entry.m_entry.m_frame ));
 }
 void apply(){
        StringOutputStream value( 64 );
@@ -316,7 +302,7 @@ void update(){
 }
 typedef MemberCaller<SoundAttribute, &SoundAttribute::update> UpdateCaller;
 void browse( const BrowsedPathEntry::SetPathCallback& setPath ){
-       const char *filename = browse_sound( gtk_widget_get_toplevel( GTK_WIDGET( m_entry.m_entry.m_frame ) ) );
+       const char *filename = browse_sound( ui::Widget(gtk_widget_get_toplevel( GTK_WIDGET( m_entry.m_entry.m_frame ) )) );
 
        if ( filename != 0 ) {
                setPath( filename );
@@ -347,8 +333,8 @@ AngleAttribute( const char* key ) :
 void release(){
        delete this;
 }
-GtkWidget* getWidget() const {
-       return GTK_WIDGET( m_entry );
+ui::Widget getWidget() const {
+       return ui::Widget(GTK_WIDGET( m_entry ));
 }
 void apply(){
        StringOutputStream angle( 32 );
@@ -399,7 +385,7 @@ DirectionAttribute( const char* key ) :
 
        m_nonModalRadio.connect( m_radio.m_radio );
 
-       m_hbox = GTK_HBOX( gtk_hbox_new( FALSE, 4 ) );
+       m_hbox = ui::HBox( FALSE, 4 );
        gtk_widget_show( GTK_WIDGET( m_hbox ) );
 
        gtk_box_pack_start( GTK_BOX( m_hbox ), GTK_WIDGET( m_radio.m_hbox ), TRUE, TRUE, 0 );
@@ -408,8 +394,8 @@ DirectionAttribute( const char* key ) :
 void release(){
        delete this;
 }
-GtkWidget* getWidget() const {
-       return GTK_WIDGET( m_hbox );
+ui::Widget getWidget() const {
+       return ui::Widget(GTK_WIDGET( m_hbox ));
 }
 void apply(){
        StringOutputStream angle( 32 );
@@ -481,12 +467,13 @@ class AnglesAttribute : public EntityAttribute
 CopiedString m_key;
 AnglesEntry m_angles;
 NonModalEntry m_nonModal;
-GtkBox* m_hbox;
+ui::HBox m_hbox;
 public:
 AnglesAttribute( const char* key ) :
        m_key( key ),
-       m_nonModal( ApplyCaller( *this ), UpdateCaller( *this ) ){
-       m_hbox = GTK_BOX( gtk_hbox_new( TRUE, 4 ) );
+       m_nonModal( ApplyCaller( *this ), UpdateCaller( *this ) ),
+       m_hbox(ui::HBox( TRUE, 4 ))
+{
        gtk_widget_show( GTK_WIDGET( m_hbox ) );
        {
                GtkEntry* entry = numeric_entry_new();
@@ -510,8 +497,8 @@ AnglesAttribute( const char* key ) :
 void release(){
        delete this;
 }
-GtkWidget* getWidget() const {
-       return GTK_WIDGET( m_hbox );
+ui::Widget getWidget() const {
+       return ui::Widget(GTK_WIDGET( m_hbox ));
 }
 void apply(){
        StringOutputStream angles( 64 );
@@ -573,7 +560,7 @@ public:
 Vector3Attribute( const char* key ) :
        m_key( key ),
        m_nonModal( ApplyCaller( *this ), UpdateCaller( *this ) ){
-       m_hbox = GTK_BOX( gtk_hbox_new( TRUE, 4 ) );
+       m_hbox = ui::HBox( TRUE, 4 );
        gtk_widget_show( GTK_WIDGET( m_hbox ) );
        {
                GtkEntry* entry = numeric_entry_new();
@@ -597,8 +584,8 @@ Vector3Attribute( const char* key ) :
 void release(){
        delete this;
 }
-GtkWidget* getWidget() const {
-       return GTK_WIDGET( m_hbox );
+ui::Widget getWidget() const {
+       return ui::Widget(GTK_WIDGET( m_hbox ));
 }
 void apply(){
        StringOutputStream vector3( 64 );
@@ -675,11 +662,11 @@ ListAttribute( const char* key, const ListAttributeType& type ) :
        m_combo( 0 ),
        m_nonModal( ApplyCaller( *this ) ),
        m_type( type ){
-       GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() );
+       auto combo = ui::ComboBoxText();
 
        for ( ListAttributeType::const_iterator i = type.begin(); i != type.end(); ++i )
        {
-               gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), ( *i ).first.c_str() );
+               gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( combo ), ( *i ).first.c_str() );
        }
 
        gtk_widget_show( GTK_WIDGET( combo ) );
@@ -690,8 +677,8 @@ ListAttribute( const char* key, const ListAttributeType& type ) :
 void release(){
        delete this;
 }
-GtkWidget* getWidget() const {
-       return GTK_WIDGET( m_combo );
+ui::Widget getWidget() const {
+       return ui::Widget(GTK_WIDGET( m_combo ));
 }
 void apply(){
        Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), m_type[gtk_combo_box_get_active( m_combo )].second.c_str() );
@@ -715,8 +702,8 @@ typedef MemberCaller<ListAttribute, &ListAttribute::update> UpdateCaller;
 
 namespace
 {
-GtkWidget* g_entity_split1 = 0;
-GtkWidget* g_entity_split2 = 0;
+ui::Widget g_entity_split1;
+ui::Widget g_entity_split2;
 int g_entitysplit1_position;
 int g_entitysplit2_position;
 
@@ -873,10 +860,10 @@ void SurfaceFlags_setEntityClass( EntityClass* eclass ){
        {
                for ( int i = 0; i < g_spawnflag_count; ++i )
                {
-                       GtkWidget* widget = GTK_WIDGET( g_entitySpawnflagsCheck[i] );
-                       gtk_label_set_text( GTK_LABEL( GTK_BIN( widget )->child ), " " );
+                       ui::Widget widget = ui::Widget(GTK_WIDGET( g_entitySpawnflagsCheck[i] ));
+                       gtk_label_set_text( GTK_LABEL( gtk_bin_get_child(GTK_BIN(widget)) ), " " );
                        gtk_widget_hide( widget );
-                       gtk_widget_ref( widget );
+                       g_object_ref( widget );
                        gtk_container_remove( GTK_CONTAINER( g_spawnflagsTable ), widget );
                }
        }
@@ -886,7 +873,7 @@ void SurfaceFlags_setEntityClass( EntityClass* eclass ){
        {
                for ( int i = 0; i < g_spawnflag_count; ++i )
                {
-                       GtkWidget* widget = GTK_WIDGET( g_entitySpawnflagsCheck[i] );
+                       ui::Widget widget = ui::Widget(GTK_WIDGET( g_entitySpawnflagsCheck[i] ));
                        gtk_widget_show( widget );
 
                        StringOutputStream str( 16 );
@@ -895,9 +882,9 @@ void SurfaceFlags_setEntityClass( EntityClass* eclass ){
                        gtk_table_attach( g_spawnflagsTable, widget, i % 4, i % 4 + 1, i / 4, i / 4 + 1,
                                                          (GtkAttachOptions)( GTK_FILL ),
                                                          (GtkAttachOptions)( GTK_FILL ), 0, 0 );
-                       gtk_widget_unref( widget );
+                       g_object_unref( widget );
 
-                       gtk_label_set_text( GTK_LABEL( GTK_BIN( widget )->child ), str.c_str() );
+                       gtk_label_set_text( GTK_LABEL( gtk_bin_get_child(GTK_BIN(widget)) ), str.c_str() );
                }
        }
 }
@@ -913,7 +900,7 @@ void EntityClassList_selectEntityClass( EntityClass* eclass ){
                        GtkTreeView* view = g_entityClassList;
                        GtkTreePath* path = gtk_tree_model_get_path( model, &iter );
                        gtk_tree_selection_select_path( gtk_tree_view_get_selection( view ), path );
-                       if ( GTK_WIDGET_REALIZED( view ) ) {
+                       if ( gtk_widget_get_realized( GTK_WIDGET(view) ) ) {
                                gtk_tree_view_scroll_to_cell( view, path, 0, FALSE, 0, 0 );
                        }
                        gtk_tree_path_free( path );
@@ -1106,7 +1093,7 @@ void EntityClassList_createEntity(){
        GtkTreeModel* model;
        GtkTreeIter iter;
        if ( gtk_tree_selection_get_selected( gtk_tree_view_get_selection( view ), &model, &iter ) == FALSE ) {
-               gtk_MessageBox( gtk_widget_get_toplevel( GTK_WIDGET( g_entityClassList ) ), "You must have a selected class to create an entity", "info" );
+               ui::Widget(gtk_widget_get_toplevel( GTK_WIDGET( g_entityClassList ) )).alert( "You must have a selected class to create an entity", "info" );
                return;
        }
 
@@ -1134,14 +1121,14 @@ void EntityInspector_applyKeyValue(){
 
        // TTimo: if you change the classname to worldspawn you won't merge back in the structural brushes but create a parasite entity
        if ( !strcmp( key.c_str(), "classname" ) && !strcmp( value.c_str(), "worldspawn" ) ) {
-               gtk_MessageBox( gtk_widget_get_toplevel( GTK_WIDGET( g_entityKeyEntry ) ),  "Cannot change \"classname\" key back to worldspawn.", 0, eMB_OK );
+               ui::Widget(gtk_widget_get_toplevel( GTK_WIDGET( g_entityKeyEntry )) ).alert( "Cannot change \"classname\" key back to worldspawn.", 0, ui::alert_type::OK );
                return;
        }
 
 
        // RR2DO2: we don't want spaces in entity keys
        if ( strstr( key.c_str(), " " ) ) {
-               gtk_MessageBox( gtk_widget_get_toplevel( GTK_WIDGET( g_entityKeyEntry ) ), "No spaces are allowed in entity keys.", 0, eMB_OK );
+               ui::Widget(gtk_widget_get_toplevel( GTK_WIDGET( g_entityKeyEntry )) ).alert( "No spaces are allowed in entity keys.", 0, ui::alert_type::OK );
                return;
        }
 
@@ -1197,7 +1184,7 @@ static void EntityClassList_selection_changed( GtkTreeSelection* selection, gpoi
        }
 }
 
-static gint EntityClassList_button_press( GtkWidget *widget, GdkEventButton *event, gpointer data ){
+static gint EntityClassList_button_press( ui::Widget widget, GdkEventButton *event, gpointer data ){
        if ( event->type == GDK_2BUTTON_PRESS ) {
                EntityClassList_createEntity();
                return TRUE;
@@ -1205,7 +1192,7 @@ static gint EntityClassList_button_press( GtkWidget *widget, GdkEventButton *eve
        return FALSE;
 }
 
-static gint EntityClassList_keypress( GtkWidget* widget, GdkEventKey* event, gpointer data ){
+static gint EntityClassList_keypress( ui::Widget widget, GdkEventKey* event, gpointer data ){
        unsigned int code = gdk_keyval_to_upper( event->keyval );
 
        if ( event->keyval == GDK_Return ) {
@@ -1231,7 +1218,7 @@ static gint EntityClassList_keypress( GtkWidget* widget, GdkEventKey* event, gpo
                        if ( toupper( text[0] ) == (int)code ) {
                                GtkTreePath* path = gtk_tree_model_get_path( model, &iter );
                                gtk_tree_selection_select_path( gtk_tree_view_get_selection( view ), path );
-                               if ( GTK_WIDGET_REALIZED( view ) ) {
+                               if ( gtk_widget_get_realized( GTK_WIDGET(view) ) ) {
                                        gtk_tree_view_scroll_to_cell( view, path, 0, FALSE, 0, 0 );
                                }
                                gtk_tree_path_free( path );
@@ -1269,7 +1256,7 @@ static void EntityProperties_selection_changed( GtkTreeSelection* selection, gpo
        g_free( val );
 }
 
-static void SpawnflagCheck_toggled( GtkWidget *widget, gpointer data ){
+static void SpawnflagCheck_toggled( ui::Widget widget, gpointer data ){
        EntityInspector_applySpawnflags();
 }
 
@@ -1293,7 +1280,7 @@ static gint EntityEntry_keypress( GtkEntry* widget, GdkEventKey* event, gpointer
        return FALSE;
 }
 
-void EntityInspector_destroyWindow( GtkWidget* widget, gpointer data ){
+void EntityInspector_destroyWindow( ui::Widget widget, gpointer data ){
        g_entitysplit1_position = gtk_paned_get_position( GTK_PANED( g_entity_split1 ) );
        g_entitysplit2_position = gtk_paned_get_position( GTK_PANED( g_entity_split2 ) );
 
@@ -1301,22 +1288,22 @@ void EntityInspector_destroyWindow( GtkWidget* widget, gpointer data ){
        GlobalEntityAttributes_clear();
 }
 
-GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
-       GtkWidget* vbox = gtk_vbox_new( FALSE, 2 );
+ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
+       ui::Widget vbox = ui::VBox( FALSE, 2 );
        gtk_widget_show( vbox );
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 2 );
 
        g_signal_connect( G_OBJECT( vbox ), "destroy", G_CALLBACK( EntityInspector_destroyWindow ), 0 );
 
        {
-               GtkWidget* split1 = gtk_vpaned_new();
+               ui::Widget split1 = ui::VPaned();
                gtk_box_pack_start( GTK_BOX( vbox ), split1, TRUE, TRUE, 0 );
                gtk_widget_show( split1 );
 
                g_entity_split1 = split1;
 
                {
-                       GtkWidget* split2 = gtk_vpaned_new();
+                       ui::Widget split2 = ui::VPaned();
                        gtk_paned_add1( GTK_PANED( split1 ), split2 );
                        gtk_widget_show( split2 );
 
@@ -1324,7 +1311,7 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
 
                        {
                                // class list
-                               GtkWidget* scr = gtk_scrolled_window_new( 0, 0 );
+                               ui::Widget scr = ui::ScrolledWindow();
                                gtk_widget_show( scr );
                                gtk_paned_add1( GTK_PANED( split2 ), scr );
                                gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
@@ -1333,15 +1320,15 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
                                {
                                        GtkListStore* store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_POINTER );
 
-                                       GtkTreeView* view = GTK_TREE_VIEW( gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ) );
+                                       GtkTreeView* view = ui::TreeView( ui::TreeModel( GTK_TREE_MODEL( store ) ));
                                        gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), FALSE );
                                        gtk_tree_view_set_headers_visible( view, FALSE );
                                        g_signal_connect( G_OBJECT( view ), "button_press_event", G_CALLBACK( EntityClassList_button_press ), 0 );
                                        g_signal_connect( G_OBJECT( view ), "key_press_event", G_CALLBACK( EntityClassList_keypress ), 0 );
 
                                        {
-                                               GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
-                                               GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Key", renderer, "text", 0, 0 );
+                                               auto renderer = ui::CellRendererText();
+                                               GtkTreeViewColumn* column = ui::TreeViewColumn( "Key", renderer, {{"text", 0}} );
                                                gtk_tree_view_append_column( view, column );
                                        }
 
@@ -1361,14 +1348,14 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
                        }
 
                        {
-                               GtkWidget* scr = gtk_scrolled_window_new( 0, 0 );
+                               ui::Widget scr = ui::ScrolledWindow();
                                gtk_widget_show( scr );
                                gtk_paned_add2( GTK_PANED( split2 ), scr );
                                gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
                                gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
 
                                {
-                                       GtkTextView* text = GTK_TEXT_VIEW( gtk_text_view_new() );
+                                       GtkTextView* text = ui::TextView();
                                        gtk_widget_set_size_request( GTK_WIDGET( text ), 0, -1 ); // allow shrinking
                                        gtk_text_view_set_wrap_mode( text, GTK_WRAP_WORD );
                                        gtk_text_view_set_editable( text, FALSE );
@@ -1380,18 +1367,18 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
                }
 
                {
-                       GtkWidget* split2 = gtk_vpaned_new();
+                       ui::Widget split2 = ui::VPaned();
                        gtk_paned_add2( GTK_PANED( split1 ), split2 );
                        gtk_widget_show( split2 );
 
                        {
-                               GtkWidget* vbox2 = gtk_vbox_new( FALSE, 2 );
+                               ui::Widget vbox2 = ui::VBox( FALSE, 2 );
                                gtk_widget_show( vbox2 );
                                gtk_paned_pack1( GTK_PANED( split2 ), vbox2, FALSE, FALSE );
 
                                {
                                        // Spawnflags (4 colums wide max, or window gets too wide.)
-                                       GtkTable* table = GTK_TABLE( gtk_table_new( 4, 4, FALSE ) );
+                                       GtkTable* table = ui::Table( 4, 4, FALSE );
                                        gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( table ), FALSE, TRUE, 0 );
                                        gtk_widget_show( GTK_WIDGET( table ) );
 
@@ -1399,8 +1386,8 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
 
                                        for ( int i = 0; i < MAX_FLAGS; i++ )
                                        {
-                                               GtkCheckButton* check = GTK_CHECK_BUTTON( gtk_check_button_new_with_label( "" ) );
-                                               gtk_widget_ref( GTK_WIDGET( check ) );
+                                               GtkCheckButton* check = ui::CheckButton( "" );
+                                               g_object_ref( GTK_WIDGET( check ) );
                                                g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( SpawnflagCheck_toggled ), 0 ) ) );
                                                g_entitySpawnflagsCheck[i] = check;
                                        }
@@ -1408,7 +1395,7 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
 
                                {
                                        // key/value list
-                                       GtkWidget* scr = gtk_scrolled_window_new( 0, 0 );
+                                       ui::Widget scr = ui::ScrolledWindow();
                                        gtk_widget_show( scr );
                                        gtk_box_pack_start( GTK_BOX( vbox2 ), scr, TRUE, TRUE, 0 );
                                        gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
@@ -1417,19 +1404,19 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
                                        {
                                                GtkListStore* store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING );
 
-                                               GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+                                               ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
                                                gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), FALSE );
                                                gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
 
                                                {
-                                                       GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
-                                                       GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, 0 );
+                                                       auto renderer = ui::CellRendererText();
+                                                       GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
                                                        gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
                                                }
 
                                                {
-                                                       GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
-                                                       GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 1, 0 );
+                                                       auto renderer = ui::CellRendererText();
+                                                       GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 1}} );
                                                        gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
                                                }
 
@@ -1450,14 +1437,14 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
 
                                {
                                        // key/value entry
-                                       GtkTable* table = GTK_TABLE( gtk_table_new( 2, 2, FALSE ) );
+                                       GtkTable* table = ui::Table( 2, 2, FALSE );
                                        gtk_widget_show( GTK_WIDGET( table ) );
                                        gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( table ), FALSE, TRUE, 0 );
                                        gtk_table_set_row_spacings( table, 3 );
                                        gtk_table_set_col_spacings( table, 5 );
 
                                        {
-                                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                               GtkEntry* entry = ui::Entry();
                                                gtk_widget_show( GTK_WIDGET( entry ) );
                                                gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1,
                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
@@ -1468,7 +1455,7 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
                                        }
 
                                        {
-                                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                               GtkEntry* entry = ui::Entry();
                                                gtk_widget_show( GTK_WIDGET( entry ) );
                                                gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
@@ -1479,7 +1466,7 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
                                        }
 
                                        {
-                                               GtkLabel* label = GTK_LABEL( gtk_label_new( "Value" ) );
+                                               GtkLabel* label = GTK_LABEL( ui::Label( "Value" ) );
                                                gtk_widget_show( GTK_WIDGET( label ) );
                                                gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
                                                                                  (GtkAttachOptions)( GTK_FILL ),
@@ -1488,7 +1475,7 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
                                        }
 
                                        {
-                                               GtkLabel* label = GTK_LABEL( gtk_label_new( "Key" ) );
+                                               GtkLabel* label = GTK_LABEL( ui::Label( "Key" ) );
                                                gtk_widget_show( GTK_WIDGET( label ) );
                                                gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
                                                                                  (GtkAttachOptions)( GTK_FILL ),
@@ -1498,18 +1485,18 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
                                }
 
                                {
-                                       GtkBox* hbox = GTK_BOX( gtk_hbox_new( TRUE, 4 ) );
+                                       GtkBox* hbox = ui::HBox( TRUE, 4 );
                                        gtk_widget_show( GTK_WIDGET( hbox ) );
                                        gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( hbox ), FALSE, TRUE, 0 );
 
                                        {
-                                               GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Clear All" ) );
+                                               GtkButton* button = ui::Button( "Clear All" );
                                                gtk_widget_show( GTK_WIDGET( button ) );
                                                g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( EntityInspector_clearAllKeyValues ), 0 );
                                                gtk_box_pack_start( hbox, GTK_WIDGET( button ), TRUE, TRUE, 0 );
                                        }
                                        {
-                                               GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Delete Key" ) );
+                                               GtkButton* button = ui::Button( "Delete Key" );
                                                gtk_widget_show( GTK_WIDGET( button ) );
                                                g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( EntityInspector_clearKeyValue ), 0 );
                                                gtk_box_pack_start( hbox, GTK_WIDGET( button ), TRUE, TRUE, 0 );
@@ -1518,15 +1505,15 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
                        }
 
                        {
-                               GtkWidget* scr = gtk_scrolled_window_new( 0, 0 );
+                               ui::Widget scr = ui::ScrolledWindow();
                                gtk_widget_show( scr );
                                gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
 
-                               GtkWidget* viewport = gtk_viewport_new( 0, 0 );
+                               ui::Widget viewport = ui::Widget(gtk_viewport_new( 0, 0 ));
                                gtk_widget_show( viewport );
                                gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport ), GTK_SHADOW_NONE );
 
-                               g_attributeBox = GTK_VBOX( gtk_vbox_new( FALSE, 2 ) );
+                               g_attributeBox = ui::VBox( FALSE, 2 );
                                gtk_widget_show( GTK_WIDGET( g_attributeBox ) );
 
                                gtk_container_add( GTK_CONTAINER( viewport ), GTK_WIDGET( g_attributeBox ) );
index 1afa258463224104483383cb06be65730dbb07ce..e0d359ec57d984082375a3b8af259424b59d73fe 100644 (file)
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <uilib/uilib.h>
+
 #if !defined( INCLUDED_ENTITYINSPECTOR_H )
 #define INCLUDED_ENTITYINSPECTOR_H
 
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-GtkWidget* EntityInspector_constructWindow( GtkWindow* parent );
+ui::Widget EntityInspector_constructWindow( ui::Window parent );
 void EntityInspector_construct();
 void EntityInspector_destroy();
 const char *EntityInspector_getCurrentKey();
index 4fdc5b4ea6e83f0f20c45085aa4c0141f3336be2..a9b9a6681b0b918b5838fd3f53bf2d14ee409109 100644 (file)
 
 #include "iselection.h"
 
-#include <gtk/gtktreemodel.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
 
 #include "string/string.h"
 #include "scenelib.h"
@@ -62,7 +60,7 @@ EDirty m_dirty;
 IdleDraw m_idleDraw;
 WindowPositionTracker m_positionTracker;
 
-GtkWindow* m_window;
+ui::Window m_window;
 GtkTreeView* m_tree_view;
 GraphTreeModel* m_tree_model;
 bool m_selection_disabled;
@@ -75,7 +73,7 @@ EntityList() :
 }
 
 bool visible() const {
-       return GTK_WIDGET_VISIBLE( GTK_WIDGET( m_window ) );
+       return gtk_widget_get_visible( m_window );
 }
 };
 
@@ -282,10 +280,10 @@ void DetachEntityTreeModel(){
        gtk_tree_view_set_model( getEntityList().m_tree_view, 0 );
 }
 
-void EntityList_constructWindow( GtkWindow* main_window ){
-       ASSERT_MESSAGE( getEntityList().m_window == 0, "error" );
+void EntityList_constructWindow( ui::Window main_window ){
+       ASSERT_TRUE( !getEntityList().m_window );
 
-       GtkWindow* window = create_persistent_floating_window( "Entity List", main_window );
+       ui::Window window = ui::Window(create_persistent_floating_window( "Entity List", main_window ));
 
        gtk_window_add_accel_group( window, global_accel );
 
@@ -299,10 +297,10 @@ void EntityList_constructWindow( GtkWindow* main_window ){
                gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( scr ) );
 
                {
-                       GtkWidget* view = gtk_tree_view_new();
+                       ui::Widget view = ui::TreeView();
                        gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
 
-                       GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
+                       auto renderer = ui::CellRendererText();
                        GtkTreeViewColumn* column = gtk_tree_view_column_new();
                        gtk_tree_view_column_pack_start( column, renderer, TRUE );
                        gtk_tree_view_column_set_cell_data_func( column, renderer, entitylist_treeviewcolumn_celldatafunc, 0, 0 );
index e29f1b9a3a22cfdad20f24cfbc9c655fe30ea716..4830bb8d00b8b36525f9aea76c11fdbb8cb1394c 100644 (file)
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <uilib/uilib.h>
+
 #if !defined( INCLUDED_ENTITYLIST_H )
 #define INCLUDED_ENTITYLIST_H
 
 void EntityList_Construct();
 void EntityList_Destroy();
 
-typedef struct _GtkWindow GtkWindow;
-void EntityList_constructWindow( GtkWindow* main_window );
+void EntityList_constructWindow( ui::Window main_window );
 void EntityList_destroyWindow();
 void EntityList_toggleShown();
 
index 1d2856f58e8267ff54c0dcf6225234dfc307c341..bb565b843db58c585cc4e2323b26016bc174ce57 100644 (file)
 #include "igl.h"
 #include "iselection.h"
 
-#include <gtk/gtktreeview.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkscrolledwindow.h>
+#include <gtk/gtk.h>
 
 #include "map.h"
 #include "dialog.h"
@@ -279,7 +274,7 @@ void CDbgDlg::Push( ISAXHandler *pHandler ){
        // push in the list
        g_ptr_array_add( m_pFeedbackElements, (void *)pHandler );
 
-       if ( GetWidget() == 0 ) {
+       if ( !GetWidget() ) {
                Create();
        }
 
@@ -295,10 +290,10 @@ void CDbgDlg::Push( ISAXHandler *pHandler ){
        ShowDlg();
 }
 
-GtkWindow* CDbgDlg::BuildDialog(){
-       GtkWindow* window = create_floating_window( "Q3Map debug window", MainFrame_getWindow() );
+ui::Window CDbgDlg::BuildDialog(){
+       ui::Window window = MainFrame_getWindow().create_floating_window("Q3Map debug window" );
 
-       GtkWidget* scr = gtk_scrolled_window_new( NULL, NULL );
+       ui::Widget scr = ui::ScrolledWindow();
        gtk_widget_show( scr );
        gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( scr ) );
        gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
@@ -307,12 +302,12 @@ GtkWindow* CDbgDlg::BuildDialog(){
        {
                GtkListStore* store = gtk_list_store_new( 1, G_TYPE_STRING );
 
-               GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+               ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
                gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
 
                {
-                       GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
-                       GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, NULL );
+                       auto renderer = ui::CellRendererText();
+                       GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
                        gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
                }
 
index 04e98bb2d85ae26c48920caec664d13b58fd7caa..78f4fd045f0ad85546dd7066447dc8efb552d9eb 100644 (file)
@@ -171,13 +171,13 @@ void draw2D( VIEWTYPE viewType ){
        }
 }
 void destroyWindow(){
-       if ( GetWidget() != 0 ) {
+       if ( GetWidget() ) {
                Destroy();
        }
 }
 //  void HideDlg();
 protected:
-GtkWindow* BuildDialog();
+ui::Window BuildDialog();
 };
 
 extern CDbgDlg g_DbgDlg;
index 5fd58f7c426a7a1f0a001e3fdee569497918f3e6..13fad1c2f4bfb3d95244405706d7447a4580898b 100644 (file)
 
 #include "ishaders.h"
 
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtkcheckbutton.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkarrow.h>
+#include <gtk/gtk.h>
 
 #include "gtkutil/window.h"
 #include "stream/stringstream.h"
@@ -65,9 +55,9 @@ static void updateTextures( const char* name );
 
 FindTextureDialog();
 virtual ~FindTextureDialog();
-GtkWindow* BuildDialog();
+ui::Window BuildDialog();
 
-void constructWindow( GtkWindow* parent ){
+void constructWindow( ui::Window parent ){
        m_parent = parent;
        Create();
 }
@@ -95,7 +85,7 @@ void FindTextureDialog_apply(){
        FindReplaceTextures( find.c_str(), replace.c_str(), g_FindTextureDialog.m_bSelectedOnly );
 }
 
-static void OnApply( GtkWidget* widget, gpointer data ){
+static void OnApply( ui::Widget widget, gpointer data ){
        g_FindTextureDialog.exportData();
        FindTextureDialog_apply();
 }
@@ -111,17 +101,17 @@ static void OnOK( GtkWidget* widget, gpointer data ){
        g_FindTextureDialog.HideDlg();
 }
 
-static void OnClose( GtkWidget* widget, gpointer data ){
+static void OnClose( ui::Widget widget, gpointer data ){
        g_FindTextureDialog.HideDlg();
 }
 
 
-static gint find_focus_in( GtkWidget* widget, GdkEventFocus *event, gpointer data ){
+static gint find_focus_in( ui::Widget widget, GdkEventFocus *event, gpointer data ){
        g_bFindActive = true;
        return FALSE;
 }
 
-static gint replace_focus_in( GtkWidget* widget, GdkEventFocus *event, gpointer data ){
+static gint replace_focus_in( ui::Widget widget, GdkEventFocus *event, gpointer data ){
        g_bFindActive = false;
        return FALSE;
 }
@@ -137,42 +127,42 @@ FindTextureDialog::FindTextureDialog(){
 FindTextureDialog::~FindTextureDialog(){
 }
 
-GtkWindow* FindTextureDialog::BuildDialog(){
-       GtkWidget* vbox, *hbox, *table, *label;
-       GtkWidget* button, *check, *entry;
+ui::Window FindTextureDialog::BuildDialog(){
+       ui::Widget vbox, hbox, table, label;
+       ui::Widget button, check, entry;
 
-       GtkWindow* dlg = create_floating_window( "Find / Replace Texture(s)", m_parent );
+       ui::Window dlg = ui::Window(create_floating_window( "Find / Replace Texture(s)", m_parent ));
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_widget_show( hbox );
        gtk_container_add( GTK_CONTAINER( dlg ), GTK_WIDGET( hbox ) );
        gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 );
 
-       vbox = gtk_vbox_new( FALSE, 5 );
+       vbox = ui::VBox( FALSE, 5 );
        gtk_widget_show( vbox );
        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
 
-       table = gtk_table_new( 2, 2, FALSE );
+       table = ui::Table( 2, 2, FALSE );
        gtk_widget_show( table );
        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
        gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
 
-       label = gtk_label_new( "Find:" );
+       label = ui::Label( "Find:" );
        gtk_widget_show( label );
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
 
-       label = gtk_label_new( "Replace:" );
+       label = ui::Label( "Replace:" );
        gtk_widget_show( label );
        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
                                          (GtkAttachOptions) ( GTK_FILL ),
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
 
-       entry = gtk_entry_new();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -182,7 +172,7 @@ GtkWindow* FindTextureDialog::BuildDialog(){
        AddDialogData( *GTK_ENTRY( entry ), m_strFind );
        GlobalTextureEntryCompletion::instance().connect( GTK_ENTRY( entry ) );
 
-       entry = gtk_entry_new();
+       entry = ui::Entry();
        gtk_widget_show( entry );
        gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2,
                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -192,28 +182,28 @@ GtkWindow* FindTextureDialog::BuildDialog(){
        AddDialogData( *GTK_ENTRY( entry ), m_strReplace );
        GlobalTextureEntryCompletion::instance().connect( GTK_ENTRY( entry ) );
 
-       check = gtk_check_button_new_with_label( "Within selected brushes only" );
+       check = ui::CheckButton( "Within selected brushes only" );
        gtk_widget_show( check );
        gtk_box_pack_start( GTK_BOX( vbox ), check, TRUE, TRUE, 0 );
        AddDialogData( *GTK_TOGGLE_BUTTON( check ), m_bSelectedOnly );
 
-       vbox = gtk_vbox_new( FALSE, 5 );
+       vbox = ui::VBox( FALSE, 5 );
        gtk_widget_show( vbox );
        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), FALSE, FALSE, 0 );
 
-       button = gtk_button_new_with_label( "Apply" );
+       button = ui::Button( "Apply" );
        gtk_widget_show( button );
        gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
        g_signal_connect( G_OBJECT( button ), "clicked",
                                          G_CALLBACK( OnApply ), 0 );
-       gtk_widget_set_usize( button, 60, -2 );
+       gtk_widget_set_size_request( button, 60, -1 );
 
-       button = gtk_button_new_with_label( "Close" );
+       button = ui::Button( "Close" );
        gtk_widget_show( button );
        gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
        g_signal_connect( G_OBJECT( button ), "clicked",
                                          G_CALLBACK( OnClose ), 0 );
-       gtk_widget_set_usize( button, 60, -2 );
+       gtk_widget_set_size_request( button, 60, -1 );
 
        return dlg;
 }
@@ -231,7 +221,7 @@ void FindTextureDialog::updateTextures( const char* name ){
 }
 
 bool FindTextureDialog::isOpen(){
-       return GTK_WIDGET_VISIBLE( g_FindTextureDialog.GetWidget() ) == TRUE;
+       return gtk_widget_get_visible( g_FindTextureDialog.GetWidget() ) == TRUE;
 }
 
 void FindTextureDialog::setFindStr( const char* name ){
@@ -251,7 +241,7 @@ void FindTextureDialog::show(){
 }
 
 
-void FindTextureDialog_constructWindow( GtkWindow* main_window ){
+void FindTextureDialog_constructWindow( ui::Window main_window ){
        g_FindTextureDialog.constructWindow( main_window );
 }
 
index 2bf06dbbde57f02295ed75bd9cb9bcb327a57d28..66022e8b3451cd4c57415e032fcb7906a999e955 100644 (file)
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <uilib/uilib.h>
+
 #if !defined( INCLUDED_FINDTEXTUREDIALOG_H )
 #define INCLUDED_FINDTEXTUREDIALOG_H
 
 void FindTextureDialog_Construct();
 void FindTextureDialog_Destroy();
 
-typedef struct _GtkWindow GtkWindow;
-void FindTextureDialog_constructWindow( GtkWindow* main_window );
+void FindTextureDialog_constructWindow( ui::Window main_window );
 void FindTextureDialog_destroyWindow();
 bool FindTextureDialog_isOpen();
 void FindTextureDialog_selectTexture( const char* name );
index 2e717d121d631d44e8cabdb96b665e749f278f14..7b954535adc1c9a0cb064930f142b226aff3df19 100644 (file)
 
 #include <vector>
 
-#include <gtk/gtknotebook.h>
-#include <gtk/gtktextview.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkscrolledwindow.h>
+#include <gtk/gtk.h>
 
 #include "gtkutil/widget.h"
 #include "gtkutil/accelerator.h"
 #include "commands.h"
 
 
-#include <gtk/gtkwidget.h>
 #include "gtkutil/window.h"
 
 class GroupDlg
 {
 public:
-GtkWidget* m_pNotebook;
-GtkWindow* m_window;
+ui::Widget m_pNotebook;
+ui::Window m_window;
 
 GroupDlg();
-void Create( GtkWindow* parent );
+void Create( ui::Window parent );
 
 void Show(){
        // workaround for strange gtk behaviour - modifying the contents of a window while it is not visible causes the window position to change without sending a configure_event
@@ -78,14 +74,14 @@ std::size_t g_current_page;
 std::vector<StringExportCallback> g_pages;
 }
 
-void GroupDialog_updatePageTitle( GtkWindow* window, std::size_t pageIndex ){
+void GroupDialog_updatePageTitle( ui::Window window, std::size_t pageIndex ){
        if ( pageIndex < g_pages.size() ) {
                g_pages[pageIndex]( PointerCaller1<GtkWindow, const char*, gtk_window_set_title>( window ) );
        }
 }
 
-static gboolean switch_page( GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer data ){
-       GroupDialog_updatePageTitle( GTK_WINDOW( data ), page_num );
+static gboolean switch_page( GtkNotebook *notebook, gpointer page, guint page_num, gpointer data ){
+       GroupDialog_updatePageTitle( ui::Window(GTK_WINDOW( data )), page_num );
        g_current_page = page_num;
 
        return FALSE;
@@ -95,10 +91,10 @@ GroupDlg::GroupDlg() : m_window( 0 ){
        m_position_tracker.setPosition( c_default_window_pos );
 }
 
-void GroupDlg::Create( GtkWindow* parent ){
-       ASSERT_MESSAGE( m_window == 0, "dialog already created" );
+void GroupDlg::Create( ui::Window parent ){
+       ASSERT_MESSAGE( !m_window, "dialog already created" );
 
-       GtkWindow* window = create_persistent_floating_window( "Entities", parent );
+       ui::Window window = ui::Window(create_persistent_floating_window( "Entities", parent ));
 
        global_accel_connect_window( window );
 
@@ -116,21 +112,21 @@ void GroupDlg::Create( GtkWindow* parent ){
        m_position_tracker.connect( window );
 
        {
-               GtkWidget* notebook = gtk_notebook_new();
+               ui::Widget notebook = ui::Widget(gtk_notebook_new());
                gtk_widget_show( notebook );
                gtk_container_add( GTK_CONTAINER( window ), notebook );
                gtk_notebook_set_tab_pos( GTK_NOTEBOOK( notebook ), GTK_POS_BOTTOM );
                m_pNotebook = notebook;
 
-               g_signal_connect( G_OBJECT( notebook ), "switch_page", G_CALLBACK( switch_page ), window );
+               g_signal_connect( G_OBJECT(notebook), "switch_page", G_CALLBACK( switch_page ), (gpointer) window );
        }
 }
 
 
-GtkWidget* GroupDialog_addPage( const char* tabLabel, GtkWidget* widget, const StringExportCallback& title ){
-       GtkWidget* w = gtk_label_new( tabLabel );
+ui::Widget GroupDialog_addPage( const char* tabLabel, ui::Widget widget, const StringExportCallback& title ){
+       ui::Widget w = ui::Label( tabLabel );
        gtk_widget_show( w );
-       GtkWidget* page = gtk_notebook_get_nth_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), gtk_notebook_insert_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), widget, w, -1 ) );
+       ui::Widget page = ui::Widget(gtk_notebook_get_nth_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), gtk_notebook_insert_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), widget, w, -1 ) ));
        g_pages.push_back( title );
 
        return page;
@@ -147,33 +143,33 @@ void GroupDialog_ToggleShow(){
        GroupDialog_setShown( !GroupDialog_isShown() );
 }
 
-void GroupDialog_constructWindow( GtkWindow* main_window ){
+void GroupDialog_constructWindow( ui::Window main_window ){
        g_GroupDlg.Create( main_window );
 }
 void GroupDialog_destroyWindow(){
-       ASSERT_NOTNULL( g_GroupDlg.m_window );
+       ASSERT_TRUE( g_GroupDlg.m_window );
        destroy_floating_window( g_GroupDlg.m_window );
-       g_GroupDlg.m_window = 0;
+       g_GroupDlg.m_window = ui::Window();
 }
 
 
-GtkWindow* GroupDialog_getWindow(){
-       return g_GroupDlg.m_window;
+ui::Window GroupDialog_getWindow(){
+       return ui::Window(g_GroupDlg.m_window);
 }
 void GroupDialog_show(){
        g_GroupDlg.Show();
 }
 
-GtkWidget* GroupDialog_getPage(){
-       return gtk_notebook_get_nth_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), gint( g_current_page ) );
+ui::Widget GroupDialog_getPage(){
+       return ui::Widget(gtk_notebook_get_nth_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), gint( g_current_page ) ));
 }
 
-void GroupDialog_setPage( GtkWidget* page ){
+void GroupDialog_setPage( ui::Widget page ){
        g_current_page = gtk_notebook_page_num( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), page );
        gtk_notebook_set_current_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), gint( g_current_page ) );
 }
 
-void GroupDialog_showPage( GtkWidget* page ){
+void GroupDialog_showPage( ui::Widget page ){
        if ( GroupDialog_getPage() == page ) {
                GroupDialog_ToggleShow();
        }
@@ -189,7 +185,7 @@ void GroupDialog_cycle(){
        gtk_notebook_set_current_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), gint( g_current_page ) );
 }
 
-void GroupDialog_updatePageTitle( GtkWidget* page ){
+void GroupDialog_updatePageTitle( ui::Widget page ){
        if ( GroupDialog_getPage() == page ) {
                GroupDialog_updatePageTitle( g_GroupDlg.m_window, g_current_page );
        }
index 349802b17b7696d6ff790ba5d890c82fb7c8f374..50e880b4c6f9725dcddfbfdcb6650c5222464753 100644 (file)
 #if !defined( INCLUDED_GROUPDIALOG_H )
 #define INCLUDED_GROUPDIALOG_H
 
+#include <uilib/uilib.h>
 #include "generic/callback.h"
 
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-
 void GroupDialog_Construct();
 void GroupDialog_Destroy();
 
-void GroupDialog_constructWindow( GtkWindow* main_window );
+void GroupDialog_constructWindow( ui::Window main_window );
 void GroupDialog_destroyWindow();
-GtkWindow* GroupDialog_getWindow();
+ui::Window GroupDialog_getWindow();
 void GroupDialog_show();
 
 inline void RawStringExport( const char* string, const StringImportCallback& importer ){
        importer( string );
 }
 typedef ConstPointerCaller1<char, const StringImportCallback&, RawStringExport> RawStringExportCaller;
-GtkWidget* GroupDialog_addPage( const char* tabLabel, GtkWidget* widget, const StringExportCallback& title );
+ui::Widget GroupDialog_addPage( const char* tabLabel, ui::Widget widget, const StringExportCallback& title );
 
-void GroupDialog_showPage( GtkWidget* page );
-void GroupDialog_updatePageTitle( GtkWidget* page );
+void GroupDialog_showPage( ui::Widget page );
+void GroupDialog_updatePageTitle( ui::Widget page );
 bool GroupDialog_isShown();
-GtkWidget* GroupDialog_getPage();
+ui::Widget GroupDialog_getPage();
 
 #endif
index dbc3abd671b7c8d6ec7a9da034569f6655505d1c..7b71b3d9cbb217392d01500d9ebbb1fca17c1ac8 100644 (file)
 #include "iselection.h"
 
 #include <gdk/gdkkeysyms.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkcombobox.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtktextview.h>
-#include <gtk/gtktextbuffer.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkliststore.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
 
 #include "os/path.h"
 #include "math/aabb.h"
@@ -167,11 +153,11 @@ inline void path_copy_clean( char* destination, const char* source ){
 
 struct GameCombo
 {
-       GtkComboBox* game_select;
+       ui::ComboBoxText game_select;
        GtkEntry* fsgame_entry;
 };
 
-gboolean OnSelchangeComboWhatgame( GtkWidget *widget, GameCombo* combo ){
+gboolean OnSelchangeComboWhatgame( ui::Widget widget, GameCombo* combo ){
        const char *gamename;
        {
                GtkTreeIter iter;
@@ -214,8 +200,8 @@ GameCombo game_combo;
 GtkComboBox* gamemode_combo;
 };
 
-GtkWindow* ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, ModalDialog& modal ){
-       GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Project Settings", G_CALLBACK( dialog_delete_callback ), &modal );
+ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, ModalDialog& modal ){
+       ui::Window window = MainFrame_getWindow().create_dialog_window("Project Settings", G_CALLBACK(dialog_delete_callback ), &modal );
 
        {
                GtkTable* table1 = create_dialog_table( 1, 2, 4, 4, 4 );
@@ -244,7 +230,7 @@ GtkWindow* ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal
                                gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( table2 ) );
 
                                {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Select mod" ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( "Select mod" ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table2, GTK_WIDGET( label ), 0, 1, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -252,13 +238,13 @@ GtkWindow* ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal
                                        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
                                }
                                {
-                                       dialog.game_combo.game_select = GTK_COMBO_BOX( gtk_combo_box_new_text() );
+                                       dialog.game_combo.game_select = ui::ComboBoxText();
 
-                                       gtk_combo_box_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().basegame );
+                                       gtk_combo_box_text_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().basegame );
                                        if ( globalGameComboConfiguration().known[0] != '\0' ) {
-                                               gtk_combo_box_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().known );
+                                               gtk_combo_box_text_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().known );
                                        }
-                                       gtk_combo_box_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().custom );
+                                       gtk_combo_box_text_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().custom );
 
                                        gtk_widget_show( GTK_WIDGET( dialog.game_combo.game_select ) );
                                        gtk_table_attach( table2, GTK_WIDGET( dialog.game_combo.game_select ), 1, 2, 0, 1,
@@ -269,7 +255,7 @@ GtkWindow* ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal
                                }
 
                                {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "fs_game" ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( "fs_game" ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table2, GTK_WIDGET( label ), 0, 1, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -277,7 +263,7 @@ GtkWindow* ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal
                                        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
                                }
                                {
-                                       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                       GtkEntry* entry = ui::Entry();
                                        gtk_widget_show( GTK_WIDGET( entry ) );
                                        gtk_table_attach( table2, GTK_WIDGET( entry ), 1, 2, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -287,16 +273,16 @@ GtkWindow* ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal
                                }
 
                                if ( globalMappingMode().do_mapping_mode ) {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Mapping mode" ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( "Mapping mode" ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table2, GTK_WIDGET( label ), 0, 1, 3, 4,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
 
-                                       GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() );
-                                       gtk_combo_box_append_text( combo, globalMappingMode().sp_mapping_mode );
-                                       gtk_combo_box_append_text( combo, globalMappingMode().mp_mapping_mode );
+                                       auto combo = ui::ComboBoxText();
+                                       gtk_combo_box_text_append_text( combo, globalMappingMode().sp_mapping_mode );
+                                       gtk_combo_box_text_append_text( combo, globalMappingMode().mp_mapping_mode );
 
                                        gtk_widget_show( GTK_WIDGET( combo ) );
                                        gtk_table_attach( table2, GTK_WIDGET( combo ), 1, 2, 3, 4,
@@ -366,7 +352,7 @@ void DoProjectSettings(){
                ModalDialog modal;
                ProjectSettingsDialog dialog;
 
-               GtkWindow* window = ProjectSettingsDialog_construct( dialog, modal );
+               ui::Window window = ProjectSettingsDialog_construct( dialog, modal );
 
                if ( modal_dialog_show( window, modal ) == eIDOK ) {
                        ProjectSettingsDialog_ok( dialog );
@@ -383,21 +369,21 @@ void DoSides( int type, int axis ){
        ModalDialog dialog;
        GtkEntry* sides_entry;
 
-       GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Arbitrary sides", G_CALLBACK( dialog_delete_callback ), &dialog );
+       ui::Window window = MainFrame_getWindow().create_dialog_window("Arbitrary sides", G_CALLBACK(dialog_delete_callback ), &dialog );
 
-       GtkAccelGroup* accel = gtk_accel_group_new();
+       GtkAccelGroup* accel = ui::AccelGroup();
        gtk_window_add_accel_group( window, accel );
 
        {
                GtkHBox* hbox = create_dialog_hbox( 4, 4 );
                gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) );
                {
-                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Sides:" ) );
+                       GtkLabel* label = GTK_LABEL( ui::Label( "Sides:" ) );
                        gtk_widget_show( GTK_WIDGET( label ) );
                        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
                }
                {
-                       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                       GtkEntry* entry = ui::Entry();
                        gtk_widget_show( GTK_WIDGET( entry ) );
                        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( entry ), FALSE, FALSE, 0 );
                        sides_entry = entry;
@@ -432,13 +418,13 @@ void DoSides( int type, int axis ){
 // =============================================================================
 // About dialog (no program is complete without one)
 
-void about_button_changelog( GtkWidget *widget, gpointer data ){
+void about_button_changelog( ui::Widget widget, gpointer data ){
        StringOutputStream log( 256 );
        log << "https://gitlab.com/xonotic/netradiant/commits/master";
        OpenURL( log.c_str() );
 }
 
-void about_button_credits( GtkWidget *widget, gpointer data ){
+void about_button_credits( ui::Widget widget, gpointer data ){
        StringOutputStream cred( 256 );
        cred << "https://gitlab.com/xonotic/netradiant/graphs/master";
        OpenURL( cred.c_str() );
@@ -454,7 +440,7 @@ void DoAbout(){
        ModalDialog dialog;
        ModalDialogButton ok_button( dialog, eIDOK );
 
-       GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "About NetRadiant", dialog );
+       ui::Window window = MainFrame_getWindow().create_modal_dialog_window("About NetRadiant", dialog );
 
        {
                GtkVBox* vbox = create_dialog_vbox( 4, 4 );
@@ -479,15 +465,16 @@ void DoAbout(){
                        }
 
                        {
-                               GtkLabel* label = GTK_LABEL( gtk_label_new( "NetRadiant " RADIANT_VERSION "\n"
-                                                                                                                       __DATE__ "\n\n"
-                                                                                                                       RADIANT_ABOUTMSG "\n\n"
-                                                                                                                                                        "By xonotic.org\n\n"
-                                                                                                                                                        "This program is free software\n"
-                                                                                                                                                        "licensed under the GNU GPL.\n\n"
-                                                                                                                                                        "NetRadiant is unsupported, however\n"
-                                                                                                                                                        "you may report your problems on issue tracker.\n"
-                                                                                                                       ) );
+                               char const *label_text = "NetRadiant " RADIANT_VERSION "\n"
+                                                                               __DATE__ "\n\n"
+                                        RADIANT_ABOUTMSG "\n\n"
+                                                                               "This program is free software\n"
+                                                                               "licensed under the GNU GPL.\n\n"
+                                                                               "NetRadiant is unsupported, however\n"
+                                                                               "you may report your problems at\n"
+                                                                               "https://gitlab.com/xonotic/netradiant/issues";
+
+                               GtkLabel* label = GTK_LABEL( ui::Label( label_text ) );
 
                                gtk_widget_show( GTK_WIDGET( label ) );
                                gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
@@ -523,7 +510,7 @@ void DoAbout(){
                                GtkTable* table = create_dialog_table( 3, 2, 4, 4, 4 );
                                gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( table ) );
                                {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Vendor:" ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( "Vendor:" ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -531,7 +518,7 @@ void DoAbout(){
                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                }
                                {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Version:" ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( "Version:" ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -539,7 +526,7 @@ void DoAbout(){
                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                }
                                {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Renderer:" ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( "Renderer:" ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 2, 3,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -547,7 +534,7 @@ void DoAbout(){
                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                }
                                {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( reinterpret_cast<const char*>( glGetString( GL_VENDOR ) ) ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( reinterpret_cast<const char*>( glGetString( GL_VENDOR ) ) ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -555,7 +542,7 @@ void DoAbout(){
                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                }
                                {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( reinterpret_cast<const char*>( glGetString( GL_VERSION ) ) ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( reinterpret_cast<const char*>( glGetString( GL_VERSION ) ) ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -563,7 +550,7 @@ void DoAbout(){
                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                }
                                {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( reinterpret_cast<const char*>( glGetString( GL_RENDERER ) ) ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( reinterpret_cast<const char*>( glGetString( GL_RENDERER ) ) ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 2, 3,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -578,7 +565,7 @@ void DoAbout(){
                                        GtkScrolledWindow* sc_extensions = create_scrolled_window( GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS, 4 );
                                        gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( sc_extensions ) );
                                        {
-                                               GtkWidget* text_extensions = gtk_text_view_new();
+                                               ui::Widget text_extensions = ui::TextView();
                                                gtk_text_view_set_editable( GTK_TEXT_VIEW( text_extensions ), FALSE );
                                                gtk_container_add( GTK_CONTAINER( sc_extensions ), text_extensions );
                                                GtkTextBuffer* buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( text_extensions ) );
@@ -610,9 +597,9 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
        GtkEntry* x;
        GtkEntry* y;
 
-       GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "Patch texture layout", dialog );
+       ui::Window window = MainFrame_getWindow().create_modal_dialog_window("Patch texture layout", dialog );
 
-       GtkAccelGroup* accel = gtk_accel_group_new();
+       GtkAccelGroup* accel = ui::AccelGroup();
        gtk_window_add_accel_group( window, accel );
 
        {
@@ -622,7 +609,7 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
                        GtkVBox* vbox = create_dialog_vbox( 4 );
                        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
                        {
-                               GtkLabel* label = GTK_LABEL( gtk_label_new( "Texture will be fit across the patch based\n"
+                               GtkLabel* label = GTK_LABEL( ui::Label( "Texture will be fit across the patch based\n"
                                                                                                                        "on the x and y values given. Values of 1x1\n"
                                                                                                                        "will \"fit\" the texture. 2x2 will repeat\n"
                                                                                                                        "it twice, etc." ) );
@@ -635,7 +622,7 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
                                gtk_widget_show( GTK_WIDGET( table ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
                                {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Texture x:" ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( "Texture x:" ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -643,7 +630,7 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                }
                                {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Texture y:" ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( "Texture y:" ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -651,7 +638,7 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                }
                                {
-                                       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                       GtkEntry* entry = ui::Entry();
                                        gtk_widget_show( GTK_WIDGET( entry ) );
                                        gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -660,7 +647,7 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
                                        x = entry;
                                }
                                {
-                                       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                       GtkEntry* entry = ui::Entry();
                                        gtk_widget_show( GTK_WIDGET( entry ) );
                                        gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -718,11 +705,11 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
 // Text Editor dialog
 
 // master window widget
-static GtkWidget *text_editor = 0;
-static GtkWidget *text_widget; // slave, text widget from the gtk editor
+static ui::Widget text_editor;
+static ui::Widget text_widget; // slave, text widget from the gtk editor
 
-static gint editor_delete( GtkWidget *widget, gpointer data ){
-       if ( gtk_MessageBox( widget, "Close the shader editor ?", "Radiant", eMB_YESNO, eMB_ICONQUESTION ) == eIDNO ) {
+static gint editor_delete( ui::Widget widget, gpointer data ){
+       if ( widget.alert( "Close the shader editor ?", "Radiant", ui::alert_type::YESNO, ui::alert_icon::Question ) == ui::alert_response::NO ) {
                return TRUE;
        }
 
@@ -731,12 +718,12 @@ static gint editor_delete( GtkWidget *widget, gpointer data ){
        return TRUE;
 }
 
-static void editor_save( GtkWidget *widget, gpointer data ){
+static void editor_save( ui::Widget widget, gpointer data ){
        FILE *f = fopen( (char*)g_object_get_data( G_OBJECT( data ), "filename" ), "w" );
        gpointer text = g_object_get_data( G_OBJECT( data ), "text" );
 
        if ( f == 0 ) {
-               gtk_MessageBox( GTK_WIDGET( data ), "Error saving file !" );
+               ui::Widget(GTK_WIDGET( data )).alert( "Error saving file !" );
                return;
        }
 
@@ -745,8 +732,8 @@ static void editor_save( GtkWidget *widget, gpointer data ){
        fclose( f );
 }
 
-static void editor_close( GtkWidget *widget, gpointer data ){
-       if ( gtk_MessageBox( text_editor, "Close the shader editor ?", "Radiant", eMB_YESNO, eMB_ICONQUESTION ) == eIDNO ) {
+static void editor_close( ui::Widget widget, gpointer data ){
+       if ( text_editor.alert( "Close the shader editor ?", "Radiant", ui::alert_type::YESNO, ui::alert_icon::Question ) == ui::alert_response::NO ) {
                return;
        }
 
@@ -754,49 +741,49 @@ static void editor_close( GtkWidget *widget, gpointer data ){
 }
 
 static void CreateGtkTextEditor(){
-       GtkWidget *dlg;
-       GtkWidget *vbox, *hbox, *button, *scr, *text;
+       ui::Widget dlg;
+       ui::Widget vbox, hbox, button, scr, text;
 
-       dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       dlg = ui::Window( ui::window_type::TOP );
 
        g_signal_connect( G_OBJECT( dlg ), "delete_event",
                                          G_CALLBACK( editor_delete ), 0 );
        gtk_window_set_default_size( GTK_WINDOW( dlg ), 600, 300 );
 
-       vbox = gtk_vbox_new( FALSE, 5 );
+       vbox = ui::VBox( FALSE, 5 );
        gtk_widget_show( vbox );
        gtk_container_add( GTK_CONTAINER( dlg ), GTK_WIDGET( vbox ) );
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
 
-       scr = gtk_scrolled_window_new( 0, 0 );
+       scr = ui::ScrolledWindow();
        gtk_widget_show( scr );
        gtk_box_pack_start( GTK_BOX( vbox ), scr, TRUE, TRUE, 0 );
        gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
        gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
 
-       text = gtk_text_view_new();
+       text = ui::TextView();
        gtk_container_add( GTK_CONTAINER( scr ), text );
        gtk_widget_show( text );
-       g_object_set_data( G_OBJECT( dlg ), "text", text );
+       g_object_set_data( G_OBJECT( dlg ), "text", (gpointer) text );
        gtk_text_view_set_editable( GTK_TEXT_VIEW( text ), TRUE );
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_widget_show( hbox );
        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), FALSE, TRUE, 0 );
 
-       button = gtk_button_new_with_label( "Close" );
+       button = ui::Button( "Close" );
        gtk_widget_show( button );
        gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
        g_signal_connect( G_OBJECT( button ), "clicked",
                                          G_CALLBACK( editor_close ), dlg );
-       gtk_widget_set_usize( button, 60, -2 );
+       gtk_widget_set_size_request( button, 60, -1 );
 
-       button = gtk_button_new_with_label( "Save" );
+       button = ui::Button( "Save" );
        gtk_widget_show( button );
        gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
        g_signal_connect( G_OBJECT( button ), "clicked",
                                          G_CALLBACK( editor_save ), dlg );
-       gtk_widget_set_usize( button, 60, -2 );
+       gtk_widget_set_size_request( button, 60, -1 );
 
        text_editor = dlg;
        text_widget = text;
@@ -871,9 +858,9 @@ EMessageBoxReturn DoLightIntensityDlg( int *intensity ){
        ModalDialogButton ok_button( dialog, eIDOK );
        ModalDialogButton cancel_button( dialog, eIDCANCEL );
 
-       GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "Light intensity", dialog, -1, -1 );
+       ui::Window window = MainFrame_getWindow().create_modal_dialog_window("Light intensity", dialog, -1, -1 );
 
-       GtkAccelGroup *accel_group = gtk_accel_group_new();
+       GtkAccelGroup *accel_group = ui::AccelGroup();
        gtk_window_add_accel_group( window, accel_group );
 
        {
@@ -883,12 +870,12 @@ EMessageBoxReturn DoLightIntensityDlg( int *intensity ){
                        GtkVBox* vbox = create_dialog_vbox( 4 );
                        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
                        {
-                               GtkLabel* label = GTK_LABEL( gtk_label_new( "ESC for default, ENTER to validate" ) );
+                               GtkLabel* label = GTK_LABEL( ui::Label( "ESC for default, ENTER to validate" ) );
                                gtk_widget_show( GTK_WIDGET( label ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
                        }
                        {
-                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                               GtkEntry* entry = ui::Entry();
                                gtk_widget_show( GTK_WIDGET( entry ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
 
@@ -938,9 +925,9 @@ EMessageBoxReturn DoShaderTagDlg( CopiedString* tag, char* title ){
        ModalDialogButton ok_button( dialog, eIDOK );
        ModalDialogButton cancel_button( dialog, eIDCANCEL );
 
-       GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), title, dialog, -1, -1 );
+       ui::Window window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 );
 
-       GtkAccelGroup *accel_group = gtk_accel_group_new();
+       GtkAccelGroup *accel_group = ui::AccelGroup();
        gtk_window_add_accel_group( window, accel_group );
 
        {
@@ -951,12 +938,12 @@ EMessageBoxReturn DoShaderTagDlg( CopiedString* tag, char* title ){
                        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
                        {
                                //GtkLabel* label = GTK_LABEL(gtk_label_new("Enter one ore more tags separated by spaces"));
-                               GtkLabel* label = GTK_LABEL( gtk_label_new( "ESC to cancel, ENTER to validate" ) );
+                               GtkLabel* label = GTK_LABEL( ui::Label( "ESC to cancel, ENTER to validate" ) );
                                gtk_widget_show( GTK_WIDGET( label ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
                        }
                        {
-                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                               GtkEntry* entry = ui::Entry();
                                gtk_widget_show( GTK_WIDGET( entry ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
 
@@ -997,9 +984,9 @@ EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, char*
        ModalDialog dialog;
        ModalDialogButton ok_button( dialog, eIDOK );
 
-       GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), title, dialog, -1, -1 );
+       ui::Window window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 );
 
-       GtkAccelGroup *accel_group = gtk_accel_group_new();
+       GtkAccelGroup *accel_group = ui::AccelGroup();
        gtk_window_add_accel_group( window, accel_group );
 
        {
@@ -1009,22 +996,22 @@ EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, char*
                        GtkVBox* vbox = create_dialog_vbox( 4 );
                        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), FALSE, FALSE, 0 );
                        {
-                               GtkLabel* label = GTK_LABEL( gtk_label_new( "The selected shader" ) );
+                               GtkLabel* label = GTK_LABEL( ui::Label( "The selected shader" ) );
                                gtk_widget_show( GTK_WIDGET( label ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
                        }
                        {
-                               GtkLabel* label = GTK_LABEL( gtk_label_new( name ) );
+                               GtkLabel* label = GTK_LABEL( ui::Label( name ) );
                                gtk_widget_show( GTK_WIDGET( label ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
                        }
                        {
-                               GtkLabel* label = GTK_LABEL( gtk_label_new( "is located in file" ) );
+                               GtkLabel* label = GTK_LABEL( ui::Label( "is located in file" ) );
                                gtk_widget_show( GTK_WIDGET( label ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
                        }
                        {
-                               GtkLabel* label = GTK_LABEL( gtk_label_new( filename ) );
+                               GtkLabel* label = GTK_LABEL( ui::Label( filename ) );
                                gtk_widget_show( GTK_WIDGET( label ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
                        }
@@ -1063,7 +1050,7 @@ void DoTextEditor( const char* filename, int cursorpos ){
 #ifdef WIN32
        if ( g_TextEditor_useWin32Editor ) {
                globalOutputStream() << "opening file '" << filename << "' (line " << cursorpos << " info ignored)\n";
-               ShellExecute( (HWND)GDK_WINDOW_HWND( GTK_WIDGET( MainFrame_getWindow() )->window ), "open", filename, 0, 0, SW_SHOW );
+               ShellExecute( (HWND)GDK_WINDOW_HWND( gtk_widget_get_window( MainFrame_getWindow() ) ), "open", filename, 0, 0, SW_SHOW );
                return;
        }
 #else
index 59dab2a9187265a454ad75883178f2d941b8f259..a2e6e5c7908cf0784d0d310fa734095f8e1f136a 100644 (file)
@@ -34,8 +34,8 @@
 
 #include "gtkmisc.h"
 
-#include <gtk/gtkcolorseldialog.h>
-#include <gtk/gtkentry.h>
+#include <gtk/gtk.h>
+#include "uilib/uilib.h"
 
 #include "math/vector.h"
 #include "os/path.h"
@@ -86,47 +86,40 @@ GtkMenuItem* create_menu_item_with_mnemonic( GtkMenu* menu, const char *mnemonic
        return create_menu_item_with_mnemonic( menu, mnemonic, command );
 }
 
-GtkButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const char* commandName ){
+GtkToolButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const char* commandName ){
        return toolbar_append_button( toolbar, description, icon, GlobalCommands_find( commandName ) );
 }
 
-GtkToggleButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const char* commandName ){
+GtkToggleToolButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const char* commandName ){
        return toolbar_append_toggle_button( toolbar, description, icon, GlobalToggles_find( commandName ) );
 }
 
 // =============================================================================
 // File dialog
 
-bool color_dialog( GtkWidget *parent, Vector3& color, const char* title ){
-       GtkWidget* dlg;
-       double clr[3];
+bool color_dialog( ui::Widget parent, Vector3& color, const char* title ){
+       ui::Widget dlg;
+       GdkColor clr = { 0, guint16(color[0] * 65535), guint16(color[1] * 65535), guint16(color[2] * 65535) };
        ModalDialog dialog;
 
-       clr[0] = color[0];
-       clr[1] = color[1];
-       clr[2] = color[2];
-
-       dlg = gtk_color_selection_dialog_new( title );
-       gtk_color_selection_set_color( GTK_COLOR_SELECTION( GTK_COLOR_SELECTION_DIALOG( dlg )->colorsel ), clr );
+       dlg = ui::Widget(gtk_color_selection_dialog_new( title ));
+       gtk_color_selection_set_current_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG( dlg )) ), &clr );
        g_signal_connect( G_OBJECT( dlg ), "delete_event", G_CALLBACK( dialog_delete_callback ), &dialog );
-       g_signal_connect( G_OBJECT( GTK_COLOR_SELECTION_DIALOG( dlg )->ok_button ), "clicked", G_CALLBACK( dialog_button_ok ), &dialog );
-       g_signal_connect( G_OBJECT( GTK_COLOR_SELECTION_DIALOG( dlg )->cancel_button ), "clicked", G_CALLBACK( dialog_button_cancel ), &dialog );
+       GtkWidget *ok_button, *cancel_button;
+       g_object_get(dlg, "ok-button", &ok_button, "cancel-button", &cancel_button, nullptr);
+       g_signal_connect( ok_button, "clicked", G_CALLBACK( dialog_button_ok ), &dialog );
+       g_signal_connect( cancel_button, "clicked", G_CALLBACK( dialog_button_cancel ), &dialog );
 
-       if ( parent != 0 ) {
+       if ( parent ) {
                gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( parent ) );
        }
 
        bool ok = modal_dialog_show( GTK_WINDOW( dlg ), dialog ) == eIDOK;
        if ( ok ) {
-               GdkColor gdkcolor;
-               gtk_color_selection_get_current_color( GTK_COLOR_SELECTION( GTK_COLOR_SELECTION_DIALOG( dlg )->colorsel ), &gdkcolor );
-               clr[0] = gdkcolor.red / 65535.0;
-               clr[1] = gdkcolor.green / 65535.0;
-               clr[2] = gdkcolor.blue / 65535.0;
-
-               color[0] = (float)clr[0];
-               color[1] = (float)clr[1];
-               color[2] = (float)clr[2];
+               gtk_color_selection_get_current_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG( dlg )) ), &clr );
+               color[0] = clr.red / 65535.0f;
+               color[1] = clr.green / 65535.0f;
+               color[2] = clr.blue / 65535.0f;
        }
 
        gtk_widget_destroy( dlg );
@@ -134,17 +127,17 @@ bool color_dialog( GtkWidget *parent, Vector3& color, const char* title ){
        return ok;
 }
 
-void button_clicked_entry_browse_file( GtkWidget* widget, GtkEntry* entry ){
-       const char *filename = file_dialog( gtk_widget_get_toplevel( widget ), TRUE, "Choose File", gtk_entry_get_text( entry ) );
+void button_clicked_entry_browse_file( ui::Widget widget, GtkEntry* entry ){
+       const char *filename = ui::Widget(gtk_widget_get_toplevel( widget )).file_dialog( TRUE, "Choose File", gtk_entry_get_text( entry ) );
 
        if ( filename != 0 ) {
                gtk_entry_set_text( entry, filename );
        }
 }
 
-void button_clicked_entry_browse_directory( GtkWidget* widget, GtkEntry* entry ){
+void button_clicked_entry_browse_directory( ui::Widget widget, GtkEntry* entry ){
        const char* text = gtk_entry_get_text( entry );
-       char *dir = dir_dialog( gtk_widget_get_toplevel( widget ), "Choose Directory", path_is_absolute( text ) ? text : "" );
+       char *dir = dir_dialog( ui::Widget(gtk_widget_get_toplevel( widget )), "Choose Directory", path_is_absolute( text ) ? text : "" );
 
        if ( dir != 0 ) {
                gchar* converted = g_filename_to_utf8( dir, -1, 0, 0, 0 );
index 14cdd8168031fa0458bb01e4b419aa0bf96b4bb1..867aaccb4f295d98a0eb5dbb0c4de0169736c752 100644 (file)
@@ -31,7 +31,8 @@
 #if !defined( INCLUDED_GTKMISC_H )
 #define INCLUDED_GTKMISC_H
 
-#include <gtk/gtkmain.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
 
 inline void process_gui(){
        while ( gtk_events_pending() )
@@ -59,17 +60,17 @@ typedef struct _GtkToggleButton GtkToggleButton;
 typedef struct _GtkToolbar GtkToolbar;
 
 // this DOES NOT set up the shortcut using command_connect_accelerator
-GtkButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const char* commandName );
+GtkToolButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const char* commandName );
 // this DOES NOT set up the shortcut using command_connect_accelerator
-GtkToggleButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const char* commandName );
+GtkToggleToolButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const char* commandName );
 
 
 template<typename Element> class BasicVector3;
 typedef BasicVector3<float> Vector3;
-bool color_dialog( GtkWidget *parent, Vector3& color, const char* title = "Choose Color" );
+bool color_dialog( ui::Widget parent, Vector3& color, const char* title = "Choose Color" );
 
 typedef struct _GtkEntry GtkEntry;
-void button_clicked_entry_browse_file( GtkWidget* widget, GtkEntry* entry );
-void button_clicked_entry_browse_directory( GtkWidget* widget, GtkEntry* entry );
+void button_clicked_entry_browse_file( ui::Widget widget, GtkEntry* entry );
+void button_clicked_entry_browse_directory( ui::Widget widget, GtkEntry* entry );
 
 #endif
index e46d903fff70cd37b0a7be05cd5b0cd074fbbbf2..6620d662ab655410ab6033feb77e5ea1e983f70a 100644 (file)
@@ -69,7 +69,8 @@
 
 #include "iundo.h"
 
-#include <gtk/gtkmain.h>
+#include "uilib/uilib.h"
+#include <gtk/gtk.h>
 
 #include "cmdlib.h"
 #include "os/file.h"
@@ -303,12 +304,12 @@ bool handleMessage(){
                ScopedLock lock( m_lock );
 #if defined _DEBUG
                m_buffer << "Break into the debugger?\n";
-               bool handled = gtk_MessageBox( 0, m_buffer.c_str(), "Radiant - Runtime Error", eMB_YESNO, eMB_ICONERROR ) == eIDNO;
+               bool handled = ui::root.alert( m_buffer.c_str(), "Radiant - Runtime Error", ui::alert_type::YESNO, ui::alert_icon::Error ) == ui::alert_response::NO;
                m_buffer.clear();
                return handled;
 #else
                m_buffer << "Please report this error to the developers\n";
-               gtk_MessageBox( 0, m_buffer.c_str(), "Radiant - Runtime Error", eMB_OK, eMB_ICONERROR );
+               ui::root.alert( m_buffer.c_str(), "Radiant - Runtime Error", ui::alert_type::OK, ui::alert_icon::Error );
                m_buffer.clear();
 #endif
        }
@@ -394,9 +395,9 @@ bool check_version(){
        if ( !bVerIsGood ) {
                StringOutputStream msg( 256 );
                msg << "This editor binary (" RADIANT_VERSION ") doesn't match what the latest setup has configured in this directory\n"
-                                                                                                         "Make sure you run the right/latest editor binary you installed\n"
+                               "Make sure you run the right/latest editor binary you installed\n"
                        << AppPath_get();
-               gtk_MessageBox( 0, msg.c_str(), "Radiant", eMB_OK, eMB_ICONDEFAULT );
+               ui::alert( 0, msg.c_str(), "Radiant", eMB_OK, eMB_ICONDEFAULT );
        }
        return bVerIsGood;
 #else
@@ -424,7 +425,7 @@ void create_global_pid(){
                if ( remove( g_pidFile.c_str() ) == -1 ) {
                        StringOutputStream msg( 256 );
                        msg << "WARNING: Could not delete " << g_pidFile.c_str();
-                       gtk_MessageBox( 0, msg.c_str(), "Radiant", eMB_OK, eMB_ICONERROR );
+                       ui::root.alert( msg.c_str(), "Radiant", ui::alert_type::OK, ui::alert_icon::Error );
                }
 
                // in debug, never prompt to clean registry, turn console logging auto after a failed start
@@ -434,14 +435,14 @@ void create_global_pid(){
                           "The failure may be related to current global preferences.\n"
                           "Do you want to reset global preferences to defaults?";
 
-               if ( gtk_MessageBox( 0, msg.c_str(), "Radiant - Startup Failure", eMB_YESNO, eMB_ICONQUESTION ) == eIDYES ) {
+               if ( ui::root.alert( msg.c_str(), "Radiant - Startup Failure", ui::alert_type::YESNO, ui::alert_icon::QUESTION ) == ui::alert_response::YES ) {
                        g_GamesDialog.Reset();
                }
 
                msg.clear();
                msg << "Logging console output to " << SettingsPath_get() << "radiant.log\nRefer to the log if Radiant fails to start again.";
 
-               gtk_MessageBox( 0, msg.c_str(), "Radiant - Console Log", eMB_OK );
+               ui::root.alert( msg.c_str(), "Radiant - Console Log", ui::alert_type::OK );
 #endif
 
                // set without saving, the class is not in a coherent state yet
@@ -465,7 +466,7 @@ void remove_global_pid(){
        if ( remove( g_pidFile.c_str() ) == -1 ) {
                StringOutputStream msg( 256 );
                msg << "WARNING: Could not delete " << g_pidFile.c_str();
-               gtk_MessageBox( 0, msg.c_str(), "Radiant", eMB_OK, eMB_ICONERROR );
+               ui::root.alert( msg.c_str(), "Radiant", ui::alert_type::OK, ui::alert_icon::Error );
        }
 }
 
@@ -483,7 +484,7 @@ void create_local_pid(){
                if ( remove( g_pidGameFile.c_str() ) == -1 ) {
                        StringOutputStream msg;
                        msg << "WARNING: Could not delete " << g_pidGameFile.c_str();
-                       gtk_MessageBox( 0, msg.c_str(), "Radiant", eMB_OK, eMB_ICONERROR );
+                       ui::root.alert( msg.c_str(), "Radiant", ui::alert_type::OK, ui::alert_icon::Error );
                }
 
                // in debug, never prompt to clean registry, turn console logging auto after a failed start
@@ -493,14 +494,14 @@ void create_local_pid(){
                           "The failure may be caused by current preferences.\n"
                           "Do you want to reset all preferences to defaults?";
 
-               if ( gtk_MessageBox( 0, msg.c_str(), "Radiant - Startup Failure", eMB_YESNO, eMB_ICONQUESTION ) == eIDYES ) {
+               if ( ui::root.alert( msg.c_str(), "Radiant - Startup Failure", ui::alert_type::YESNO, ui::alert_icon::QUESTION ) == ui::alert_response::YES ) {
                        Preferences_Reset();
                }
 
                msg.clear();
                msg << "Logging console output to " << SettingsPath_get() << "radiant.log\nRefer to the log if Radiant fails to start again.";
 
-               gtk_MessageBox( 0, msg.c_str(), "Radiant - Console Log", eMB_OK );
+               ui::root.alert( msg.c_str(), "Radiant - Console Log", ui::alert_type::OK );
 #endif
 
                // force console logging on! (will go in prefs too)
@@ -668,7 +669,7 @@ int main( int argc, char* argv[] ){
 
        remove_local_pid();
 
-       gtk_main();
+       ui::main();
 
        // avoid saving prefs when the app is minimized
        if ( g_pParentWnd->IsSleeping() ) {
index 53ef24a60f3d2371f37c0cc811c2eb4d7271d056..1758a7659d4fff0cd6836ea3bac645faad27604e 100644 (file)
 #include <ctime>
 
 #include <gdk/gdkkeysyms.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkhpaned.h>
-#include <gtk/gtkvpaned.h>
-#include <gtk/gtktoolbar.h>
-#include <gtk/gtkmenubar.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtktable.h>
+#include <gtk/gtk.h>
 
 
 #include "cmdlib.h"
@@ -452,18 +443,18 @@ void Paths_registerPreferencesPage(){
 class PathsDialog : public Dialog
 {
 public:
-GtkWindow* BuildDialog(){
+ui::Window BuildDialog(){
        GtkFrame* frame = create_dialog_frame( "Path settings", GTK_SHADOW_ETCHED_IN );
 
        GtkVBox* vbox2 = create_dialog_vbox( 0, 4 );
        gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox2 ) );
 
        {
-               PreferencesPage preferencesPage( *this, GTK_WIDGET( vbox2 ) );
+               PreferencesPage preferencesPage( *this, ui::Widget(GTK_WIDGET( vbox2 )) );
                Paths_constructPreferences( preferencesPage );
        }
 
-       return create_simple_modal_dialog_window( "Engine Path Not Found", m_modal, GTK_WIDGET( frame ) );
+       return ui::Window(create_simple_modal_dialog_window( "Engine Path Not Found", m_modal, GTK_WIDGET( frame ) ));
 }
 };
 
@@ -828,7 +819,7 @@ ChooseColour( const GetColourCallback& get, const SetColourCallback& set )
 void operator()(){
        Vector3 colour;
        m_get( colour );
-       color_dialog( GTK_WIDGET( MainFrame_getWindow() ), colour );
+       color_dialog( MainFrame_getWindow(), colour );
        m_set( colour );
 }
 };
@@ -973,13 +964,13 @@ void OpenBugReportURL(){
 }
 
 
-GtkWidget* g_page_console;
+ui::Widget g_page_console;
 
 void Console_ToggleShow(){
        GroupDialog_showPage( g_page_console );
 }
 
-GtkWidget* g_page_entity;
+ui::Widget g_page_entity;
 
 void EntityInspector_ToggleShow(){
        GroupDialog_showPage( g_page_entity );
@@ -1608,33 +1599,33 @@ guint s_qe_every_second_id = 0;
 
 void EverySecondTimer_enable(){
        if ( s_qe_every_second_id == 0 ) {
-               s_qe_every_second_id = gtk_timeout_add( 1000, qe_every_second, 0 );
+               s_qe_every_second_id = g_timeout_add( 1000, qe_every_second, 0 );
        }
 }
 
 void EverySecondTimer_disable(){
        if ( s_qe_every_second_id != 0 ) {
-               gtk_timeout_remove( s_qe_every_second_id );
+               g_source_remove( s_qe_every_second_id );
                s_qe_every_second_id = 0;
        }
 }
 
-gint window_realize_remove_decoration( GtkWidget* widget, gpointer data ){
-       gdk_window_set_decorations( widget->window, (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MENU | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE ) );
+gint window_realize_remove_decoration( ui::Widget widget, gpointer data ){
+       gdk_window_set_decorations( gtk_widget_get_window(widget), (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MENU | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE ) );
        return FALSE;
 }
 
 class WaitDialog
 {
 public:
-GtkWindow* m_window;
+ui::Window m_window;
 GtkLabel* m_label;
 };
 
 WaitDialog create_wait_dialog( const char* title, const char* text ){
        WaitDialog dialog;
 
-       dialog.m_window = create_floating_window( title, MainFrame_getWindow() );
+       dialog.m_window = MainFrame_getWindow().create_floating_window(title);
        gtk_window_set_resizable( dialog.m_window, FALSE );
        gtk_container_set_border_width( GTK_CONTAINER( dialog.m_window ), 0 );
        gtk_window_set_position( dialog.m_window, GTK_WIN_POS_CENTER_ON_PARENT );
@@ -1642,7 +1633,7 @@ WaitDialog create_wait_dialog( const char* title, const char* text ){
        g_signal_connect( G_OBJECT( dialog.m_window ), "realize", G_CALLBACK( window_realize_remove_decoration ), 0 );
 
        {
-               dialog.m_label = GTK_LABEL( gtk_label_new( text ) );
+               dialog.m_label = GTK_LABEL( ui::Label( text ) );
                gtk_misc_set_alignment( GTK_MISC( dialog.m_label ), 0.0, 0.5 );
                gtk_label_set_justify( dialog.m_label, GTK_JUSTIFY_LEFT );
                gtk_widget_show( GTK_WIDGET( dialog.m_label ) );
@@ -1692,7 +1683,7 @@ bool ScreenUpdates_Enabled(){
 }
 
 void ScreenUpdates_process(){
-       if ( redrawRequired() && GTK_WIDGET_VISIBLE( g_wait.m_window ) ) {
+       if ( redrawRequired() && gtk_widget_get_visible( g_wait.m_window ) ) {
                process_gui();
        }
 }
@@ -1714,7 +1705,7 @@ void ScreenUpdates_Disable( const char* message, const char* title ){
                        ScreenUpdates_process();
                }
        }
-       else if ( GTK_WIDGET_VISIBLE( g_wait.m_window ) ) {
+       else if ( gtk_widget_get_visible( g_wait.m_window ) ) {
                gtk_label_set_text( g_wait.m_label, message );
                ScreenUpdates_process();
        }
@@ -1730,11 +1721,11 @@ void ScreenUpdates_Enable(){
 
                gtk_grab_remove( GTK_WIDGET( g_wait.m_window ) );
                destroy_floating_window( g_wait.m_window );
-               g_wait.m_window = 0;
+               g_wait.m_window = ui::Window();
 
                //gtk_window_present(MainFrame_getWindow());
        }
-       else if ( GTK_WIDGET_VISIBLE( g_wait.m_window ) ) {
+       else if ( gtk_widget_get_visible( g_wait.m_window ) ) {
                gtk_label_set_text( g_wait.m_label, g_wait_stack.back().c_str() );
                ScreenUpdates_process();
        }
@@ -1893,10 +1884,10 @@ void fill_view_xz_front_menu( GtkMenu* menu ){
 }
 
 
-GtkWidget* g_toggle_z_item = 0;
-GtkWidget* g_toggle_console_item = 0;
-GtkWidget* g_toggle_entity_item = 0;
-GtkWidget* g_toggle_entitylist_item = 0;
+ui::Widget g_toggle_z_item;
+ui::Widget g_toggle_console_item;
+ui::Widget g_toggle_entity_item;
+ui::Widget g_toggle_entitylist_item;
 
 GtkMenuItem* create_view_menu( MainFrame::EViewStyle style ){
        // View menu
@@ -2330,67 +2321,73 @@ void Manipulators_constructToolbar( GtkToolbar* toolbar ){
 
 GtkToolbar* create_main_toolbar( MainFrame::EViewStyle style ){
        GtkToolbar* toolbar = GTK_TOOLBAR( gtk_toolbar_new() );
-       gtk_toolbar_set_orientation( toolbar, GTK_ORIENTATION_HORIZONTAL );
+       gtk_orientable_set_orientation( GTK_ORIENTABLE(toolbar), GTK_ORIENTATION_HORIZONTAL );
        gtk_toolbar_set_style( toolbar, GTK_TOOLBAR_ICONS );
 
        gtk_widget_show( GTK_WIDGET( toolbar ) );
 
+       auto space = [&]() {
+               auto btn = gtk_separator_tool_item_new();
+               gtk_widget_show(GTK_WIDGET(btn));
+               gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(btn));
+       };
+
        File_constructToolbar( toolbar );
 
-       gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+       space();
 
        UndoRedo_constructToolbar( toolbar );
 
-       gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+       space();
 
        RotateFlip_constructToolbar( toolbar );
 
-       gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+       space();
 
        Select_constructToolbar( toolbar );
 
-       gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+       space();
 
        CSG_constructToolbar( toolbar );
 
-       gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+       space();
 
        ComponentModes_constructToolbar( toolbar );
 
        if ( style == MainFrame::eRegular || style == MainFrame::eRegularLeft || style == MainFrame::eFloating ) {
-               gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+               space();
 
                XYWnd_constructToolbar( toolbar );
        }
 
-       gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+       space();
 
        CamWnd_constructToolbar( toolbar );
 
-       gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+       space();
 
        Manipulators_constructToolbar( toolbar );
 
        if ( g_Layout_enablePatchToolbar.m_value ) {
-               gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+               space();
 
                Patch_constructToolbar( toolbar );
        }
 
-       gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+       space();
 
        toolbar_append_toggle_button( toolbar, "Texture Lock (SHIFT +T)", "texture_lock.png", "TogTexLock" );
 
-       gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+       space();
 
-       GtkButton* g_view_entities_button = toolbar_append_button( toolbar, "Entities (N)", "entities.png", "ToggleEntityInspector" );
-       GtkButton* g_view_console_button = toolbar_append_button( toolbar, "Console (O)", "console.png", "ToggleConsole" );
-       GtkButton* g_view_textures_button = toolbar_append_button( toolbar, "Texture Browser (T)", "texture_browser.png", "ToggleTextures" );
+       /*auto g_view_entities_button =*/ toolbar_append_button( toolbar, "Entities (N)", "entities.png", "ToggleEntityInspector" );
+       auto g_view_console_button = toolbar_append_button( toolbar, "Console (O)", "console.png", "ToggleConsole" );
+       auto g_view_textures_button = toolbar_append_button( toolbar, "Texture Browser (T)", "texture_browser.png", "ToggleTextures" );
        // TODO: call light inspector
        //GtkButton* g_view_lightinspector_button = toolbar_append_button(toolbar, "Light Inspector", "lightinspector.png", "ToggleLightInspector");
 
-       gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
-       GtkButton* g_refresh_models_button = toolbar_append_button( toolbar, "Refresh Models", "refresh_models.png", "RefreshReferences" );
+       space();
+       /*auto g_refresh_models_button =*/ toolbar_append_button( toolbar, "Refresh Models", "refresh_models.png", "RefreshReferences" );
 
 
        // disable the console and texture button in the regular layouts
@@ -2402,36 +2399,36 @@ GtkToolbar* create_main_toolbar( MainFrame::EViewStyle style ){
        return toolbar;
 }
 
-GtkWidget* create_main_statusbar( GtkWidget *pStatusLabel[c_count_status] ){
-       GtkTable* table = GTK_TABLE( gtk_table_new( 1, c_count_status, FALSE ) );
+ui::Widget create_main_statusbar( ui::Widget pStatusLabel[c_count_status] ){
+       GtkTable* table = ui::Table( 1, c_count_status, FALSE );
        gtk_widget_show( GTK_WIDGET( table ) );
 
        {
-               GtkLabel* label = GTK_LABEL( gtk_label_new( "Label" ) );
+               GtkLabel* label = GTK_LABEL( ui::Label( "Label" ) );
                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                gtk_misc_set_padding( GTK_MISC( label ), 4, 2 );
                gtk_widget_show( GTK_WIDGET( label ) );
                gtk_table_attach_defaults( table, GTK_WIDGET( label ), 0, 1, 0, 1 );
-               pStatusLabel[c_command_status] = GTK_WIDGET( label );
+               pStatusLabel[c_command_status] = ui::Widget(GTK_WIDGET( label ));
        }
 
        for ( int i = 1; i < c_count_status; ++i )
        {
-               GtkFrame* frame = GTK_FRAME( gtk_frame_new( 0 ) );
+               GtkFrame* frame = ui::Frame();
                gtk_widget_show( GTK_WIDGET( frame ) );
                gtk_table_attach_defaults( table, GTK_WIDGET( frame ), i, i + 1, 0, 1 );
                gtk_frame_set_shadow_type( frame, GTK_SHADOW_IN );
 
-               GtkLabel* label = GTK_LABEL( gtk_label_new( "Label" ) );
+               GtkLabel* label = GTK_LABEL( ui::Label( "Label" ) );
                gtk_label_set_ellipsize( label, PANGO_ELLIPSIZE_END );
                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                gtk_misc_set_padding( GTK_MISC( label ), 4, 2 );
                gtk_widget_show( GTK_WIDGET( label ) );
                gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( label ) );
-               pStatusLabel[i] = GTK_WIDGET( label );
+               pStatusLabel[i] = ui::Widget(GTK_WIDGET( label ));
        }
 
-       return GTK_WIDGET( table );
+       return ui::Widget(GTK_WIDGET( table ));
 }
 
 #if 0
@@ -2443,15 +2440,15 @@ class WindowFocusPrinter
 {
 const char* m_name;
 
-static gboolean frame_event( GtkWidget *widget, GdkEvent* event, WindowFocusPrinter* self ){
+static gboolean frame_event( ui::Widget widget, GdkEvent* event, WindowFocusPrinter* self ){
        globalOutputStream() << self->m_name << " frame_event\n";
        return FALSE;
 }
-static gboolean keys_changed( GtkWidget *widget, WindowFocusPrinter* self ){
+static gboolean keys_changed( ui::Widget widget, WindowFocusPrinter* self ){
        globalOutputStream() << self->m_name << " keys_changed\n";
        return FALSE;
 }
-static gboolean notify( GtkWindow* window, gpointer dummy, WindowFocusPrinter* self ){
+static gboolean notify( ui::Window window, gpointer dummy, WindowFocusPrinter* self ){
        if ( gtk_window_is_active( window ) ) {
                globalOutputStream() << self->m_name << " takes toplevel focus\n";
        }
@@ -2464,7 +2461,7 @@ static gboolean notify( GtkWindow* window, gpointer dummy, WindowFocusPrinter* s
 public:
 WindowFocusPrinter( const char* name ) : m_name( name ){
 }
-void connect( GtkWindow* toplevel_window ){
+void connect( ui::Window toplevel_window ){
        g_signal_connect( G_OBJECT( toplevel_window ), "notify::has_toplevel_focus", G_CALLBACK( notify ), this );
        g_signal_connect( G_OBJECT( toplevel_window ), "notify::is_active", G_CALLBACK( notify ), this );
        g_signal_connect( G_OBJECT( toplevel_window ), "keys_changed", G_CALLBACK( keys_changed ), this );
@@ -2478,15 +2475,15 @@ WindowFocusPrinter g_mainframeFocusPrinter( "mainframe" );
 
 class MainWindowActive
 {
-static gboolean notify( GtkWindow* window, gpointer dummy, MainWindowActive* self ){
-       if ( g_wait.m_window != 0 && gtk_window_is_active( window ) && !GTK_WIDGET_VISIBLE( g_wait.m_window ) ) {
+static gboolean notify( ui::Window window, gpointer dummy, MainWindowActive* self ){
+       if ( g_wait.m_window && gtk_window_is_active( window ) && !gtk_widget_get_visible( g_wait.m_window ) ) {
                gtk_widget_show( GTK_WIDGET( g_wait.m_window ) );
        }
 
        return FALSE;
 }
 public:
-void connect( GtkWindow* toplevel_window ){
+void connect( ui::Window toplevel_window ){
        g_signal_connect( G_OBJECT( toplevel_window ), "notify::is-active", G_CALLBACK( notify ), this );
 }
 };
@@ -2514,14 +2511,12 @@ void XYWindowMouseDown_disconnect( MouseEventHandlerId id ){
 
 MainFrame* g_pParentWnd = 0;
 
-GtkWindow* MainFrame_getWindow(){
-       if ( g_pParentWnd == 0 ) {
-               return 0;
-       }
-       return g_pParentWnd->m_window;
+ui::Window MainFrame_getWindow()
+{
+       return g_pParentWnd ? g_pParentWnd->m_window : ui::Window();
 }
 
-std::vector<GtkWidget*> g_floating_windows;
+std::vector<ui::Widget> g_floating_windows;
 
 MainFrame::MainFrame() : m_window( 0 ), m_idleRedrawStatusText( RedrawStatusTextCaller( *this ) ){
        m_pXYWnd = 0;
@@ -2533,7 +2528,7 @@ MainFrame::MainFrame() : m_window( 0 ), m_idleRedrawStatusText( RedrawStatusText
 
        for ( int n = 0; n < c_count_status; n++ )
        {
-               m_pStatusLabel[n] = 0;
+               m_pStatusLabel[n] = ui::root;
        }
 
        m_bSleeping = false;
@@ -2548,7 +2543,7 @@ MainFrame::~MainFrame(){
 
        Shutdown();
 
-       for ( std::vector<GtkWidget*>::iterator i = g_floating_windows.begin(); i != g_floating_windows.end(); ++i )
+       for ( std::vector<ui::Widget>::iterator i = g_floating_windows.begin(); i != g_floating_windows.end(); ++i )
        {
                gtk_widget_destroy( *i );
        }
@@ -2673,8 +2668,8 @@ void MainFrame::OnSleep(){
 }
 
 
-GtkWindow* create_splash(){
-       GtkWindow* window = GTK_WINDOW( gtk_window_new( GTK_WINDOW_TOPLEVEL ) );
+ui::Window create_splash(){
+       ui::Window window = ui::Window( ui::window_type::TOP );
        gtk_window_set_decorated( window, FALSE );
        gtk_window_set_resizable( window, FALSE );
        gtk_window_set_modal( window, TRUE );
@@ -2692,7 +2687,7 @@ GtkWindow* create_splash(){
        return window;
 }
 
-static GtkWindow *splash_screen = 0;
+static ui::Window splash_screen;
 
 void show_splash(){
        splash_screen = create_splash();
@@ -2709,7 +2704,7 @@ WindowPositionTracker g_posXYWnd;
 WindowPositionTracker g_posXZWnd;
 WindowPositionTracker g_posYZWnd;
 
-static gint mainframe_delete( GtkWidget *widget, GdkEvent *event, gpointer data ){
+static gint mainframe_delete( ui::Widget widget, GdkEvent *event, gpointer data ){
        if ( ConfirmModified( "Exit Radiant" ) ) {
                gtk_main_quit();
        }
@@ -2718,7 +2713,7 @@ static gint mainframe_delete( GtkWidget *widget, GdkEvent *event, gpointer data
 }
 
 void MainFrame::Create(){
-       GtkWindow* window = GTK_WINDOW( gtk_window_new( GTK_WINDOW_TOPLEVEL ) );
+       ui::Window window = ui::Window( ui::window_type::TOP );
 
        GlobalWindowObservers_connectTopLevel( window );
 
@@ -2729,7 +2724,7 @@ void MainFrame::Create(){
                GdkPixbuf* pixbuf = pixbuf_new_from_file_with_mask( "bitmaps/icon.png" );
                if ( pixbuf != 0 ) {
                        gtk_window_set_icon( window, pixbuf );
-                       gdk_pixbuf_unref( pixbuf );
+                       g_object_unref( pixbuf );
                }
        }
 #endif
@@ -2746,9 +2741,9 @@ void MainFrame::Create(){
 
        g_MainWindowActive.connect( window );
 
-       GetPlugInMgr().Init( GTK_WIDGET( window ) );
+       GetPlugInMgr().Init( window );
 
-       GtkWidget* vbox = gtk_vbox_new( FALSE, 0 );
+       ui::Widget vbox = ui::VBox( FALSE, 0 );
        gtk_container_add( GTK_CONTAINER( window ), vbox );
        gtk_widget_show( vbox );
 
@@ -2770,7 +2765,7 @@ void MainFrame::Create(){
        }
        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( plugin_toolbar ), FALSE, FALSE, 0 );
 
-       GtkWidget* main_statusbar = create_main_statusbar( m_pStatusLabel );
+       ui::Widget main_statusbar = create_main_statusbar( m_pStatusLabel );
        gtk_box_pack_end( GTK_BOX( vbox ), main_statusbar, FALSE, TRUE, 2 );
 
        GroupDialog_constructWindow( window );
@@ -2803,17 +2798,17 @@ void MainFrame::Create(){
 
        if ( CurrentStyle() == eRegular || CurrentStyle() == eRegularLeft ) {
                {
-                       GtkWidget* vsplit = gtk_vpaned_new();
+                       ui::Widget vsplit = ui::VPaned();
                        m_vSplit = vsplit;
                        gtk_box_pack_start( GTK_BOX( vbox ), vsplit, TRUE, TRUE, 0 );
                        gtk_widget_show( vsplit );
 
                        // console
-                       GtkWidget* console_window = Console_constructWindow( window );
+                       ui::Widget console_window = Console_constructWindow( window );
                        gtk_paned_pack2( GTK_PANED( vsplit ), console_window, FALSE, TRUE );
 
                        {
-                               GtkWidget* hsplit = gtk_hpaned_new();
+                               ui::Widget hsplit = ui::HPaned();
                                gtk_widget_show( hsplit );
                                m_hSplit = hsplit;
                                gtk_paned_add1( GTK_PANED( vsplit ), hsplit );
@@ -2821,10 +2816,10 @@ void MainFrame::Create(){
                                // xy
                                m_pXYWnd = new XYWnd();
                                m_pXYWnd->SetViewType( XY );
-                               GtkWidget* xy_window = GTK_WIDGET( create_framed_widget( m_pXYWnd->GetWidget() ) );
+                               ui::Widget xy_window = ui::Widget(GTK_WIDGET( create_framed_widget( m_pXYWnd->GetWidget() ) ));
 
                                {
-                                       GtkWidget* vsplit2 = gtk_vpaned_new();
+                                       ui::Widget vsplit2 = ui::VPaned();
                                        gtk_widget_show( vsplit2 );
                                        m_vSplit2 = vsplit2;
 
@@ -2869,7 +2864,7 @@ void MainFrame::Create(){
        }
        else if ( CurrentStyle() == eFloating ) {
                {
-                       GtkWindow* window = create_persistent_floating_window( "Camera", m_window );
+                       ui::Window window = ui::Window(create_persistent_floating_window( "Camera", m_window ));
                        global_accel_connect_window( window );
                        g_posCamWnd.connect( window );
 
@@ -2884,11 +2879,11 @@ void MainFrame::Create(){
                        }
                        CamWnd_setParent( *m_pCamWnd, window );
 
-                       g_floating_windows.push_back( GTK_WIDGET( window ) );
+                       g_floating_windows.push_back( window );
                }
 
                {
-                       GtkWindow* window = create_persistent_floating_window( ViewType_getTitle( XY ), m_window );
+                       ui::Window window = ui::Window(create_persistent_floating_window( ViewType_getTitle( XY ), m_window ));
                        global_accel_connect_window( window );
                        g_posXYWnd.connect( window );
 
@@ -2903,11 +2898,11 @@ void MainFrame::Create(){
                        }
                        XY_Top_Shown_Construct( window );
 
-                       g_floating_windows.push_back( GTK_WIDGET( window ) );
+                       g_floating_windows.push_back( window );
                }
 
                {
-                       GtkWindow* window = create_persistent_floating_window( ViewType_getTitle( XZ ), m_window );
+                       ui::Window window = ui::Window(create_persistent_floating_window( ViewType_getTitle( XZ ), m_window ));
                        global_accel_connect_window( window );
                        g_posXZWnd.connect( window );
 
@@ -2922,11 +2917,11 @@ void MainFrame::Create(){
 
                        XZ_Front_Shown_Construct( window );
 
-                       g_floating_windows.push_back( GTK_WIDGET( window ) );
+                       g_floating_windows.push_back( window );
                }
 
                {
-                       GtkWindow* window = create_persistent_floating_window( ViewType_getTitle( YZ ), m_window );
+                       ui::Window window = ui::Window(create_persistent_floating_window( ViewType_getTitle( YZ ), m_window ));
                        global_accel_connect_window( window );
                        g_posYZWnd.connect( window );
 
@@ -2941,12 +2936,12 @@ void MainFrame::Create(){
 
                        YZ_Side_Shown_Construct( window );
 
-                       g_floating_windows.push_back( GTK_WIDGET( window ) );
+                       g_floating_windows.push_back( window );
                }
 
                {
                        GtkFrame* frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) );
-                       g_page_textures = GroupDialog_addPage( "Textures", GTK_WIDGET( frame ), TextureBrowserExportTitleCaller() );
+                       g_page_textures = GroupDialog_addPage( "Textures", ui::Widget(GTK_WIDGET( frame )), TextureBrowserExportTitleCaller() );
                }
 
                GroupDialog_show();
@@ -2957,29 +2952,29 @@ void MainFrame::Create(){
                GlobalCamera_setCamWnd( *m_pCamWnd );
                CamWnd_setParent( *m_pCamWnd, window );
 
-               GtkWidget* camera = CamWnd_getWidget( *m_pCamWnd );
+               ui::Widget camera = CamWnd_getWidget( *m_pCamWnd );
 
                m_pYZWnd = new XYWnd();
                m_pYZWnd->SetViewType( YZ );
 
-               GtkWidget* yz = m_pYZWnd->GetWidget();
+               ui::Widget yz = m_pYZWnd->GetWidget();
 
                m_pXYWnd = new XYWnd();
                m_pXYWnd->SetViewType( XY );
 
-               GtkWidget* xy = m_pXYWnd->GetWidget();
+               ui::Widget xy = m_pXYWnd->GetWidget();
 
                m_pXZWnd = new XYWnd();
                m_pXZWnd->SetViewType( XZ );
 
-               GtkWidget* xz = m_pXZWnd->GetWidget();
+               ui::Widget xz = m_pXZWnd->GetWidget();
 
                GtkHPaned* split = create_split_views( camera, yz, xy, xz );
                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( split ), TRUE, TRUE, 0 );
 
                {
                        GtkFrame* frame = create_framed_widget( TextureBrowser_constructWindow( window ) );
-                       g_page_textures = GroupDialog_addPage( "Textures", GTK_WIDGET( frame ), TextureBrowserExportTitleCaller() );
+                       g_page_textures = GroupDialog_addPage( "Textures", ui::Widget(GTK_WIDGET( frame )), TextureBrowserExportTitleCaller() );
                }
        }
 
@@ -3020,7 +3015,7 @@ void MainFrame::SaveWindowInfo(){
 
        g_layout_globals.m_position = m_position_tracker.getPosition();
 
-       g_layout_globals.nState = gdk_window_get_state( GTK_WIDGET( m_window )->window );
+       g_layout_globals.nState = gdk_window_get_state( gtk_widget_get_window(GTK_WIDGET( m_window )) );
 }
 
 void MainFrame::Shutdown(){
index c450fd549ca50a9231b9bf0e8d49c8b7ffcd1341..cb5274f36159490004805a7ca557d5e972f69fd1 100644 (file)
@@ -22,6 +22,7 @@
 #if !defined( INCLUDED_MAINFRAME_H )
 #define INCLUDED_MAINFRAME_H
 
+#include <uilib/uilib.h>
 #include "gtkutil/window.h"
 #include "gtkutil/idledraw.h"
 #include "gtkutil/widget.h"
@@ -60,7 +61,7 @@ enum EViewStyle
 MainFrame();
 ~MainFrame();
 
-GtkWindow* m_window;
+ui::Window m_window;
 
 CopiedString m_command_status;
 CopiedString m_position_status;
@@ -73,9 +74,9 @@ void Create();
 void SaveWindowInfo();
 void Shutdown();
 
-GtkWidget* m_vSplit;
-GtkWidget* m_hSplit;
-GtkWidget* m_vSplit2;
+ui::Widget m_vSplit;
+ui::Widget m_hSplit;
+ui::Widget m_vSplit2;
 
 XYWnd* m_pXYWnd;
 XYWnd* m_pYZWnd;
@@ -86,7 +87,7 @@ XYWnd* m_pActiveXY;
 
 bool m_bSleeping;
 
-GtkWidget *m_pStatusLabel[c_count_status];
+ui::Widget m_pStatusLabel[c_count_status];
 
 
 EViewStyle m_nCurrentStyle;
@@ -142,7 +143,7 @@ bool FloatingGroupDialog(){
 
 extern MainFrame* g_pParentWnd;
 
-GtkWindow* MainFrame_getWindow();
+ui::Window MainFrame_getWindow();
 
 enum EMouseButtonMode
 {
@@ -271,6 +272,6 @@ void XYWindowDestroyed_disconnect( SignalHandlerId id );
 MouseEventHandlerId XYWindowMouseDown_connect( const MouseEventHandler& handler );
 void XYWindowMouseDown_disconnect( MouseEventHandlerId id );
 
-extern GtkWidget* g_page_entity;
+extern ui::Widget g_page_entity;
 
 #endif
index 147cfa98762e7842f734be9f8fdedbc02e839b1f..0dc0798d4ce4d82790ebbf80033b25a2278a1c69 100644 (file)
@@ -42,15 +42,9 @@ MapModules& ReferenceAPI_getMapModules();
 
 #include <set>
 
-#include <gtk/gtkmain.h>
-#include <gtk/gtkbox.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtktreemodel.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+#include "uilib/uilib.h"
 
 #include "scenelib.h"
 #include "transformlib.h"
@@ -772,7 +766,7 @@ void DoMapInfo(){
        GtkEntry* entities_entry;
        GtkListStore* EntityBreakdownWalker;
 
-       GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Map Info", G_CALLBACK( dialog_delete_callback ), &dialog );
+       ui::Window window = MainFrame_getWindow().create_dialog_window("Map Info", G_CALLBACK(dialog_delete_callback ), &dialog );
 
        window_set_position( window, g_posMapInfoWnd );
 
@@ -789,27 +783,27 @@ void DoMapInfo(){
                                gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
 
                                {
-                                       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                       GtkEntry* entry = ui::Entry();
                                        gtk_widget_show( GTK_WIDGET( entry ) );
                                        gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-                                       gtk_entry_set_editable( entry, FALSE );
+                                       gtk_editable_set_editable( GTK_EDITABLE(entry), FALSE );
 
                                        brushes_entry = entry;
                                }
                                {
-                                       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                       GtkEntry* entry = ui::Entry();
                                        gtk_widget_show( GTK_WIDGET( entry ) );
                                        gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-                                       gtk_entry_set_editable( entry, FALSE );
+                                       gtk_editable_set_editable( GTK_EDITABLE(entry), FALSE );
 
                                        entities_entry = entry;
                                }
                                {
-                                       GtkWidget* label = gtk_label_new( "Total Brushes" );
+                                       ui::Widget label = ui::Label( "Total Brushes" );
                                        gtk_widget_show( label );
                                        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -817,7 +811,7 @@ void DoMapInfo(){
                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                }
                                {
-                                       GtkWidget* label = gtk_label_new( "Total Entities" );
+                                       ui::Widget label = ui::Label( "Total Entities" );
                                        gtk_widget_show( label );
                                        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -836,7 +830,7 @@ void DoMapInfo(){
                        }
                }
                {
-                       GtkWidget* label = gtk_label_new( "Entity breakdown" );
+                       ui::Widget label = ui::Label( "Entity breakdown" );
                        gtk_widget_show( label );
                        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, TRUE, 0 );
                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
@@ -848,19 +842,19 @@ void DoMapInfo(){
                        {
                                GtkListStore* store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING );
 
-                               GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+                               ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
                                gtk_tree_view_set_headers_clickable( GTK_TREE_VIEW( view ), TRUE );
 
                                {
-                                       GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
-                                       GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Entity", renderer, "text", 0, 0 );
+                                       auto renderer = ui::CellRendererText();
+                                       GtkTreeViewColumn* column = ui::TreeViewColumn( "Entity", renderer, {{"text", 0}} );
                                        gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
                                        gtk_tree_view_column_set_sort_column_id( column, 0 );
                                }
 
                                {
-                                       GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
-                                       GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Count", renderer, "text", 1, 0 );
+                                       auto renderer = ui::CellRendererText();
+                                       GtkTreeViewColumn* column = ui::TreeViewColumn( "Count", renderer, {{"text", 1}} );
                                        gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
                                        gtk_tree_view_column_set_sort_column_id( column, 1 );
                                }
@@ -1812,15 +1806,15 @@ const char* getLastFolderPath(){
 }
 
 const char* map_open( const char* title ){
-       return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), TRUE, title, getLastFolderPath(), MapFormat::Name(), false, true, false );
+       return MainFrame_getWindow().file_dialog( TRUE, title, getLastFolderPath(), MapFormat::Name(), true, false, false );
 }
 
 const char* map_import( const char* title ){
-       return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), TRUE, title, getLastFolderPath(), MapFormat::Name(), false, true, false );
+       return MainFrame_getWindow().file_dialog( TRUE, title, getLastFolderPath(), MapFormat::Name(), false, true, false );
 }
 
 const char* map_save( const char* title ){
-       return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), FALSE, title, getLastFolderPath(), MapFormat::Name(), false, false, true );
+       return MainFrame_getWindow().file_dialog( FALSE, title, getLastFolderPath(), MapFormat::Name(), false, false, true );
 }
 
 void OpenMap(){
@@ -2044,9 +2038,9 @@ void DoFind(){
        GtkEntry* entity;
        GtkEntry* brush;
 
-       GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Find Brush", G_CALLBACK( dialog_delete_callback ), &dialog );
+       ui::Window window = MainFrame_getWindow().create_dialog_window("Find Brush", G_CALLBACK(dialog_delete_callback ), &dialog );
 
-       GtkAccelGroup* accel = gtk_accel_group_new();
+       GtkAccelGroup* accel = ui::AccelGroup();
        gtk_window_add_accel_group( window, accel );
 
        {
@@ -2056,21 +2050,21 @@ void DoFind(){
                        GtkTable* table = create_dialog_table( 2, 2, 4, 4 );
                        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
                        {
-                               GtkWidget* label = gtk_label_new( "Entity number" );
+                               ui::Widget label = ui::Label( "Entity number" );
                                gtk_widget_show( label );
                                gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
                                                                  (GtkAttachOptions) ( 0 ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkWidget* label = gtk_label_new( "Brush number" );
+                               ui::Widget label = ui::Label( "Brush number" );
                                gtk_widget_show( label );
                                gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
                                                                  (GtkAttachOptions) ( 0 ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                               GtkEntry* entry = ui::Entry();
                                gtk_widget_show( GTK_WIDGET( entry ) );
                                gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1,
                                                                  (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -2079,7 +2073,7 @@ void DoFind(){
                                entity = entry;
                        }
                        {
-                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                               GtkEntry* entry = ui::Entry();
                                gtk_widget_show( GTK_WIDGET( entry ) );
                                gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
                                                                  (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -2095,12 +2089,12 @@ void DoFind(){
                                GtkButton* button = create_dialog_button( "Find", G_CALLBACK( dialog_button_ok ), &dialog );
                                gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
                                widget_make_default( GTK_WIDGET( button ) );
-                               gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_Return, (GdkModifierType)0, (GtkAccelFlags)0 );
+                               gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 );
                        }
                        {
                                GtkButton* button = create_dialog_button( "Close", G_CALLBACK( dialog_button_cancel ), &dialog );
                                gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
-                               gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_Escape, (GdkModifierType)0, (GtkAccelFlags)0 );
+                               gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 );
                        }
                }
        }
index cb833010f3bc74fa0f0886269e423673ccf979d6..3198b924ee8a10228b1906a075806fcb45eabe67 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <string.h>
 #include <stdio.h>
-#include <gtk/gtklabel.h>
+#include <gtk/gtk.h>
 
 #include "os/file.h"
 #include "generic/callback.h"
@@ -159,7 +159,7 @@ void MRU_Activate( std::size_t index ){
                        MRU_SetText( i, MRU_GetText( i + 1 ) );
 
                if ( MRU_used == 0 ) {
-                       gtk_label_set_text( GTK_LABEL( GTK_BIN( MRU_items[0] )->child ), "Recent Files" );
+                       gtk_label_set_text( GTK_LABEL( gtk_bin_get_child(GTK_BIN( MRU_items[0] )) ), "Recent Files" );
                        gtk_widget_set_sensitive( GTK_WIDGET( MRU_items[0] ), FALSE );
                }
                else
index 04407591778e78f36bab95aa356dde4d8ffb26e9..6fd4100372c20ea39bbaf7b04c38878dce46a1d2 100644 (file)
@@ -32,8 +32,8 @@ multimon_globals_t g_multimon_globals;
 LatchedBool g_Multimon_enableSysMenuPopups( false, "Floating windows sysmenu icons" );
 
 void MultiMonitor_constructPreferences( PreferencesPage& page ){
-       GtkWidget* primary_monitor = page.appendCheckBox( "Multi Monitor", "Start on Primary Monitor", g_multimon_globals.m_bStartOnPrimMon );
-       GtkWidget* popup = page.appendCheckBox(
+       ui::CheckButton primary_monitor = page.appendCheckBox( "Multi Monitor", "Start on Primary Monitor", g_multimon_globals.m_bStartOnPrimMon );
+       ui::CheckButton popup = page.appendCheckBox(
                "", "Disable system menu on popup windows",
                LatchedBoolImportCaller( g_Multimon_enableSysMenuPopups ),
                BoolExportCaller( g_Multimon_enableSysMenuPopups.m_latched )
@@ -44,7 +44,7 @@ void MultiMonitor_constructPreferences( PreferencesPage& page ){
 #include "preferencesystem.h"
 #include "stringio.h"
 
-#include <gdk/gdkdisplay.h>
+#include <gdk/gdk.h>
 
 namespace
 {
index 73639e5463756bf4b3686d29b0b48d7662d5b71f..10d1806fc55444c8a82f04ff8bde9741dc9f4632 100644 (file)
 
 #include "debugging/debugging.h"
 
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkcombobox.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkspinbutton.h>
-#include <gtk/gtkcheckbutton.h>
+#include <gtk/gtk.h>
 
 #include "gtkutil/idledraw.h"
 #include "gtkutil/entry.h"
@@ -212,7 +204,7 @@ static void applyGtk( GtkToggleButton* toggle, Subdivisions* self ){
 
 class PatchInspector : public Dialog
 {
-GtkWindow* BuildDialog();
+ui::Window BuildDialog();
 Subdivisions m_subdivisions;
 NonModalEntry m_horizontalSubdivisionsEntry;
 NonModalEntry m_verticalSubdivisionsEntry;
@@ -235,8 +227,8 @@ float m_fZ;
    float       m_fVShift; */
 int m_nCol;
 int m_nRow;
-GtkComboBox *m_pRowCombo;
-GtkComboBox *m_pColCombo;
+ui::ComboBoxText m_pRowCombo{nullptr};
+ui::ComboBoxText m_pColCombo{nullptr};
 std::size_t m_countRows;
 std::size_t m_countCols;
 
@@ -265,7 +257,7 @@ PatchInspector() :
 }
 
 bool visible(){
-       return GTK_WIDGET_VISIBLE( GetWidget() );
+       return gtk_widget_get_visible( GetWidget() );
 }
 
 //  void UpdateInfo();
@@ -284,7 +276,7 @@ void exportData();
 
 PatchInspector g_PatchInspector;
 
-void PatchInspector_constructWindow( GtkWindow* main_window ){
+void PatchInspector_constructWindow( ui::Window main_window ){
        g_PatchInspector.m_parent = main_window;
        g_PatchInspector.Create();
 }
@@ -320,7 +312,7 @@ void PatchInspector_toggleShown(){
 // static functions
 
 // memorize the current state (that is don't try to undo our do before changing something else)
-static void OnApply( GtkWidget *widget, gpointer data ){
+static void OnApply( ui::Widget widget, gpointer data ){
        g_PatchInspector.exportData();
        if ( g_PatchInspector.m_Patch != 0 ) {
                UndoableCommand command( "patchSetTexture" );
@@ -347,7 +339,7 @@ static void OnApply( GtkWidget *widget, gpointer data ){
        }
 }
 
-static void OnSelchangeComboColRow( GtkWidget *widget, gpointer data ){
+static void OnSelchangeComboColRow( ui::Widget widget, gpointer data ){
        if ( !g_PatchInspector.m_bListenChanged ) {
                return;
        }
@@ -375,27 +367,27 @@ void Scene_PatchTileTexture_Selected( scene::Graph& graph, float s, float t ){
        SceneChangeNotify();
 }
 
-static void OnBtnPatchdetails( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchdetails( ui::Widget widget, gpointer data ){
        Patch_CapTexture();
 }
 
-static void OnBtnPatchfit( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchfit( ui::Widget widget, gpointer data ){
        Patch_FitTexture();
 }
 
-static void OnBtnPatchnatural( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchnatural( ui::Widget widget, gpointer data ){
        Patch_NaturalTexture();
 }
 
-static void OnBtnPatchreset( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchreset( ui::Widget widget, gpointer data ){
        Patch_ResetTexture();
 }
 
-static void OnBtnPatchFlipX( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchFlipX( ui::Widget widget, gpointer data ){
        Patch_FlipTextureX();
 }
 
-static void OnBtnPatchFlipY( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchFlipY( ui::Widget widget, gpointer data ){
        Patch_FlipTextureY();
 }
 
@@ -455,7 +447,7 @@ void Scene_PatchTranslateTexture_Selected( scene::Graph& graph, float s, float t
        Scene_forEachVisibleSelectedPatch( PatchTranslateTexture( s, t ) );
 }
 
-static void OnBtnPatchAutoCap( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchAutoCap( ui::Widget widget, gpointer data ){
        Patch_AutoCapTexture();
 }
 
@@ -466,14 +458,14 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){
        td.scale[0] = td.scale[1] = 0;
        td.shift[0] = td.shift[1] = 0;
 
-       if ( adj->value == 0 ) {
+       if ( gtk_adjustment_get_value(adj) == 0 ) {
                return;
        }
 
        if ( adj == g_object_get_data( G_OBJECT( g_PatchInspector.GetWidget() ), "hshift_adj" ) ) {
                g_pi_globals.shift[0] = static_cast<float>( atof( gtk_entry_get_text( GTK_ENTRY( data ) ) ) );
 
-               if ( adj->value > 0 ) {
+               if ( gtk_adjustment_get_value(adj) > 0 ) {
                        td.shift[0] = g_pi_globals.shift[0];
                }
                else{
@@ -483,7 +475,7 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){
        else if ( adj == g_object_get_data( G_OBJECT( g_PatchInspector.GetWidget() ), "vshift_adj" ) ) {
                g_pi_globals.shift[1] = static_cast<float>( atof( gtk_entry_get_text( GTK_ENTRY( data ) ) ) );
 
-               if ( adj->value > 0 ) {
+               if ( gtk_adjustment_get_value(adj) > 0 ) {
                        td.shift[1] = g_pi_globals.shift[1];
                }
                else{
@@ -495,7 +487,7 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){
                if ( g_pi_globals.scale[0] == 0.0f ) {
                        return;
                }
-               if ( adj->value > 0 ) {
+               if ( gtk_adjustment_get_value(adj) > 0 ) {
                        td.scale[0] = g_pi_globals.scale[0];
                }
                else{
@@ -507,7 +499,7 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){
                if ( g_pi_globals.scale[1] == 0.0f ) {
                        return;
                }
-               if ( adj->value > 0 ) {
+               if ( gtk_adjustment_get_value(adj) > 0 ) {
                        td.scale[1] = g_pi_globals.scale[1];
                }
                else{
@@ -517,7 +509,7 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){
        else if ( adj == g_object_get_data( G_OBJECT( g_PatchInspector.GetWidget() ), "rotate_adj" ) ) {
                g_pi_globals.rotate = static_cast<float>( atof( gtk_entry_get_text( GTK_ENTRY( data ) ) ) );
 
-               if ( adj->value > 0 ) {
+               if ( gtk_adjustment_get_value(adj) > 0 ) {
                        td.rotate = g_pi_globals.rotate;
                }
                else{
@@ -525,7 +517,7 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){
                }
        }
 
-       adj->value = 0;
+       gtk_adjustment_set_value(adj, 0);
 
        // will scale shift rotate the patch accordingly
 
@@ -544,12 +536,12 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){
        }
 
        // update the point-by-point view
-       OnSelchangeComboColRow( 0,0 );
+       OnSelchangeComboColRow( ui::root ,0 );
 }
 
-static gint OnDialogKey( GtkWidget* widget, GdkEventKey* event, gpointer data ){
+static gint OnDialogKey( ui::Widget widget, GdkEventKey* event, gpointer data ){
        if ( event->keyval == GDK_Return ) {
-               OnApply( 0, 0 );
+               OnApply( ui::root, 0 );
                return TRUE;
        }
        else if ( event->keyval == GDK_Escape ) {
@@ -562,8 +554,8 @@ static gint OnDialogKey( GtkWidget* widget, GdkEventKey* event, gpointer data ){
 // =============================================================================
 // PatchInspector class
 
-GtkWindow* PatchInspector::BuildDialog(){
-       GtkWindow* window = create_floating_window( "Patch Properties", m_parent );
+ui::Window PatchInspector::BuildDialog(){
+       ui::Window window = ui::Window(create_floating_window( "Patch Properties", m_parent ));
 
        m_position_tracker.connect( window );
 
@@ -573,116 +565,116 @@ GtkWindow* PatchInspector::BuildDialog(){
 
 
        {
-               GtkVBox* vbox = GTK_VBOX( gtk_vbox_new( FALSE, 5 ) );
+               GtkVBox* vbox = ui::VBox( FALSE, 5 );
                gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
                gtk_widget_show( GTK_WIDGET( vbox ) );
                gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) );
                {
-                       GtkHBox* hbox = GTK_HBOX( gtk_hbox_new( FALSE, 5 ) );
+                       GtkHBox* hbox = ui::HBox( FALSE, 5 );
                        gtk_widget_show( GTK_WIDGET( hbox ) );
                        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), TRUE, TRUE, 0 );
                        {
-                               GtkVBox* vbox2 = GTK_VBOX( gtk_vbox_new( FALSE, 0 ) );
+                               GtkVBox* vbox2 = ui::VBox( FALSE, 0 );
                                gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 0 );
                                gtk_widget_show( GTK_WIDGET( vbox2 ) );
                                gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox2 ), TRUE, TRUE, 0 );
                                {
-                                       GtkFrame* frame = GTK_FRAME( gtk_frame_new( "Details" ) );
+                                       GtkFrame* frame = ui::Frame( "Details" );
                                        gtk_widget_show( GTK_WIDGET( frame ) );
                                        gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
                                        {
-                                               GtkVBox* vbox3 = GTK_VBOX( gtk_vbox_new( FALSE, 5 ) );
+                                               GtkVBox* vbox3 = ui::VBox( FALSE, 5 );
                                                gtk_container_set_border_width( GTK_CONTAINER( vbox3 ), 5 );
                                                gtk_widget_show( GTK_WIDGET( vbox3 ) );
                                                gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
                                                {
-                                                       GtkTable* table = GTK_TABLE( gtk_table_new( 2, 2, FALSE ) );
+                                                       GtkTable* table = ui::Table( 2, 2, FALSE );
                                                        gtk_widget_show( GTK_WIDGET( table ) );
                                                        gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
                                                        gtk_table_set_row_spacings( table, 5 );
                                                        gtk_table_set_col_spacings( table, 5 );
                                                        {
-                                                               GtkLabel* label = GTK_LABEL( gtk_label_new( "Row:" ) );
+                                                               GtkLabel* label = GTK_LABEL( ui::Label( "Row:" ) );
                                                                gtk_widget_show( GTK_WIDGET( label ) );
                                                                gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
                                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                                                                                                  (GtkAttachOptions)( 0 ), 0, 0 );
                                                        }
                                                        {
-                                                               GtkLabel* label = GTK_LABEL( gtk_label_new( "Column:" ) );
+                                                               GtkLabel* label = GTK_LABEL( ui::Label( "Column:" ) );
                                                                gtk_widget_show( GTK_WIDGET( label ) );
                                                                gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 0, 1,
                                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                                                                                                  (GtkAttachOptions)( 0 ), 0, 0 );
                                                        }
                                                        {
-                                                               GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() );
+                                                               auto combo = ui::ComboBoxText();
                                                                g_signal_connect( G_OBJECT( combo ), "changed", G_CALLBACK( OnSelchangeComboColRow ), this );
-                                                               AddDialogData( *combo, m_nRow );
+                                                               AddDialogData( *GTK_COMBO_BOX(combo), m_nRow );
 
                                                                gtk_widget_show( GTK_WIDGET( combo ) );
                                                                gtk_table_attach( table, GTK_WIDGET( combo ), 0, 1, 1, 2,
                                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                                                                                                  (GtkAttachOptions)( 0 ), 0, 0 );
-                                                               gtk_widget_set_usize( GTK_WIDGET( combo ), 60, -1 );
+                                                               gtk_widget_set_size_request( GTK_WIDGET( combo ), 60, -1 );
                                                                m_pRowCombo = combo;
                                                        }
 
                                                        {
-                                                               GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() );
+                                                               auto combo = ui::ComboBoxText();
                                                                g_signal_connect( G_OBJECT( combo ), "changed", G_CALLBACK( OnSelchangeComboColRow ), this );
-                                                               AddDialogData( *combo, m_nCol );
+                                                               AddDialogData( *GTK_COMBO_BOX(combo), m_nCol );
 
                                                                gtk_widget_show( GTK_WIDGET( combo ) );
                                                                gtk_table_attach( table, GTK_WIDGET( combo ), 1, 2, 1, 2,
                                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                                                                                                  (GtkAttachOptions)( 0 ), 0, 0 );
-                                                               gtk_widget_set_usize( GTK_WIDGET( combo ), 60, -1 );
+                                                               gtk_widget_set_size_request( GTK_WIDGET( combo ), 60, -1 );
                                                                m_pColCombo = combo;
                                                        }
                                                }
-                                               GtkTable* table = GTK_TABLE( gtk_table_new( 5, 2, FALSE ) );
+                                               GtkTable* table = ui::Table( 5, 2, FALSE );
                                                gtk_widget_show( GTK_WIDGET( table ) );
                                                gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
                                                gtk_table_set_row_spacings( table, 5 );
                                                gtk_table_set_col_spacings( table, 5 );
                                                {
-                                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "X:" ) );
+                                                       GtkLabel* label = GTK_LABEL( ui::Label( "X:" ) );
                                                        gtk_widget_show( GTK_WIDGET( label ) );
                                                        gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
                                                                                          (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
                                                }
                                                {
-                                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Y:" ) );
+                                                       GtkLabel* label = GTK_LABEL( ui::Label( "Y:" ) );
                                                        gtk_widget_show( GTK_WIDGET( label ) );
                                                        gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
                                                                                          (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
                                                }
                                                {
-                                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Z:" ) );
+                                                       GtkLabel* label = GTK_LABEL( ui::Label( "Z:" ) );
                                                        gtk_widget_show( GTK_WIDGET( label ) );
                                                        gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 2, 3,
                                                                                          (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
                                                }
                                                {
-                                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "S:" ) );
+                                                       GtkLabel* label = GTK_LABEL( ui::Label( "S:" ) );
                                                        gtk_widget_show( GTK_WIDGET( label ) );
                                                        gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 3, 4,
                                                                                          (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
                                                }
                                                {
-                                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "T:" ) );
+                                                       GtkLabel* label = GTK_LABEL( ui::Label( "T:" ) );
                                                        gtk_widget_show( GTK_WIDGET( label ) );
                                                        gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 4, 5,
                                                                                          (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
                                                }
                                                {
-                                                       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                                       GtkEntry* entry = ui::Entry();
                                                        gtk_widget_show( GTK_WIDGET( entry ) );
                                                        gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1,
                                                                                          (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
@@ -692,7 +684,7 @@ GtkWindow* PatchInspector::BuildDialog(){
                                                        g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
                                                }
                                                {
-                                                       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                                       GtkEntry* entry = ui::Entry();
                                                        gtk_widget_show( GTK_WIDGET( entry ) );
                                                        gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
                                                                                          (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
@@ -702,7 +694,7 @@ GtkWindow* PatchInspector::BuildDialog(){
                                                        g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
                                                }
                                                {
-                                                       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                                       GtkEntry* entry = ui::Entry();
                                                        gtk_widget_show( GTK_WIDGET( entry ) );
                                                        gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 2, 3,
                                                                                          (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
@@ -712,7 +704,7 @@ GtkWindow* PatchInspector::BuildDialog(){
                                                        g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
                                                }
                                                {
-                                                       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                                       GtkEntry* entry = ui::Entry();
                                                        gtk_widget_show( GTK_WIDGET( entry ) );
                                                        gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 3, 4,
                                                                                          (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
@@ -722,7 +714,7 @@ GtkWindow* PatchInspector::BuildDialog(){
                                                        g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
                                                }
                                                {
-                                                       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                                       GtkEntry* entry = ui::Entry();
                                                        gtk_widget_show( GTK_WIDGET( entry ) );
                                                        gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 4, 5,
                                                                                          (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
@@ -734,22 +726,22 @@ GtkWindow* PatchInspector::BuildDialog(){
                                        }
                                }
                                if ( g_pGameDescription->mGameType == "doom3" ) {
-                                       GtkFrame* frame = GTK_FRAME( gtk_frame_new( "Tesselation" ) );
+                                       GtkFrame* frame = ui::Frame( "Tesselation" );
                                        gtk_widget_show( GTK_WIDGET( frame ) );
                                        gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
                                        {
-                                               GtkVBox* vbox3 = GTK_VBOX( gtk_vbox_new( FALSE, 5 ) );
+                                               GtkVBox* vbox3 = ui::VBox( FALSE, 5 );
                                                gtk_container_set_border_width( GTK_CONTAINER( vbox3 ), 5 );
                                                gtk_widget_show( GTK_WIDGET( vbox3 ) );
                                                gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
                                                {
-                                                       GtkTable* table = GTK_TABLE( gtk_table_new( 3, 2, FALSE ) );
+                                                       GtkTable* table = ui::Table( 3, 2, FALSE );
                                                        gtk_widget_show( GTK_WIDGET( table ) );
                                                        gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
                                                        gtk_table_set_row_spacings( table, 5 );
                                                        gtk_table_set_col_spacings( table, 5 );
                                                        {
-                                                               GtkLabel* label = GTK_LABEL( gtk_label_new( "Fixed" ) );
+                                                               GtkLabel* label = GTK_LABEL( ui::Label( "Fixed" ) );
                                                                gtk_widget_show( GTK_WIDGET( label ) );
                                                                gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
                                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
@@ -766,14 +758,14 @@ GtkWindow* PatchInspector::BuildDialog(){
                                                                g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( handler_id ) );
                                                        }
                                                        {
-                                                               GtkLabel* label = GTK_LABEL( gtk_label_new( "Horizontal" ) );
+                                                               GtkLabel* label = GTK_LABEL( ui::Label( "Horizontal" ) );
                                                                gtk_widget_show( GTK_WIDGET( label ) );
                                                                gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
                                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                                                                                                  (GtkAttachOptions)( 0 ), 0, 0 );
                                                        }
                                                        {
-                                                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                                               GtkEntry* entry = ui::Entry();
                                                                gtk_widget_show( GTK_WIDGET( entry ) );
                                                                gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
                                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
@@ -782,14 +774,14 @@ GtkWindow* PatchInspector::BuildDialog(){
                                                                m_horizontalSubdivisionsEntry.connect( entry );
                                                        }
                                                        {
-                                                               GtkLabel* label = GTK_LABEL( gtk_label_new( "Vertical" ) );
+                                                               GtkLabel* label = GTK_LABEL( ui::Label( "Vertical" ) );
                                                                gtk_widget_show( GTK_WIDGET( label ) );
                                                                gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 2, 3,
                                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                                                                                                  (GtkAttachOptions)( 0 ), 0, 0 );
                                                        }
                                                        {
-                                                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                                               GtkEntry* entry = ui::Entry();
                                                                gtk_widget_show( GTK_WIDGET( entry ) );
                                                                gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 2, 3,
                                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
@@ -802,24 +794,24 @@ GtkWindow* PatchInspector::BuildDialog(){
                                }
                        }
                        {
-                               GtkFrame* frame = GTK_FRAME( gtk_frame_new( "Texturing" ) );
+                               GtkFrame* frame = ui::Frame( "Texturing" );
                                gtk_widget_show( GTK_WIDGET( frame ) );
                                gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
                                {
-                                       GtkVBox* vbox2 = GTK_VBOX( gtk_vbox_new( FALSE, 5 ) );
+                                       GtkVBox* vbox2 = ui::VBox( FALSE, 5 );
                                        gtk_widget_show( GTK_WIDGET( vbox2 ) );
                                        gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox2 ) );
                                        gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
                                        {
-                                               GtkLabel* label = GTK_LABEL( gtk_label_new( "Name:" ) );
+                                               GtkLabel* label = GTK_LABEL( ui::Label( "Name:" ) );
                                                gtk_widget_show( GTK_WIDGET( label ) );
                                                gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( label ), TRUE, TRUE, 0 );
                                                gtk_label_set_justify( label, GTK_JUSTIFY_LEFT );
                                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                        }
                                        {
-                                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
-                                               //  gtk_entry_set_editable (GTK_ENTRY (entry), false);
+                                               GtkEntry* entry = ui::Entry();
+                                               //  gtk_editable_set_editable (GTK_ENTRY (entry), false);
                                                gtk_widget_show( GTK_WIDGET( entry ) );
                                                gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
                                                AddDialogData( *entry, m_strName );
@@ -827,13 +819,13 @@ GtkWindow* PatchInspector::BuildDialog(){
                                                g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
                                        }
                                        {
-                                               GtkTable* table = GTK_TABLE( gtk_table_new( 5, 4, FALSE ) );
+                                               GtkTable* table = ui::Table( 5, 4, FALSE );
                                                gtk_widget_show( GTK_WIDGET( table ) );
                                                gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
                                                gtk_table_set_row_spacings( table, 5 );
                                                gtk_table_set_col_spacings( table, 5 );
                                                {
-                                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Horizontal Shift Step" ) );
+                                                       GtkLabel* label = GTK_LABEL( ui::Label( "Horizontal Shift Step" ) );
                                                        gtk_widget_show( GTK_WIDGET( label ) );
                                                        gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 0, 1,
                                                                                          (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
@@ -841,7 +833,7 @@ GtkWindow* PatchInspector::BuildDialog(){
                                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                                }
                                                {
-                                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Vertical Shift Step" ) );
+                                                       GtkLabel* label = GTK_LABEL( ui::Label( "Vertical Shift Step" ) );
                                                        gtk_widget_show( GTK_WIDGET( label ) );
                                                        gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 1, 2,
                                                                                          (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
@@ -849,7 +841,7 @@ GtkWindow* PatchInspector::BuildDialog(){
                                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                                }
                                                {
-                                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Horizontal Stretch Step" ) );
+                                                       GtkLabel* label = GTK_LABEL( ui::Label( "Horizontal Stretch Step" ) );
                                                        gtk_widget_show( GTK_WIDGET( label ) );
                                                        gtk_table_attach( table, GTK_WIDGET( label ), 2, 3, 2, 3,
                                                                                          (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
@@ -857,16 +849,16 @@ GtkWindow* PatchInspector::BuildDialog(){
                                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                                }
                                                {
-                                                       GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Flip" ) );
+                                                       GtkButton* button = ui::Button( "Flip" );
                                                        gtk_widget_show( GTK_WIDGET( button ) );
                                                        gtk_table_attach( table, GTK_WIDGET( button ), 3, 4, 2, 3,
                                                                                          (GtkAttachOptions)( GTK_FILL ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
                                                        g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchFlipX ), 0 );
-                                                       gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+                                                       gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
                                                }
                                                {
-                                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Vertical Stretch Step" ) );
+                                                       GtkLabel* label = GTK_LABEL( ui::Label( "Vertical Stretch Step" ) );
                                                        gtk_widget_show( GTK_WIDGET( label ) );
                                                        gtk_table_attach( table, GTK_WIDGET( label ), 2, 3, 3, 4,
                                                                                          (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
@@ -874,16 +866,16 @@ GtkWindow* PatchInspector::BuildDialog(){
                                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                                }
                                                {
-                                                       GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Flip" ) );
+                                                       GtkButton* button = ui::Button( "Flip" );
                                                        gtk_widget_show( GTK_WIDGET( button ) );
                                                        gtk_table_attach( table, GTK_WIDGET( button ), 3, 4, 3, 4,
                                                                                          (GtkAttachOptions)( GTK_FILL ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
                                                        g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchFlipY ), 0 );
-                                                       gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+                                                       gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
                                                }
                                                {
-                                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Rotate Step" ) );
+                                                       GtkLabel* label = GTK_LABEL( ui::Label( "Rotate Step" ) );
                                                        gtk_widget_show( GTK_WIDGET( label ) );
                                                        gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 4, 5,
                                                                                          (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
@@ -891,151 +883,151 @@ GtkWindow* PatchInspector::BuildDialog(){
                                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                                }
                                                {
-                                                       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                                       GtkEntry* entry = ui::Entry();
                                                        gtk_widget_show( GTK_WIDGET( entry ) );
                                                        gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 0, 1,
                                                                                          (GtkAttachOptions)( GTK_FILL ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
-                                                       gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+                                                       gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
                                                        g_object_set_data( G_OBJECT( window ), "hshift_entry", entry );
                                                        // we fill in this data, if no patch is selected the widgets are unmodified when the inspector is raised
                                                        // so we need to have at least one initialisation somewhere
                                                        entry_set_float( entry, g_pi_globals.shift[0] );
 
-                                                       GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 1, 1, 0 ) );
-                                                       g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
-                                                       g_object_set_data( G_OBJECT( window ), "hshift_adj", adj );
+                                                       auto adj = ui::Adjustment( 0, -8192, 8192, 1, 1, 0 );
+                                                       g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), (gpointer) entry );
+                                                       g_object_set_data( G_OBJECT( window ), "hshift_adj", (gpointer) adj );
 
-                                                       GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+                                                       auto spin = ui::SpinButton( adj, 1, 0 );
                                                        gtk_widget_show( GTK_WIDGET( spin ) );
                                                        gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 0, 1,
                                                                                          (GtkAttachOptions)( 0 ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
-                                                       gtk_widget_set_usize( GTK_WIDGET( spin ), 10, -2 );
-                                                       GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS );
+                                                       gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 );
+                                                       gtk_widget_set_can_focus( spin, false );
                                                }
                                                {
-                                                       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                                       GtkEntry* entry = ui::Entry();
                                                        gtk_widget_show( GTK_WIDGET( entry ) );
                                                        gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 1, 2,
                                                                                          (GtkAttachOptions)( GTK_FILL ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
-                                                       gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+                                                       gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
                                                        entry_set_float( entry, g_pi_globals.shift[1] );
 
-                                                       GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 1, 1, 0 ) );
+                                                       auto adj = ui::Adjustment( 0, -8192, 8192, 1, 1, 0 );
                                                        g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
-                                                       g_object_set_data( G_OBJECT( window ), "vshift_adj", adj );
+                                                       g_object_set_data( G_OBJECT( window ), "vshift_adj", (gpointer) adj );
 
-                                                       GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+                                                       auto spin = ui::SpinButton( adj, 1, 0 );
                                                        gtk_widget_show( GTK_WIDGET( spin ) );
                                                        gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 1, 2,
                                                                                          (GtkAttachOptions)( 0 ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
-                                                       gtk_widget_set_usize( GTK_WIDGET( spin ), 10, -2 );
-                                                       GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS );
+                                                       gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 );
+                                                       gtk_widget_set_can_focus( spin, false );
                                                }
                                                {
-                                                       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                                       GtkEntry* entry = ui::Entry();
                                                        gtk_widget_show( GTK_WIDGET( entry ) );
                                                        gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 2, 3,
                                                                                          (GtkAttachOptions)( GTK_FILL ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
-                                                       gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+                                                       gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
                                                        entry_set_float( entry, g_pi_globals.scale[0] );
 
-                                                       GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 1, 0 ) );
+                                                       auto adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 );
                                                        g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
-                                                       g_object_set_data( G_OBJECT( window ), "hscale_adj", adj );
+                                                       g_object_set_data( G_OBJECT( window ), "hscale_adj", (gpointer) adj );
 
-                                                       GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+                                                       auto spin = ui::SpinButton( adj, 1, 0 );
                                                        gtk_widget_show( GTK_WIDGET( spin ) );
                                                        gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 2, 3,
                                                                                          (GtkAttachOptions)( 0 ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
-                                                       gtk_widget_set_usize( GTK_WIDGET( spin ), 10, -2 );
-                                                       GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS );
+                                                       gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 );
+                                                       gtk_widget_set_can_focus( spin, false );
                                                }
                                                {
-                                                       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                                       GtkEntry* entry = ui::Entry();
                                                        gtk_widget_show( GTK_WIDGET( entry ) );
                                                        gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 3, 4,
                                                                                          (GtkAttachOptions)( GTK_FILL ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
-                                                       gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+                                                       gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
                                                        entry_set_float( entry, g_pi_globals.scale[1] );
 
-                                                       GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 1, 0 ) );
+                                                       auto adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 );
                                                        g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
-                                                       g_object_set_data( G_OBJECT( window ), "vscale_adj", adj );
+                                                       g_object_set_data( G_OBJECT( window ), "vscale_adj", (gpointer) adj );
 
-                                                       GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+                                                       auto spin = ui::SpinButton( adj, 1, 0 );
                                                        gtk_widget_show( GTK_WIDGET( spin ) );
                                                        gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 3, 4,
                                                                                          (GtkAttachOptions)( 0 ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
-                                                       gtk_widget_set_usize( GTK_WIDGET( spin ), 10, -2 );
-                                                       GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS );
+                                                       gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 );
+                                                       gtk_widget_set_can_focus( spin, false );
                                                }
                                                {
-                                                       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                                       GtkEntry* entry = ui::Entry();
                                                        gtk_widget_show( GTK_WIDGET( entry ) );
                                                        gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 4, 5,
                                                                                          (GtkAttachOptions)( GTK_FILL ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
-                                                       gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+                                                       gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
                                                        entry_set_float( entry, g_pi_globals.rotate );
 
-                                                       GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 1, 0 ) ); // NOTE: Arnout - this really should be 360 but can't change it anymore as it could break existing maps
+                                                       auto adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 ); // NOTE: Arnout - this really should be 360 but can't change it anymore as it could break existing maps
                                                        g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
-                                                       g_object_set_data( G_OBJECT( window ), "rotate_adj", adj );
+                                                       g_object_set_data( G_OBJECT( window ), "rotate_adj", (gpointer) adj );
 
-                                                       GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+                                                       auto spin = ui::SpinButton( adj, 1, 0 );
                                                        gtk_widget_show( GTK_WIDGET( spin ) );
                                                        gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 4, 5,
                                                                                          (GtkAttachOptions)( 0 ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
-                                                       gtk_widget_set_usize( GTK_WIDGET( spin ), 10, -2 );
-                                                       GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS );
+                                                       gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 );
+                                                       gtk_widget_set_can_focus( spin, false );
                                                }
                                        }
-                                       GtkHBox* hbox2 = GTK_HBOX( gtk_hbox_new( TRUE, 5 ) );
+                                       GtkHBox* hbox2 = ui::HBox( TRUE, 5 );
                                        gtk_widget_show( GTK_WIDGET( hbox2 ) );
                                        gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( hbox2 ), TRUE, FALSE, 0 );
                                        {
-                                               GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Auto Cap" ) );
+                                               GtkButton* button = ui::Button( "Auto Cap" );
                                                gtk_widget_show( GTK_WIDGET( button ) );
                                                gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
                                                g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchAutoCap ), 0 );
-                                               gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+                                               gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
                                        }
                                        {
-                                               GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "CAP" ) );
+                                               GtkButton* button = ui::Button( "CAP" );
                                                gtk_widget_show( GTK_WIDGET( button ) );
                                                gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
                                                g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchdetails ), 0 );
-                                               gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+                                               gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
                                        }
                                        {
-                                               GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Set..." ) );
+                                               GtkButton* button = ui::Button( "Set..." );
                                                gtk_widget_show( GTK_WIDGET( button ) );
                                                gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
                                                g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchreset ), 0 );
-                                               gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+                                               gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
                                        }
                                        {
-                                               GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Natural" ) );
+                                               GtkButton* button = ui::Button( "Natural" );
                                                gtk_widget_show( GTK_WIDGET( button ) );
                                                gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
                                                g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchnatural ), 0 );
-                                               gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+                                               gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
                                        }
                                        {
-                                               GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Fit" ) );
+                                               GtkButton* button = ui::Button( "Fit" );
                                                gtk_widget_show( GTK_WIDGET( button ) );
                                                gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
                                                g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchfit ), 0 );
-                                               gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+                                               gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
                                        }
                                }
                        }
@@ -1082,7 +1074,7 @@ void PatchInspector::GetPatchInfo(){
 
                        for ( std::size_t i = 0; i < m_countRows; ++i )
                        {
-                               gtk_combo_box_remove_text( m_pRowCombo, gint( m_countRows - i - 1 ) );
+                               gtk_combo_box_text_remove( m_pRowCombo, gint( m_countRows - i - 1 ) );
                        }
 
                        m_countRows = m_Patch->getHeight();
@@ -1090,7 +1082,7 @@ void PatchInspector::GetPatchInfo(){
                        {
                                char buffer[16];
                                sprintf( buffer, "%u", Unsigned( i ) );
-                               gtk_combo_box_append_text( m_pRowCombo, buffer );
+                               gtk_combo_box_text_append_text( m_pRowCombo, buffer );
                        }
 
                        gtk_combo_box_set_active( m_pRowCombo, 0 );
@@ -1101,7 +1093,7 @@ void PatchInspector::GetPatchInfo(){
 
                        for ( std::size_t i = 0; i < m_countCols; ++i )
                        {
-                               gtk_combo_box_remove_text( m_pColCombo, gint( m_countCols - i - 1 ) );
+                               gtk_combo_box_text_remove( m_pColCombo, gint( m_countCols - i - 1 ) );
                        }
 
                        m_countCols = m_Patch->getWidth();
@@ -1109,7 +1101,7 @@ void PatchInspector::GetPatchInfo(){
                        {
                                char buffer[16];
                                sprintf( buffer, "%u", Unsigned( i ) );
-                               gtk_combo_box_append_text( m_pColCombo, buffer );
+                               gtk_combo_box_text_append_text( m_pColCombo, buffer );
                        }
 
                        gtk_combo_box_set_active( m_pColCombo, 0 );
index 1304ccbe23cac1f203b0dd5fc9d674f7a551fd8c..ca1f6c9eeb0671cb5645c2cf9178298c42210ee3 100644 (file)
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <uilib/uilib.h>
+
 #if !defined( INCLUDED_PATCHDIALOG_H )
 #define INCLUDED_PATCHDIALOG_H
 
 void PatchInspector_Construct();
 void PatchInspector_Destroy();
 
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-void PatchInspector_constructWindow( GtkWindow* main_window );
+void PatchInspector_constructWindow( ui::Window main_window );
 void PatchInspector_destroyWindow();
 
 namespace scene
index 909e3466311f966e23e11e9af66ddea22f221764..ac4dbd3af687ad6b966d5452618d1bedf2f99b57 100644 (file)
@@ -19,6 +19,7 @@
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <gdk/gdkkeysyms.h>
 #include "patchmanip.h"
 
 #include "debugging/debugging.h"
@@ -723,13 +724,13 @@ void Patch_registerCommands(){
        GlobalCommands_insert( "PatchCone", FreeCaller<Patch_Cone>() );
        GlobalCommands_insert( "PatchSphere", FreeCaller<Patch_Sphere>() );
        GlobalCommands_insert( "SimplePatchMesh", FreeCaller<Patch_Plane>(), Accelerator( 'P', (GdkModifierType)GDK_SHIFT_MASK ) );
-       GlobalCommands_insert( "PatchInsertInsertColumn", FreeCaller<Patch_InsertInsertColumn>(), Accelerator( GDK_KP_Add, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "PatchInsertInsertColumn", FreeCaller<Patch_InsertInsertColumn>(), Accelerator( GDK_KEY_KP_Add, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
        GlobalCommands_insert( "PatchInsertAddColumn", FreeCaller<Patch_InsertAddColumn>() );
-       GlobalCommands_insert( "PatchInsertInsertRow", FreeCaller<Patch_InsertInsertRow>(), Accelerator( GDK_KP_Add, (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "PatchInsertInsertRow", FreeCaller<Patch_InsertInsertRow>(), Accelerator( GDK_KEY_KP_Add, (GdkModifierType)GDK_CONTROL_MASK ) );
        GlobalCommands_insert( "PatchInsertAddRow", FreeCaller<Patch_InsertAddRow>() );
        GlobalCommands_insert( "PatchDeleteFirstColumn", FreeCaller<Patch_DeleteFirstColumn>() );
-       GlobalCommands_insert( "PatchDeleteLastColumn", FreeCaller<Patch_DeleteLastColumn>(), Accelerator( GDK_KP_Subtract, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
-       GlobalCommands_insert( "PatchDeleteFirstRow", FreeCaller<Patch_DeleteFirstRow>(), Accelerator( GDK_KP_Subtract, (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "PatchDeleteLastColumn", FreeCaller<Patch_DeleteLastColumn>(), Accelerator( GDK_KEY_KP_Subtract, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "PatchDeleteFirstRow", FreeCaller<Patch_DeleteFirstRow>(), Accelerator( GDK_KEY_KP_Subtract, (GdkModifierType)GDK_CONTROL_MASK ) );
        GlobalCommands_insert( "PatchDeleteLastRow", FreeCaller<Patch_DeleteLastRow>() );
        GlobalCommands_insert( "InvertCurve", FreeCaller<Patch_Invert>(), Accelerator( 'I', (GdkModifierType)GDK_CONTROL_MASK ) );
        GlobalCommands_insert( "RedisperseRows", FreeCaller<Patch_RedisperseRows>(), Accelerator( 'E', (GdkModifierType)GDK_CONTROL_MASK ) );
@@ -837,12 +838,7 @@ void Patch_constructMenu( GtkMenu* menu ){
 }
 
 
-#include <gtk/gtkbox.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtkradiobutton.h>
-#include <gtk/gtkcombobox.h>
-#include <gtk/gtklabel.h>
+#include <gtk/gtk.h>
 #include "gtkutil/dialog.h"
 #include "gtkutil/widget.h"
 
@@ -851,9 +847,9 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows,
        GtkComboBox* width;
        GtkComboBox* height;
 
-       GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Patch density", G_CALLBACK( dialog_delete_callback ), &dialog );
+       ui::Window window = MainFrame_getWindow().create_dialog_window("Patch density", G_CALLBACK(dialog_delete_callback ), &dialog );
 
-       GtkAccelGroup* accel = gtk_accel_group_new();
+       GtkAccelGroup* accel = ui::AccelGroup();
        gtk_window_add_accel_group( window, accel );
 
        {
@@ -863,7 +859,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows,
                        GtkTable* table = create_dialog_table( 2, 2, 4, 4 );
                        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
                        {
-                               GtkLabel* label = GTK_LABEL( gtk_label_new( "Width:" ) );
+                               GtkLabel* label = GTK_LABEL( ui::Label( "Width:" ) );
                                gtk_widget_show( GTK_WIDGET( label ) );
                                gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
@@ -871,7 +867,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows,
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                        }
                        {
-                               GtkLabel* label = GTK_LABEL( gtk_label_new( "Height:" ) );
+                               GtkLabel* label = GTK_LABEL( ui::Label( "Height:" ) );
                                gtk_widget_show( GTK_WIDGET( label ) );
                                gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
@@ -880,8 +876,8 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows,
                        }
 
                        {
-                               GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() );
-#define D_ITEM( x ) if ( x >= mincols && ( !maxcols || x <= maxcols ) ) gtk_combo_box_append_text( combo, # x )
+                               auto combo = ui::ComboBoxText();
+#define D_ITEM( x ) if ( x >= mincols && ( !maxcols || x <= maxcols ) ) gtk_combo_box_text_append_text( combo, # x )
                                D_ITEM( 3 );
                                D_ITEM( 5 );
                                D_ITEM( 7 );
@@ -906,8 +902,8 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows,
                                width = combo;
                        }
                        {
-                               GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() );
-#define D_ITEM( x ) if ( x >= minrows && ( !maxrows || x <= maxrows ) ) gtk_combo_box_append_text( combo, # x )
+                               auto combo = ui::ComboBoxText();
+#define D_ITEM( x ) if ( x >= minrows && ( !maxrows || x <= maxrows ) ) gtk_combo_box_text_append_text( combo, # x )
                                D_ITEM( 3 );
                                D_ITEM( 5 );
                                D_ITEM( 7 );
@@ -972,15 +968,15 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){
        ModalDialog dialog;
        ModalDialogButton ok_button( dialog, eIDOK );
        ModalDialogButton cancel_button( dialog, eIDCANCEL );
-       GtkWidget* bevel;
-       GtkWidget* ibevel;
-       GtkWidget* endcap;
-       GtkWidget* iendcap;
-       GtkWidget* cylinder;
+       ui::Widget bevel;
+       ui::Widget ibevel;
+       ui::Widget endcap;
+       ui::Widget iendcap;
+       ui::Widget cylinder;
 
-       GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "Cap", dialog );
+       ui::Window window = MainFrame_getWindow().create_modal_dialog_window( "Cap", dialog );
 
-       GtkAccelGroup *accel_group = gtk_accel_group_new();
+       GtkAccelGroup *accel_group = ui::AccelGroup();
        gtk_window_add_accel_group( window, accel_group );
 
        {
@@ -993,7 +989,7 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){
                        gtk_container_add( GTK_CONTAINER( hbox ), GTK_WIDGET( radio_vbox ) );
 
                        {
-                               GtkTable* table = GTK_TABLE( gtk_table_new( 5, 2, FALSE ) );
+                               GtkTable* table = ui::Table( 5, 2, FALSE );
                                gtk_widget_show( GTK_WIDGET( table ) );
                                gtk_box_pack_start( GTK_BOX( radio_vbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
                                gtk_table_set_row_spacings( table, 5 );
@@ -1037,52 +1033,52 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){
 
                                GSList* group = 0;
                                {
-                                       GtkWidget* button = gtk_radio_button_new_with_label( group, "Bevel" );
+                                       ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Bevel" ));
                                        gtk_widget_show( button );
                                        gtk_table_attach( table, button, 1, 2, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-                                       group = gtk_radio_button_group( GTK_RADIO_BUTTON( button ) );
+                                       group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) );
 
                                        bevel = button;
                                }
                                {
-                                       GtkWidget* button = gtk_radio_button_new_with_label( group, "Endcap" );
+                                       ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Endcap" ));
                                        gtk_widget_show( button );
                                        gtk_table_attach( table, button, 1, 2, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-                                       group = gtk_radio_button_group( GTK_RADIO_BUTTON( button ) );
+                                       group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) );
 
                                        endcap = button;
                                }
                                {
-                                       GtkWidget* button = gtk_radio_button_new_with_label( group, "Inverted Bevel" );
+                                       ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Inverted Bevel" ));
                                        gtk_widget_show( button );
                                        gtk_table_attach( table, button, 1, 2, 2, 3,
                                                                          (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-                                       group = gtk_radio_button_group( GTK_RADIO_BUTTON( button ) );
+                                       group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) );
 
                                        ibevel = button;
                                }
                                {
-                                       GtkWidget* button = gtk_radio_button_new_with_label( group, "Inverted Endcap" );
+                                       ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Inverted Endcap" ));
                                        gtk_widget_show( button );
                                        gtk_table_attach( table, button, 1, 2, 3, 4,
                                                                          (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-                                       group = gtk_radio_button_group( GTK_RADIO_BUTTON( button ) );
+                                       group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) );
 
                                        iendcap = button;
                                }
                                {
-                                       GtkWidget* button = gtk_radio_button_new_with_label( group, "Cylinder" );
+                                       ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Cylinder" ));
                                        gtk_widget_show( button );
                                        gtk_table_attach( table, button, 1, 2, 4, 5,
                                                                          (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-                                       group = gtk_radio_button_group( GTK_RADIO_BUTTON( button ) );
+                                       group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) );
 
                                        cylinder = button;
                                }
index 30cc0c2390e42ddc6f6ad6b3892d73a8ac81c31b..91e9f9ae184f9af759c36e4e75d894c2de222c70 100644 (file)
@@ -53,7 +53,7 @@ public:
 /*!
    build directly from a SYN_PROVIDE interface
  */
-CPluginSlot( GtkWidget* main_window, const char* name, const _QERPluginTable& table );
+CPluginSlot( ui::Widget main_window, const char* name, const _QERPluginTable& table );
 /*!
    dispatching a command by name to the plugin
  */
@@ -69,7 +69,7 @@ bool ownsCommandID( std::size_t n );
 
 };
 
-CPluginSlot::CPluginSlot( GtkWidget* main_window, const char* name, const _QERPluginTable& table ){
+CPluginSlot::CPluginSlot( ui::Widget main_window, const char* name, const _QERPluginTable& table ){
        mpTable = &table;
        m_menu_name = name;
 
@@ -149,7 +149,7 @@ std::list<CPluginSlot *> mSlots;
 public:
 virtual ~CPluginSlots();
 
-void AddPluginSlot( GtkWidget* main_window, const char* name, const _QERPluginTable& table ){
+void AddPluginSlot( ui::Widget main_window, const char* name, const _QERPluginTable& table ){
        mSlots.push_back( new CPluginSlot( main_window, name, table ) );
 }
 
@@ -190,13 +190,13 @@ bool CPluginSlots::Dispatch( std::size_t n, const char* p ){
 CPluginSlots g_plugin_slots;
 
 
-void FillPluginSlots( CPluginSlots& slots, GtkWidget* main_window ){
+void FillPluginSlots( CPluginSlots& slots, ui::Widget main_window ){
        class AddPluginVisitor : public PluginModules::Visitor
        {
        CPluginSlots& m_slots;
-       GtkWidget* m_main_window;
+       ui::Widget m_main_window;
 public:
-       AddPluginVisitor( CPluginSlots& slots, GtkWidget* main_window )
+       AddPluginVisitor( CPluginSlots& slots, ui::Widget main_window )
                : m_slots( slots ), m_main_window( main_window ){
        }
        void visit( const char* name, const _QERPluginTable& table ) const {
@@ -220,7 +220,7 @@ void CPlugInManager::Dispatch( std::size_t n, const char * p ){
        g_plugin_slots.Dispatch( n, p );
 }
 
-void CPlugInManager::Init( GtkWidget* main_window ){
+void CPlugInManager::Init( ui::Widget main_window ){
        FillPluginSlots( g_plugin_slots, main_window );
 }
 
index d7943fb35ea684551bceb8c4446d7f00f8c06fde..6603f6e1e4cc1db1e73449f2ae6c3c20ad3799e2 100644 (file)
@@ -23,8 +23,8 @@
 #define INCLUDED_PLUGINMANAGER_H
 
 #include <cstddef>
+#include <uilib/uilib.h>
 
-typedef struct _GtkWidget GtkWidget;
 
 /*!
    \class IPlugin
@@ -55,7 +55,7 @@ class CPlugInManager
 {
 public:
 void Dispatch( std::size_t n, const char *p );
-void Init( GtkWidget* main_window );
+void Init( ui::Widget main_window );
 void constructMenu( PluginsVisitor& menu );
 void Shutdown();
 };
index 4708a78ce42bd4b3441fff506fe00d96af66a8dc..fb97825abbc39098d4fa31b7b3096f094c369e91 100644 (file)
@@ -23,8 +23,7 @@
 
 #include "stream/textstream.h"
 
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkmenuitem.h>
+#include <gtk/gtk.h>
 
 #include "gtkutil/pointer.h"
 #include "gtkutil/menu.h"
 
 int m_nNextPlugInID = 0;
 
-void plugin_activated( GtkWidget* widget, gpointer data ){
+void plugin_activated( ui::Widget widget, gpointer data ){
        const char* str = (const char*)g_object_get_data( G_OBJECT( widget ),"command" );
        GetPlugInMgr().Dispatch( gpointer_to_int( data ), str );
 }
 
 #include <stack>
-typedef std::stack<GtkWidget*> WidgetStack;
+typedef std::stack<ui::Widget> WidgetStack;
 
 void PlugInMenu_Add( GtkMenu* plugin_menu, IPlugIn* pPlugIn ){
-       GtkWidget *menu, *item, *parent, *subMenu;
+       ui::Widget menu, item, parent, subMenu;
        const char *menuText, *menuCommand;
        WidgetStack menuStack;
 
-       parent = gtk_menu_item_new_with_label( pPlugIn->getMenuName() );
+       parent = ui::MenuItem( pPlugIn->getMenuName() );
        gtk_widget_show( parent );
        gtk_container_add( GTK_CONTAINER( plugin_menu ), parent );
 
        std::size_t nCount = pPlugIn->getCommandCount();
        if ( nCount > 0 ) {
-               menu = gtk_menu_new();
+               menu = ui::Menu();
                if ( g_Layout_enableDetachableMenus.m_value ) {
                        menu_tearoff( GTK_MENU( menu ) );
                }
@@ -66,7 +65,7 @@ void PlugInMenu_Add( GtkMenu* plugin_menu, IPlugIn* pPlugIn ){
 
                        if ( menuText != 0 && strlen( menuText ) > 0 ) {
                                if ( !strcmp( menuText, "-" ) ) {
-                                       item = gtk_menu_item_new();
+                                       item = ui::Widget(gtk_menu_item_new());
                                        gtk_widget_set_sensitive( item, FALSE );
                                }
                                else if ( !strcmp( menuText, ">" ) ) {
@@ -77,11 +76,11 @@ void PlugInMenu_Add( GtkMenu* plugin_menu, IPlugIn* pPlugIn ){
                                                continue;
                                        }
 
-                                       item = gtk_menu_item_new_with_label( menuText );
+                                       item = ui::MenuItem( menuText );
                                        gtk_widget_show( item );
                                        gtk_container_add( GTK_CONTAINER( menu ), item );
 
-                                       subMenu = gtk_menu_new();
+                                       subMenu = ui::Menu();
                                        gtk_menu_item_set_submenu( GTK_MENU_ITEM( item ), subMenu );
                                        menuStack.push( menu );
                                        menu = subMenu;
@@ -100,7 +99,7 @@ void PlugInMenu_Add( GtkMenu* plugin_menu, IPlugIn* pPlugIn ){
                                }
                                else
                                {
-                                       item = gtk_menu_item_new_with_label( menuText );
+                                       item = ui::MenuItem( menuText );
                                        g_object_set_data( G_OBJECT( item ),"command", const_cast<gpointer>( static_cast<const void*>( menuCommand ) ) );
                                        g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( plugin_activated ), gint_to_pointer( m_nNextPlugInID ) );
                                }
@@ -147,11 +146,11 @@ public:
 void PluginsMenu_clear(){
        m_nNextPlugInID = 0;
 
-       GList* lst = g_list_find( gtk_container_children( GTK_CONTAINER( g_plugins_menu ) ), GTK_WIDGET( g_plugins_menu_separator ) );
+       GList* lst = g_list_find( gtk_container_get_children( GTK_CONTAINER( g_plugins_menu ) ), GTK_WIDGET( g_plugins_menu_separator ) );
        while ( lst->next )
        {
                gtk_container_remove( GTK_CONTAINER( g_plugins_menu ), GTK_WIDGET( lst->next->data ) );
-               lst = g_list_find( gtk_container_children( GTK_CONTAINER( g_plugins_menu ) ),  GTK_WIDGET( g_plugins_menu_separator ) );
+               lst = g_list_find( gtk_container_get_children( GTK_CONTAINER( g_plugins_menu ) ),  GTK_WIDGET( g_plugins_menu_separator ) );
        }
 }
 
index 03ef2074b659455dbf2c73683be05d57787b4bf7..4f554744fd6d25a0405a97d348344c9e0da9c7c9 100644 (file)
@@ -25,7 +25,7 @@
 #include "itoolbar.h"
 #include "modulesystem.h"
 
-#include <gtk/gtktoolbar.h>
+#include <gtk/gtk.h>
 
 #include "stream/stringstream.h"
 #include "gtkutil/image.h"
@@ -38,59 +38,58 @@ GtkImage* new_plugin_image( const char* filename ){
        {
                StringOutputStream fullpath( 256 );
                fullpath << GameToolsPath_get() << g_pluginsDir << "bitmaps/" << filename;
-               GtkImage* image = image_new_from_file_with_mask( fullpath.c_str() );
-               if ( image != 0 ) {
-                       return image;
-               }
+               if ( auto image = image_new_from_file_with_mask(fullpath.c_str()) ) return image;
        }
 
        {
                StringOutputStream fullpath( 256 );
                fullpath << AppPath_get() << g_pluginsDir << "bitmaps/" << filename;
-               GtkImage* image = image_new_from_file_with_mask( fullpath.c_str() );
-               if ( image != 0 ) {
-                       return image;
-               }
+               if ( auto image = image_new_from_file_with_mask(fullpath.c_str()) ) return image;
        }
 
        {
                StringOutputStream fullpath( 256 );
                fullpath << AppPath_get() << g_modulesDir << "bitmaps/" << filename;
-               GtkImage* image = image_new_from_file_with_mask( fullpath.c_str() );
-               if ( image != 0 ) {
-                       return image;
-               }
+               if ( auto image = image_new_from_file_with_mask(fullpath.c_str()) ) return image;
        }
 
        return image_new_missing();
 }
 
-inline GtkToolbarChildType gtktoolbarchildtype_for_toolbarbuttontype( IToolbarButton::EType type ){
-       switch ( type )
-       {
-       case IToolbarButton::eSpace:
-               return GTK_TOOLBAR_CHILD_SPACE;
-       case IToolbarButton::eButton:
-               return GTK_TOOLBAR_CHILD_BUTTON;
-       case IToolbarButton::eToggleButton:
-               return GTK_TOOLBAR_CHILD_TOGGLEBUTTON;
-       case IToolbarButton::eRadioButton:
-               return GTK_TOOLBAR_CHILD_RADIOBUTTON;
+void toolbar_insert( GtkToolbar *toolbar, const char* icon, const char* text, const char* tooltip, IToolbarButton::EType type, GCallback handler, gpointer data ){
+       if (type == IToolbarButton::eSpace) {
+               auto it = gtk_separator_tool_item_new();
+               gtk_widget_show(GTK_WIDGET(it));
+               gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(it));
+               return;
+       }
+       if (type == IToolbarButton::eButton) {
+               auto button = gtk_tool_button_new(GTK_WIDGET(new_plugin_image(icon)), text);
+               gtk_widget_set_tooltip_text(GTK_WIDGET(button), tooltip);
+               gtk_widget_show_all(GTK_WIDGET(button));
+               g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(handler), data);
+               gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button));
+               return;
+       }
+       if (type == IToolbarButton::eToggleButton) {
+               auto button = gtk_toggle_tool_button_new();
+               gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(button), GTK_WIDGET(new_plugin_image(icon)));
+               gtk_tool_button_set_label(GTK_TOOL_BUTTON(button), text);
+               gtk_widget_set_tooltip_text(GTK_WIDGET(button), tooltip);
+               gtk_widget_show_all(GTK_WIDGET(button));
+               g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(handler), data);
+               gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button));
+               return;
        }
        ERROR_MESSAGE( "invalid toolbar button type" );
-       return (GtkToolbarChildType)0;
-}
-
-void toolbar_insert( GtkToolbar *toolbar, const char* icon, const char* text, const char* tooltip, IToolbarButton::EType type, GtkSignalFunc handler, gpointer data ){
-       gtk_toolbar_append_element( toolbar, gtktoolbarchildtype_for_toolbarbuttontype( type ), 0, text, tooltip, "", GTK_WIDGET( new_plugin_image( icon ) ), handler, data );
 }
 
-void ActivateToolbarButton( GtkWidget *widget, gpointer data ){
-       const_cast<const IToolbarButton*>( reinterpret_cast<IToolbarButton*>( data ) )->activate();
+void ActivateToolbarButton( GtkToolButton *widget, gpointer data ){
+       (const_cast<const IToolbarButton *>( reinterpret_cast<IToolbarButton *>( data )))->activate();
 }
 
 void PlugInToolbar_AddButton( GtkToolbar* toolbar, const IToolbarButton* button ){
-       toolbar_insert( toolbar, button->getImage(), button->getText(), button->getTooltip(), button->getType(), GTK_SIGNAL_FUNC( ActivateToolbarButton ), reinterpret_cast<gpointer>( const_cast<IToolbarButton*>( button ) ) );
+       toolbar_insert( toolbar, button->getImage(), button->getText(), button->getTooltip(), button->getType(), G_CALLBACK( ActivateToolbarButton ), reinterpret_cast<gpointer>( const_cast<IToolbarButton*>( button ) ) );
 }
 
 GtkToolbar* g_plugin_toolbar = 0;
@@ -124,7 +123,7 @@ GtkToolbar* create_plugin_toolbar(){
        GtkToolbar *toolbar;
 
        toolbar = GTK_TOOLBAR( gtk_toolbar_new() );
-       gtk_toolbar_set_orientation( toolbar, GTK_ORIENTATION_HORIZONTAL );
+       gtk_orientable_set_orientation( GTK_ORIENTABLE(toolbar), GTK_ORIENTATION_HORIZONTAL );
        gtk_toolbar_set_style( toolbar, GTK_TOOLBAR_ICONS );
        gtk_widget_show( GTK_WIDGET( toolbar ) );
 
index 46d15c7a4e38d231cb28c879a5bf3d32b5dce6b4..14b6d75f2c84e634fa5f2c1b32b08e1ad9dcd6ba 100644 (file)
 
 #include "debugging/debugging.h"
 
-#include <gtk/gtkmain.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtkspinbutton.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtktreemodel.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtktreestore.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtknotebook.h>
+#include <gtk/gtk.h>
 
 #include "generic/callback.h"
 #include "math/vector.h"
@@ -74,8 +61,8 @@ void Interface_constructPreferences( PreferencesPage& page ){
        page.appendCheckBox( "", "Default Text Editor", g_TextEditor_useWin32Editor );
 #else
        {
-               GtkWidget* use_custom = page.appendCheckBox( "Text Editor", "Custom", g_TextEditor_useCustomEditor );
-               GtkWidget* custom_editor = page.appendPathEntry( "Text Editor Command", g_TextEditor_editorCommand, true );
+               ui::CheckButton use_custom = page.appendCheckBox( "Text Editor", "Custom", g_TextEditor_useCustomEditor );
+               ui::Widget custom_editor = page.appendPathEntry( "Text Editor Command", g_TextEditor_editorCommand, true );
                Widget_connectToggleDependency( custom_editor, use_custom );
        }
 #endif
@@ -104,6 +91,7 @@ void Mouse_registerPreferencesPage(){
  */
 
 #include <map>
+#include <uilib/uilib.h>
 
 inline const char* xmlAttr_getName( xmlAttrPtr attr ){
        return reinterpret_cast<const char*>( attr->name );
@@ -330,19 +318,19 @@ void CGameDialog::CreateGlobalFrame( PreferencesPage& page ){
        page.appendCheckBox( "Startup", "Show Global Preferences", m_bGamePrompt );
 }
 
-GtkWindow* CGameDialog::BuildDialog(){
+ui::Window CGameDialog::BuildDialog(){
        GtkFrame* frame = create_dialog_frame( "Game settings", GTK_SHADOW_ETCHED_IN );
 
        GtkVBox* vbox2 = create_dialog_vbox( 0, 4 );
        gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox2 ) );
 
        {
-               PreferencesPage preferencesPage( *this, GTK_WIDGET( vbox2 ) );
+               PreferencesPage preferencesPage( *this, ui::Widget(GTK_WIDGET( vbox2 )) );
                Global_constructPreferences( preferencesPage );
                CreateGlobalFrame( preferencesPage );
        }
 
-       return create_simple_modal_dialog_window( "Global Preferences", m_modal, GTK_WIDGET( frame ) );
+       return ui::Window(create_simple_modal_dialog_window( "Global Preferences", m_modal, GTK_WIDGET( frame ) ));
 }
 
 class LoadGameFile
@@ -471,7 +459,7 @@ CGameDialog::~CGameDialog(){
                delete ( *iGame );
                *iGame = 0;
        }
-       if ( GetWidget() != 0 ) {
+       if ( GetWidget() ) {
                Destroy();
        }
 }
@@ -491,11 +479,11 @@ CGameDialog g_GamesDialog;
 // =============================================================================
 // Widget callbacks for PrefsDlg
 
-static void OnButtonClean( GtkWidget *widget, gpointer data ){
+static void OnButtonClean( ui::Widget widget, gpointer data ){
        // make sure this is what the user wants
-       if ( gtk_MessageBox( GTK_WIDGET( g_Preferences.GetWidget() ), "This will close Radiant and clean the corresponding registry entries.\n"
+       if ( ui::Widget(GTK_WIDGET( g_Preferences.GetWidget() )).alert( "This will close Radiant and clean the corresponding registry entries.\n"
                                                                                                                                  "Next time you start Radiant it will be good as new. Do you wish to continue?",
-                                                "Reset Registry", eMB_YESNO, eMB_ICONASTERISK ) == eIDYES ) {
+                                                "Reset Registry", ui::alert_type::YESNO, ui::alert_icon::Asterisk ) == ui::alert_response::YES ) {
                PrefsDlg *dlg = (PrefsDlg*)data;
                dlg->EndModal( eIDCANCEL );
 
@@ -541,14 +529,14 @@ void PrefsDlg::Init(){
        g_string_append( m_inipath, PREFS_LOCAL_FILENAME );
 }
 
-void notebook_set_page( GtkWidget* notebook, GtkWidget* page ){
+void notebook_set_page( ui::Widget notebook, ui::Widget page ){
        int pagenum = gtk_notebook_page_num( GTK_NOTEBOOK( notebook ), page );
        if ( gtk_notebook_get_current_page( GTK_NOTEBOOK( notebook ) ) != pagenum ) {
                gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook ), pagenum );
        }
 }
 
-void PrefsDlg::showPrefPage( GtkWidget* prefpage ){
+void PrefsDlg::showPrefPage( ui::Widget prefpage ){
        notebook_set_page( m_notebook, prefpage );
        return;
 }
@@ -559,7 +547,7 @@ static void treeSelection( GtkTreeSelection* selection, gpointer data ){
        GtkTreeModel* model;
        GtkTreeIter selected;
        if ( gtk_tree_selection_get_selected( selection, &model, &selected ) ) {
-               GtkWidget* prefpage;
+               ui::Widget prefpage;
                gtk_tree_model_get( model, &selected, 1, (gpointer*)&prefpage, -1 );
                dlg->showPrefPage( prefpage );
        }
@@ -619,47 +607,47 @@ void PreferencesDialog_addSettingsPage( const PreferenceGroupCallback& callback
        PreferenceGroupCallbacks_pushBack( g_settingsCallbacks, callback );
 }
 
-void Widget_updateDependency( GtkWidget* self, GtkWidget* toggleButton ){
-       gtk_widget_set_sensitive( self, gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggleButton ) ) && GTK_WIDGET_IS_SENSITIVE( toggleButton ) );
+void Widget_updateDependency( ui::Widget self, ui::Widget toggleButton ){
+       gtk_widget_set_sensitive( self, gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggleButton ) ) && gtk_widget_is_sensitive( toggleButton ) );
 }
 
-void ToggleButton_toggled_Widget_updateDependency( GtkWidget *toggleButton, GtkWidget* self ){
+void ToggleButton_toggled_Widget_updateDependency( ui::Widget toggleButton, ui::Widget self ){
        Widget_updateDependency( self, toggleButton );
 }
 
-void ToggleButton_state_changed_Widget_updateDependency( GtkWidget* toggleButton, GtkStateType state, GtkWidget* self ){
+void ToggleButton_state_changed_Widget_updateDependency( ui::Widget toggleButton, GtkStateType state, ui::Widget self ){
        if ( state == GTK_STATE_INSENSITIVE ) {
                Widget_updateDependency( self, toggleButton );
        }
 }
 
-void Widget_connectToggleDependency( GtkWidget* self, GtkWidget* toggleButton ){
+void Widget_connectToggleDependency( ui::Widget self, ui::Widget toggleButton ){
        g_signal_connect( G_OBJECT( toggleButton ), "state_changed", G_CALLBACK( ToggleButton_state_changed_Widget_updateDependency ), self );
        g_signal_connect( G_OBJECT( toggleButton ), "toggled", G_CALLBACK( ToggleButton_toggled_Widget_updateDependency ), self );
        Widget_updateDependency( self, toggleButton );
 }
 
 
-inline GtkWidget* getVBox( GtkWidget* page ){
-       return gtk_bin_get_child( GTK_BIN( page ) );
+inline ui::Widget getVBox( ui::Widget page ){
+       return ui::Widget(gtk_bin_get_child( GTK_BIN( page ) ));
 }
 
-GtkTreeIter PreferenceTree_appendPage( GtkTreeStore* store, GtkTreeIter* parent, const char* name, GtkWidget* page ){
+GtkTreeIter PreferenceTree_appendPage( GtkTreeStore* store, GtkTreeIter* parent, const char* name, ui::Widget page ){
        GtkTreeIter group;
        gtk_tree_store_append( store, &group, parent );
        gtk_tree_store_set( store, &group, 0, name, 1, page, -1 );
        return group;
 }
 
-GtkWidget* PreferencePages_addPage( GtkWidget* notebook, const char* name ){
-       GtkWidget* preflabel = gtk_label_new( name );
+ui::Widget PreferencePages_addPage( ui::Widget notebook, const char* name ){
+       ui::Widget preflabel = ui::Label( name );
        gtk_widget_show( preflabel );
 
-       GtkWidget* pageframe = gtk_frame_new( name );
+       ui::Widget pageframe = ui::Frame( name );
        gtk_container_set_border_width( GTK_CONTAINER( pageframe ), 4 );
        gtk_widget_show( pageframe );
 
-       GtkWidget* vbox = gtk_vbox_new( FALSE, 4 );
+       ui::Widget vbox = ui::VBox( FALSE, 4 );
        gtk_widget_show( vbox );
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 4 );
        gtk_container_add( GTK_CONTAINER( pageframe ), vbox );
@@ -673,37 +661,37 @@ GtkWidget* PreferencePages_addPage( GtkWidget* notebook, const char* name ){
 class PreferenceTreeGroup : public PreferenceGroup
 {
 Dialog& m_dialog;
-GtkWidget* m_notebook;
+ui::Widget m_notebook;
 GtkTreeStore* m_store;
 GtkTreeIter m_group;
 public:
-PreferenceTreeGroup( Dialog& dialog, GtkWidget* notebook, GtkTreeStore* store, GtkTreeIter group ) :
+PreferenceTreeGroup( Dialog& dialog, ui::Widget notebook, GtkTreeStore* store, GtkTreeIter group ) :
        m_dialog( dialog ),
        m_notebook( notebook ),
        m_store( store ),
        m_group( group ){
 }
 PreferencesPage createPage( const char* treeName, const char* frameName ){
-       GtkWidget* page = PreferencePages_addPage( m_notebook, frameName );
+       ui::Widget page = PreferencePages_addPage( m_notebook, frameName );
        PreferenceTree_appendPage( m_store, &m_group, treeName, page );
        return PreferencesPage( m_dialog, getVBox( page ) );
 }
 };
 
-GtkWindow* PrefsDlg::BuildDialog(){
+ui::Window PrefsDlg::BuildDialog(){
        PreferencesDialog_addInterfacePreferences( FreeCaller1<PreferencesPage&, Interface_constructPreferences>() );
        Mouse_registerPreferencesPage();
 
-       GtkWindow* dialog = create_floating_window( "NetRadiant Preferences", m_parent );
+       ui::Window dialog = ui::Window(create_floating_window( "NetRadiant Preferences", m_parent ));
 
        {
-               GtkWidget* mainvbox = gtk_vbox_new( FALSE, 5 );
+               ui::Widget mainvbox = ui::VBox( FALSE, 5 );
                gtk_container_add( GTK_CONTAINER( dialog ), mainvbox );
                gtk_container_set_border_width( GTK_CONTAINER( mainvbox ), 5 );
                gtk_widget_show( mainvbox );
 
                {
-                       GtkWidget* hbox = gtk_hbox_new( FALSE, 5 );
+                       ui::Widget hbox = ui::HBox( FALSE, 5 );
                        gtk_widget_show( hbox );
                        gtk_box_pack_end( GTK_BOX( mainvbox ), hbox, FALSE, TRUE, 0 );
 
@@ -722,19 +710,19 @@ GtkWindow* PrefsDlg::BuildDialog(){
                }
 
                {
-                       GtkWidget* hbox = gtk_hbox_new( FALSE, 5 );
+                       ui::Widget hbox = ui::HBox( FALSE, 5 );
                        gtk_box_pack_start( GTK_BOX( mainvbox ), hbox, TRUE, TRUE, 0 );
                        gtk_widget_show( hbox );
 
                        {
-                               GtkWidget* sc_win = gtk_scrolled_window_new( 0, 0 );
+                               ui::Widget sc_win = ui::ScrolledWindow();
                                gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( sc_win ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
                                gtk_box_pack_start( GTK_BOX( hbox ), sc_win, FALSE, FALSE, 0 );
                                gtk_widget_show( sc_win );
                                gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( sc_win ), GTK_SHADOW_IN );
 
                                // prefs pages notebook
-                               m_notebook = gtk_notebook_new();
+                               m_notebook = ui::Widget(gtk_notebook_new());
                                // hide the notebook tabs since its not supposed to look like a notebook
                                gtk_notebook_set_show_tabs( GTK_NOTEBOOK( m_notebook ), FALSE );
                                gtk_box_pack_start( GTK_BOX( hbox ), m_notebook, TRUE, TRUE, 0 );
@@ -744,12 +732,12 @@ GtkWindow* PrefsDlg::BuildDialog(){
                                {
                                        GtkTreeStore* store = gtk_tree_store_new( 2, G_TYPE_STRING, G_TYPE_POINTER );
 
-                                       GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+                                       ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
                                        gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
 
                                        {
-                                               GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
-                                               GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Preferences", renderer, "text", 0, NULL );
+                                               auto renderer = ui::CellRendererText();
+                                               GtkTreeViewColumn* column = ui::TreeViewColumn( "Preferences", renderer, {{"text", 0}} );
                                                gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
                                        }
 
@@ -771,14 +759,14 @@ GtkWindow* PrefsDlg::BuildDialog(){
                                                PreferencePages_addPage( m_notebook, "Front Page" );
 
                                                {
-                                                       GtkWidget* global = PreferencePages_addPage( m_notebook, "Global Preferences" );
+                                                       ui::Widget global = PreferencePages_addPage( m_notebook, "Global Preferences" );
                                                        {
                                                                PreferencesPage preferencesPage( *this, getVBox( global ) );
                                                                Global_constructPreferences( preferencesPage );
                                                        }
                                                        GtkTreeIter group = PreferenceTree_appendPage( store, 0, "Global", global );
                                                        {
-                                                               GtkWidget* game = PreferencePages_addPage( m_notebook, "Game" );
+                                                               ui::Widget game = PreferencePages_addPage( m_notebook, "Game" );
                                                                PreferencesPage preferencesPage( *this, getVBox( game ) );
                                                                g_GamesDialog.CreateGlobalFrame( preferencesPage );
 
@@ -787,7 +775,7 @@ GtkWindow* PrefsDlg::BuildDialog(){
                                                }
 
                                                {
-                                                       GtkWidget* interfacePage = PreferencePages_addPage( m_notebook, "Interface Preferences" );
+                                                       ui::Widget interfacePage = PreferencePages_addPage( m_notebook, "Interface Preferences" );
                                                        {
                                                                PreferencesPage preferencesPage( *this, getVBox( interfacePage ) );
                                                                PreferencesPageCallbacks_constructPage( g_interfacePreferences, preferencesPage );
@@ -800,7 +788,7 @@ GtkWindow* PrefsDlg::BuildDialog(){
                                                }
 
                                                {
-                                                       GtkWidget* display = PreferencePages_addPage( m_notebook, "Display Preferences" );
+                                                       ui::Widget display = PreferencePages_addPage( m_notebook, "Display Preferences" );
                                                        {
                                                                PreferencesPage preferencesPage( *this, getVBox( display ) );
                                                                PreferencesPageCallbacks_constructPage( g_displayPreferences, preferencesPage );
@@ -812,7 +800,7 @@ GtkWindow* PrefsDlg::BuildDialog(){
                                                }
 
                                                {
-                                                       GtkWidget* settings = PreferencePages_addPage( m_notebook, "General Settings" );
+                                                       ui::Widget settings = PreferencePages_addPage( m_notebook, "General Settings" );
                                                        {
                                                                PreferencesPage preferencesPage( *this, getVBox( settings ) );
                                                                PreferencesPageCallbacks_constructPage( g_settingsPreferences, preferencesPage );
@@ -833,7 +821,7 @@ GtkWindow* PrefsDlg::BuildDialog(){
                }
        }
 
-       gtk_notebook_set_page( GTK_NOTEBOOK( m_notebook ), 0 );
+       gtk_notebook_set_current_page( GTK_NOTEBOOK( m_notebook ), 0 );
 
        return dialog;
 }
@@ -843,7 +831,7 @@ preferences_globals_t g_preferences_globals;
 PrefsDlg g_Preferences;               // global prefs instance
 
 
-void PreferencesDialog_constructWindow( GtkWindow* main_window ){
+void PreferencesDialog_constructWindow( ui::Window main_window ){
        g_Preferences.m_parent = main_window;
        g_Preferences.Create();
 }
@@ -931,7 +919,7 @@ void PreferencesDialog_showDialog(){
                        {
                                message << ( *i ) << '\n';
                        }
-                       gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), message.c_str() );
+                       MainFrame_getWindow().alert( message.c_str() );
                        g_restart_required.clear();
                }
        }
index 293541a58245b34af1c9a35bc11f66d90f4c9a39..8ece483fa0ca375d45a1dc7726ae7b361dbad2e1 100644 (file)
 #include <list>
 #include <map>
 
-void Widget_connectToggleDependency( GtkWidget* self, GtkWidget* toggleButton );
+void Widget_connectToggleDependency( ui::Widget self, ui::Widget toggleButton );
 
 class PreferencesPage
 {
 Dialog& m_dialog;
-GtkWidget* m_vbox;
+ui::Widget m_vbox;
 public:
-PreferencesPage( Dialog& dialog, GtkWidget* vbox ) : m_dialog( dialog ), m_vbox( vbox ){
+PreferencesPage( Dialog& dialog, ui::Widget vbox ) : m_dialog( dialog ), m_vbox( vbox ){
 }
-GtkWidget* appendCheckBox( const char* name, const char* flag, bool& data ){
+ui::CheckButton appendCheckBox( const char* name, const char* flag, bool& data ){
        return m_dialog.addCheckBox( m_vbox, name, flag, data );
 }
-GtkWidget* appendCheckBox( const char* name, const char* flag, const BoolImportCallback& importCallback, const BoolExportCallback& exportCallback ){
+ui::CheckButton appendCheckBox( const char* name, const char* flag, const BoolImportCallback& importCallback, const BoolExportCallback& exportCallback ){
        return m_dialog.addCheckBox( m_vbox, name, flag, importCallback, exportCallback );
 }
 void appendCombo( const char* name, StringArrayRange values, const IntImportCallback& importCallback, const IntExportCallback& exportCallback ){
@@ -70,37 +70,37 @@ void appendRadioIcons( const char* name, StringArrayRange icons, const IntImport
 void appendRadioIcons( const char* name, int& data, StringArrayRange icons ){
        m_dialog.addRadioIcons( m_vbox, name, data, icons );
 }
-GtkWidget* appendEntry( const char* name, const IntImportCallback& importCallback, const IntExportCallback& exportCallback ){
+ui::Widget appendEntry( const char* name, const IntImportCallback& importCallback, const IntExportCallback& exportCallback ){
        return m_dialog.addIntEntry( m_vbox, name, importCallback, exportCallback );
 }
-GtkWidget* appendEntry( const char* name, int& data ){
+ui::Widget appendEntry( const char* name, int& data ){
        return m_dialog.addEntry( m_vbox, name, data );
 }
-GtkWidget* appendEntry( const char* name, const SizeImportCallback& importCallback, const SizeExportCallback& exportCallback ){
+ui::Widget appendEntry( const char* name, const SizeImportCallback& importCallback, const SizeExportCallback& exportCallback ){
        return m_dialog.addSizeEntry( m_vbox, name, importCallback, exportCallback );
 }
-GtkWidget* appendEntry( const char* name, std::size_t& data ){
+ui::Widget appendEntry( const char* name, std::size_t& data ){
        return m_dialog.addEntry( m_vbox, name, data );
 }
-GtkWidget* appendEntry( const char* name, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback ){
+ui::Widget appendEntry( const char* name, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback ){
        return m_dialog.addFloatEntry( m_vbox, name, importCallback, exportCallback );
 }
-GtkWidget* appendEntry( const char* name, float& data ){
+ui::Widget appendEntry( const char* name, float& data ){
        return m_dialog.addEntry( m_vbox, name, data );
 }
-GtkWidget* appendPathEntry( const char* name, bool browse_directory, const StringImportCallback& importCallback, const StringExportCallback& exportCallback ){
+ui::Widget appendPathEntry( const char* name, bool browse_directory, const StringImportCallback& importCallback, const StringExportCallback& exportCallback ){
        return m_dialog.addPathEntry( m_vbox, name, browse_directory, importCallback, exportCallback );
 }
-GtkWidget* appendPathEntry( const char* name, CopiedString& data, bool directory ){
+ui::Widget appendPathEntry( const char* name, CopiedString& data, bool directory ){
        return m_dialog.addPathEntry( m_vbox, name, data, directory );
 }
-GtkWidget* appendSpinner( const char* name, int& data, double value, double lower, double upper ){
+ui::SpinButton appendSpinner( const char* name, int& data, double value, double lower, double upper ){
        return m_dialog.addSpinner( m_vbox, name, data, value, lower, upper );
 }
-GtkWidget* appendSpinner( const char* name, double value, double lower, double upper, const IntImportCallback& importCallback, const IntExportCallback& exportCallback ){
+ui::SpinButton appendSpinner( const char* name, double value, double lower, double upper, const IntImportCallback& importCallback, const IntExportCallback& exportCallback ){
        return m_dialog.addSpinner( m_vbox, name, value, lower, upper, importCallback, exportCallback );
 }
-GtkWidget* appendSpinner( const char* name, double value, double lower, double upper, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback ){
+ui::SpinButton appendSpinner( const char* name, double value, double lower, double upper, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback ){
        return m_dialog.addSpinner( m_vbox, name, value, lower, upper, importCallback, exportCallback );
 }
 };
@@ -197,7 +197,6 @@ void Dump();
 
 extern CGameDescription *g_pGameDescription;
 
-typedef struct _GtkWidget GtkWidget;
 class PrefsDlg;
 
 class PreferencesPage;
@@ -270,7 +269,7 @@ void DoGameDialog();
    Dialog API
    this is only called when the dialog is built at startup for main engine select
  */
-GtkWindow* BuildDialog();
+ui::Window BuildDialog();
 
 void GameFileImport( int value );
 void GameFileExport( const IntImportCallback& importCallback ) const;
@@ -329,7 +328,7 @@ std::list<CGameDescription *> mGames;
 
 public:
 
-GtkWidget *m_notebook;
+ui::Widget m_notebook;
 
 virtual ~PrefsDlg(){
        g_string_free( m_rc_path, true );
@@ -362,12 +361,12 @@ GString *m_inipath;
 void Init();
 
 /*! Utility function for swapping notebook pages for tree list selections */
-void showPrefPage( GtkWidget* prefpage );
+void showPrefPage( ui::Widget prefpage );
 
 protected:
 
 /*! Dialog API */
-GtkWindow* BuildDialog();
+ui::Window BuildDialog();
 void PostModal( EMessageBoxReturn code );
 };
 
@@ -382,8 +381,7 @@ struct preferences_globals_t
 };
 extern preferences_globals_t g_preferences_globals;
 
-typedef struct _GtkWindow GtkWindow;
-void PreferencesDialog_constructWindow( GtkWindow* main_window );
+void PreferencesDialog_constructWindow( ui::Window main_window );
 void PreferencesDialog_destroyWindow();
 
 void PreferencesDialog_showDialog();
index 1bce60b9a38acb676709ad12a4edcefa765c3a2d..4de16016b47204021291864ee93e9d083ab50032 100644 (file)
@@ -41,7 +41,8 @@
 
 #include <map>
 
-#include <gtk/gtktearoffmenuitem.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
 
 #include "stream/textfilestream.h"
 #include "cmdlib.h"
@@ -140,11 +141,11 @@ bool ConfirmModified( const char* title ){
                return true;
        }
 
-       EMessageBoxReturn result = gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), "The current map has changed since it was last saved.\nDo you want to save the current map before continuing?", title, eMB_YESNOCANCEL, eMB_ICONQUESTION );
-       if ( result == eIDCANCEL ) {
+       auto result = MainFrame_getWindow().alert( "The current map has changed since it was last saved.\nDo you want to save the current map before continuing?", title, ui::alert_type::YESNOCANCEL, ui::alert_icon::Question );
+       if ( result == ui::alert_response::CANCEL ) {
                return false;
        }
-       if ( result == eIDYES ) {
+       if ( result == ui::alert_response::YES ) {
                if ( Map_Unnamed( g_map ) ) {
                        return Map_SaveAs();
                }
@@ -324,7 +325,7 @@ void Sys_SetTitle( const char *text, bool modified ){
                title << " *";
        }
 
-       gtk_window_set_title( MainFrame_getWindow(), title.c_str() );
+       gtk_window_set_title(MainFrame_getWindow(), title.c_str() );
 }
 
 bool g_bWaitCursor = false;
@@ -332,14 +333,14 @@ bool g_bWaitCursor = false;
 void Sys_BeginWait( void ){
        ScreenUpdates_Disable( "Processing...", "Please Wait" );
        GdkCursor *cursor = gdk_cursor_new( GDK_WATCH );
-       gdk_window_set_cursor( GTK_WIDGET( MainFrame_getWindow() )->window, cursor );
+       gdk_window_set_cursor( gtk_widget_get_window(MainFrame_getWindow()), cursor );
        gdk_cursor_unref( cursor );
        g_bWaitCursor = true;
 }
 
 void Sys_EndWait( void ){
        ScreenUpdates_Enable();
-       gdk_window_set_cursor( GTK_WIDGET( MainFrame_getWindow() )->window, 0 );
+       gdk_window_set_cursor(gtk_widget_get_window(MainFrame_getWindow()), 0 );
        g_bWaitCursor = false;
 }
 
index 6cc9d7ca61b7be01e0fcfb20f2c849a04c3b808a..a352b8d0723cde907f5a69bf0914deb25e31fcc3 100644 (file)
@@ -59,7 +59,6 @@ PROC ( WINAPI * qwglGetProcAddress )( LPCSTR );
 
 #include <GL/glx.h>
 #include <dlfcn.h>
-#include <gdk/gdkx.h>
 
 Bool ( *qglXQueryExtension )( Display *dpy, int *errorb, int *event );
 void*        ( *qglXGetProcAddressARB )( const GLubyte * procName );
@@ -555,7 +554,7 @@ int QGL_Init( OpenGLBinding& table ){
        qwglGetProcAddress           = wglGetProcAddress;
 #elif defined( XWINDOWS )
        qglXGetProcAddressARB = (glXGetProcAddressARBProc)dlsym( RTLD_DEFAULT, "glXGetProcAddressARB" );
-       if ( ( qglXQueryExtension == 0 ) || ( qglXQueryExtension( GDK_DISPLAY(),0,0 ) != True ) ) {
+       if ( ( qglXQueryExtension == 0 ) || ( qglXQueryExtension(XOpenDisplay(nullptr), 0, 0) != True ) ) {
                return 0;
        }
 #elif defined (__APPLE__)
index 5d34645a8e4dccf267213cdaffe6b6687d386b8b..0586d417029bd62e6d149cee7b4afd0639a3736f 100644 (file)
@@ -830,10 +830,7 @@ void Selection_destroy(){
 
 
 #include "gtkdlgs.h"
-#include <gtk/gtkbox.h>
-#include <gtk/gtkspinbutton.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtklabel.h>
+#include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 
 
@@ -870,10 +867,10 @@ struct RotateDialog
        GtkSpinButton* x;
        GtkSpinButton* y;
        GtkSpinButton* z;
-       GtkWindow *window;
+       ui::Window window;
 };
 
-static gboolean rotatedlg_apply( GtkWidget *widget, RotateDialog* rotateDialog ){
+static gboolean rotatedlg_apply( ui::Widget widget, RotateDialog* rotateDialog ){
        Vector3 eulerXYZ;
 
        eulerXYZ[0] = static_cast<float>( gtk_spin_button_get_value( rotateDialog->x ) );
@@ -888,7 +885,7 @@ static gboolean rotatedlg_apply( GtkWidget *widget, RotateDialog* rotateDialog )
        return TRUE;
 }
 
-static gboolean rotatedlg_cancel( GtkWidget *widget, RotateDialog* rotateDialog ){
+static gboolean rotatedlg_cancel( ui::Widget widget, RotateDialog* rotateDialog ){
        gtk_widget_hide( GTK_WIDGET( rotateDialog->window ) );
 
        gtk_spin_button_set_value( rotateDialog->x, 0.0f ); // reset to 0 on close
@@ -898,23 +895,23 @@ static gboolean rotatedlg_cancel( GtkWidget *widget, RotateDialog* rotateDialog
        return TRUE;
 }
 
-static gboolean rotatedlg_ok( GtkWidget *widget, RotateDialog* rotateDialog ){
+static gboolean rotatedlg_ok( ui::Widget widget, RotateDialog* rotateDialog ){
        rotatedlg_apply( widget, rotateDialog );
        gtk_widget_hide( GTK_WIDGET( rotateDialog->window ) );
        return TRUE;
 }
 
-static gboolean rotatedlg_delete( GtkWidget *widget, GdkEventAny *event, RotateDialog* rotateDialog ){
+static gboolean rotatedlg_delete( ui::Widget widget, GdkEventAny *event, RotateDialog* rotateDialog ){
        rotatedlg_cancel( widget, rotateDialog );
        return TRUE;
 }
 
 RotateDialog g_rotate_dialog;
 void DoRotateDlg(){
-       if ( g_rotate_dialog.window == NULL ) {
-               g_rotate_dialog.window = create_dialog_window( MainFrame_getWindow(), "Arbitrary rotation", G_CALLBACK( rotatedlg_delete ), &g_rotate_dialog );
+       if ( !g_rotate_dialog.window ) {
+               g_rotate_dialog.window = MainFrame_getWindow().create_dialog_window("Arbitrary rotation", G_CALLBACK(rotatedlg_delete ), &g_rotate_dialog );
 
-               GtkAccelGroup* accel = gtk_accel_group_new();
+               GtkAccelGroup* accel = ui::AccelGroup();
                gtk_window_add_accel_group( g_rotate_dialog.window, accel );
 
                {
@@ -924,29 +921,29 @@ void DoRotateDlg(){
                                GtkTable* table = create_dialog_table( 3, 2, 4, 4 );
                                gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
                                {
-                                       GtkWidget* label = gtk_label_new( "  X  " );
+                                       ui::Widget label = ui::Label( "  X  " );
                                        gtk_widget_show( label );
                                        gtk_table_attach( table, label, 0, 1, 0, 1,
                                                                          (GtkAttachOptions) ( 0 ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
-                                       GtkWidget* label = gtk_label_new( "  Y  " );
+                                       ui::Widget label = ui::Label( "  Y  " );
                                        gtk_widget_show( label );
                                        gtk_table_attach( table, label, 0, 1, 1, 2,
                                                                          (GtkAttachOptions) ( 0 ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
-                                       GtkWidget* label = gtk_label_new( "  Z  " );
+                                       ui::Widget label = ui::Label( "  Z  " );
                                        gtk_widget_show( label );
                                        gtk_table_attach( table, label, 0, 1, 2, 3,
                                                                          (GtkAttachOptions) ( 0 ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
-                                       GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -359, 359, 1, 10, 0 ) );
-                                       GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+                                       auto adj = ui::Adjustment( 0, -359, 359, 1, 10, 0 );
+                                       GtkSpinButton* spin = ui::SpinButton( adj, 1, 0 );
                                        gtk_widget_show( GTK_WIDGET( spin ) );
                                        gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -959,8 +956,8 @@ void DoRotateDlg(){
                                        g_rotate_dialog.x = spin;
                                }
                                {
-                                       GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -359, 359, 1, 10, 0 ) );
-                                       GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+                                       auto adj = ui::Adjustment( 0, -359, 359, 1, 10, 0 );
+                                       GtkSpinButton* spin = ui::SpinButton( adj, 1, 0 );
                                        gtk_widget_show( GTK_WIDGET( spin ) );
                                        gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -971,8 +968,8 @@ void DoRotateDlg(){
                                        g_rotate_dialog.y = spin;
                                }
                                {
-                                       GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -359, 359, 1, 10, 0 ) );
-                                       GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+                                       auto adj = ui::Adjustment( 0, -359, 359, 1, 10, 0 );
+                                       GtkSpinButton* spin = ui::SpinButton( adj, 1, 0 );
                                        gtk_widget_show( GTK_WIDGET( spin ) );
                                        gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 2, 3,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -1018,13 +1015,13 @@ void DoRotateDlg(){
 
 struct ScaleDialog
 {
-       GtkWidget* x;
-       GtkWidget* y;
-       GtkWidget* z;
-       GtkWindow *window;
+       ui::Widget x;
+       ui::Widget y;
+       ui::Widget z;
+       ui::Window window;
 };
 
-static gboolean scaledlg_apply( GtkWidget *widget, ScaleDialog* scaleDialog ){
+static gboolean scaledlg_apply( ui::Widget widget, ScaleDialog* scaleDialog ){
        float sx, sy, sz;
 
        sx = static_cast<float>( atof( gtk_entry_get_text( GTK_ENTRY( scaleDialog->x ) ) ) );
@@ -1040,7 +1037,7 @@ static gboolean scaledlg_apply( GtkWidget *widget, ScaleDialog* scaleDialog ){
        return TRUE;
 }
 
-static gboolean scaledlg_cancel( GtkWidget *widget, ScaleDialog* scaleDialog ){
+static gboolean scaledlg_cancel( ui::Widget widget, ScaleDialog* scaleDialog ){
        gtk_widget_hide( GTK_WIDGET( scaleDialog->window ) );
 
        gtk_entry_set_text( GTK_ENTRY( scaleDialog->x ), "1.0" );
@@ -1050,13 +1047,13 @@ static gboolean scaledlg_cancel( GtkWidget *widget, ScaleDialog* scaleDialog ){
        return TRUE;
 }
 
-static gboolean scaledlg_ok( GtkWidget *widget, ScaleDialog* scaleDialog ){
+static gboolean scaledlg_ok( ui::Widget widget, ScaleDialog* scaleDialog ){
        scaledlg_apply( widget, scaleDialog );
        gtk_widget_hide( GTK_WIDGET( scaleDialog->window ) );
        return TRUE;
 }
 
-static gboolean scaledlg_delete( GtkWidget *widget, GdkEventAny *event, ScaleDialog* scaleDialog ){
+static gboolean scaledlg_delete( ui::Widget widget, GdkEventAny *event, ScaleDialog* scaleDialog ){
        scaledlg_cancel( widget, scaleDialog );
        return TRUE;
 }
@@ -1064,10 +1061,10 @@ static gboolean scaledlg_delete( GtkWidget *widget, GdkEventAny *event, ScaleDia
 ScaleDialog g_scale_dialog;
 
 void DoScaleDlg(){
-       if ( g_scale_dialog.window == NULL ) {
-               g_scale_dialog.window = create_dialog_window( MainFrame_getWindow(), "Arbitrary scale", G_CALLBACK( scaledlg_delete ), &g_scale_dialog );
+       if ( !g_scale_dialog.window ) {
+               g_scale_dialog.window = MainFrame_getWindow().create_dialog_window("Arbitrary scale", G_CALLBACK(scaledlg_delete ), &g_scale_dialog );
 
-               GtkAccelGroup* accel = gtk_accel_group_new();
+               GtkAccelGroup* accel = ui::AccelGroup();
                gtk_window_add_accel_group( g_scale_dialog.window, accel );
 
                {
@@ -1077,28 +1074,28 @@ void DoScaleDlg(){
                                GtkTable* table = create_dialog_table( 3, 2, 4, 4 );
                                gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
                                {
-                                       GtkWidget* label = gtk_label_new( "  X  " );
+                                       ui::Widget label = ui::Label( "  X  " );
                                        gtk_widget_show( label );
                                        gtk_table_attach( table, label, 0, 1, 0, 1,
                                                                          (GtkAttachOptions) ( 0 ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
-                                       GtkWidget* label = gtk_label_new( "  Y  " );
+                                       ui::Widget label = ui::Label( "  Y  " );
                                        gtk_widget_show( label );
                                        gtk_table_attach( table, label, 0, 1, 1, 2,
                                                                          (GtkAttachOptions) ( 0 ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
-                                       GtkWidget* label = gtk_label_new( "  Z  " );
+                                       ui::Widget label = ui::Label( "  Z  " );
                                        gtk_widget_show( label );
                                        gtk_table_attach( table, label, 0, 1, 2, 3,
                                                                          (GtkAttachOptions) ( 0 ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
-                                       GtkWidget* entry = gtk_entry_new();
+                                       ui::Widget entry = ui::Entry();
                                        gtk_entry_set_text( GTK_ENTRY( entry ), "1.0" );
                                        gtk_widget_show( entry );
                                        gtk_table_attach( table, entry, 1, 2, 0, 1,
@@ -1108,7 +1105,7 @@ void DoScaleDlg(){
                                        g_scale_dialog.x = entry;
                                }
                                {
-                                       GtkWidget* entry = gtk_entry_new();
+                                       ui::Widget entry = ui::Entry();
                                        gtk_entry_set_text( GTK_ENTRY( entry ), "1.0" );
                                        gtk_widget_show( entry );
                                        gtk_table_attach( table, entry, 1, 2, 1, 2,
@@ -1118,7 +1115,7 @@ void DoScaleDlg(){
                                        g_scale_dialog.y = entry;
                                }
                                {
-                                       GtkWidget* entry = gtk_entry_new();
+                                       ui::Widget entry = ui::Entry();
                                        gtk_entry_set_text( GTK_ENTRY( entry ), "1.0" );
                                        gtk_widget_show( entry );
                                        gtk_table_attach( table, entry, 1, 2, 2, 3,
index c58ad8799d497a40c382af2664358e03ecd4b7a4..12997d4d0801c2ede679dfb1e74556c12c443389 100644 (file)
@@ -144,9 +144,8 @@ FunctionPointer findSymbol( const char* symbol ){
 
 #include <dlfcn.h>
 
-class DynamicLibrary
-{
-void* m_library;
+class DynamicLibrary {
+       void *m_library;
 public:
 typedef int ( *FunctionPointer )();
 
index 73312a078fba5435b28649a9680e03ea31efe045..438498e0ead93fd998d609bd0041128e70d31494 100644 (file)
 #include "iundo.h"
 #include "iselection.h"
 
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkspinbutton.h>
+#include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
-#include <gtk/gtkcheckbutton.h> //Shamus: For Textool
 
 #include "signal/isignal.h"
 #include "generic/object.h"
@@ -89,18 +82,18 @@ namespace TexTool
 {
 
 //Shamus: Textool function prototypes
-gboolean size_allocate( GtkWidget *, GtkAllocation *, gpointer );
-gboolean expose( GtkWidget *, GdkEventExpose *, gpointer );
-gboolean button_press( GtkWidget *, GdkEventButton *, gpointer );
-gboolean button_release( GtkWidget *, GdkEventButton *, gpointer );
-gboolean motion( GtkWidget *, GdkEventMotion *, gpointer );
+gboolean size_allocate( ui::Widget, GtkAllocation *, gpointer );
+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 );
 
 //End Textool function prototypes
 
 //Shamus: Textool globals
-GtkWidget * g_textoolWin;
+ui::Widget g_textoolWin;
 //End Textool globals
 
 void queueDraw(){
@@ -113,7 +106,7 @@ void queueDraw(){
 
 inline void spin_button_set_step( GtkSpinButton* spin, gfloat step ){
 #if 1
-       gtk_spin_button_get_adjustment( spin )->step_increment = step;
+    gtk_adjustment_set_step_increment(gtk_spin_button_get_adjustment( spin ), step);
 #else
        GValue gvalue = GValue_default();
        g_value_init( &gvalue, G_TYPE_DOUBLE );
@@ -145,7 +138,7 @@ void SurfaceInspector_GridChange();
 
 class SurfaceInspector : public Dialog
 {
-GtkWindow* BuildDialog();
+ui::Window BuildDialog();
 
 NonModalEntry m_textureEntry;
 NonModalSpinner m_hshiftSpinner;
@@ -208,7 +201,7 @@ SurfaceInspector() :
        m_positionTracker.setPosition( c_default_window_pos );
 }
 
-void constructWindow( GtkWindow* main_window ){
+void constructWindow( ui::Window main_window ){
        m_parent = main_window;
        Create();
        AddGridChangeCallback( FreeCaller<SurfaceInspector_GridChange>() );
@@ -217,7 +210,7 @@ void destroyWindow(){
        Destroy();
 }
 bool visible() const {
-       return GTK_WIDGET_VISIBLE( const_cast<GtkWindow*>( GetWidget() ) );
+       return gtk_widget_get_visible( GetWidget() );
 }
 void queueDraw(){
        if ( visible() ) {
@@ -245,7 +238,7 @@ inline SurfaceInspector& getSurfaceInspector(){
 }
 }
 
-void SurfaceInspector_constructWindow( GtkWindow* main_window ){
+void SurfaceInspector_constructWindow( ui::Window main_window ){
        getSurfaceInspector().constructWindow( main_window );
 }
 void SurfaceInspector_destroyWindow(){
@@ -400,10 +393,10 @@ void SurfaceInspector_GridChange(){
 // we move the textures in pixels, not world units. (i.e. increment values are in pixel)
 // depending on the texture scale it doesn't take the same amount of pixels to move of GetGridSize()
 // increment * scale = gridsize
-static void OnBtnMatchGrid( GtkWidget *widget, gpointer data ){
+static void OnBtnMatchGrid( ui::Widget widget, gpointer data ){
        float hscale, vscale;
-       hscale = static_cast<float>( gtk_spin_button_get_value_as_float( getSurfaceInspector().m_hscaleIncrement.m_spin ) );
-       vscale = static_cast<float>( gtk_spin_button_get_value_as_float( getSurfaceInspector().m_vscaleIncrement.m_spin ) );
+       hscale = static_cast<float>( gtk_spin_button_get_value( getSurfaceInspector().m_hscaleIncrement.m_spin ) );
+       vscale = static_cast<float>( gtk_spin_button_get_value( getSurfaceInspector().m_vscaleIncrement.m_spin ) );
 
        if ( hscale == 0.0f || vscale == 0.0f ) {
                globalOutputStream() << "ERROR: unexpected scale == 0.0f\n";
@@ -417,7 +410,7 @@ static void OnBtnMatchGrid( GtkWidget *widget, gpointer data ){
 // or update it because something new has been selected
 // Shamus: It does get called when the SI is hidden, but not when you select something new. ;-)
 void DoSurface( void ){
-       if ( getSurfaceInspector().GetWidget() == 0 ) {
+       if ( !getSurfaceInspector().GetWidget() ) {
                getSurfaceInspector().Create();
 
        }
@@ -441,23 +434,23 @@ void SurfaceInspector_FitTexture(){
        Select_FitTexture( getSurfaceInspector().m_fitHorizontal, getSurfaceInspector().m_fitVertical );
 }
 
-static void OnBtnPatchdetails( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchdetails( ui::Widget widget, gpointer data ){
        Patch_CapTexture();
 }
 
-static void OnBtnPatchnatural( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchnatural( ui::Widget widget, gpointer data ){
        Patch_NaturalTexture();
 }
 
-static void OnBtnPatchreset( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchreset( ui::Widget widget, gpointer data ){
        Patch_ResetTexture();
 }
 
-static void OnBtnPatchFit( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchFit( ui::Widget widget, gpointer data ){
        Patch_FitTexture();
 }
 
-static void OnBtnAxial( GtkWidget *widget, gpointer data ){
+static void OnBtnAxial( ui::Widget widget, gpointer data ){
 //globalOutputStream() << "--> [OnBtnAxial]...\n";
        UndoableCommand undo( "textureDefault" );
        TextureProjection projection;
@@ -486,7 +479,7 @@ static void OnBtnAxial( GtkWidget *widget, gpointer data ){
        Select_SetTexdef( projection );
 }
 
-static void OnBtnFaceFit( GtkWidget *widget, gpointer data ){
+static void OnBtnFaceFit( ui::Widget widget, gpointer data ){
        getSurfaceInspector().exportData();
        SurfaceInspector_FitTexture();
 }
@@ -587,8 +580,8 @@ guint togglebutton_connect_toggled( GtkToggleButton* button, const Callback& cal
        return g_signal_connect_swapped( G_OBJECT( button ), "toggled", G_CALLBACK( callback.getThunk() ), callback.getEnvironment() );
 }
 
-GtkWindow* SurfaceInspector::BuildDialog(){
-       GtkWindow* window = create_floating_window( "Surface Inspector", m_parent );
+ui::Window SurfaceInspector::BuildDialog(){
+       ui::Window window = ui::Window(create_floating_window( "Surface Inspector", m_parent ));
 
        m_positionTracker.connect( window );
 
@@ -599,23 +592,23 @@ GtkWindow* SurfaceInspector::BuildDialog(){
 
        {
                // replaced by only the vbox:
-               GtkWidget* vbox = gtk_vbox_new( FALSE, 5 );
+               ui::Widget vbox = ui::VBox( FALSE, 5 );
                gtk_widget_show( vbox );
                gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) );
                gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
 
                {
-                       GtkWidget* hbox2 = gtk_hbox_new( FALSE, 5 );
+                       ui::Widget hbox2 = ui::HBox( FALSE, 5 );
                        gtk_widget_show( hbox2 );
                        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox2 ), FALSE, FALSE, 0 );
 
                        {
-                               GtkWidget* label = gtk_label_new( "Texture" );
+                               ui::Widget label = ui::Label( "Texture" );
                                gtk_widget_show( label );
                                gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 );
                        }
                        {
-                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                               GtkEntry* entry = ui::Entry();
                                gtk_widget_show( GTK_WIDGET( entry ) );
                                gtk_box_pack_start( GTK_BOX( hbox2 ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
                                m_texture = entry;
@@ -626,13 +619,13 @@ GtkWindow* SurfaceInspector::BuildDialog(){
 
 
                {
-                       GtkWidget* table = gtk_table_new( 6, 4, FALSE );
+                       ui::Widget table = ui::Table( 6, 4, FALSE );
                        gtk_widget_show( table );
                        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 );
                        {
-                               GtkWidget* label = gtk_label_new( "Horizontal shift" );
+                               ui::Widget label = ui::Label( "Horizontal shift" );
                                gtk_widget_show( label );
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
@@ -640,17 +633,17 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 2 ) );
+                               GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 );
                                m_hshiftIncrement.m_spin = spin;
                                m_hshiftSpinner.connect( spin );
                                gtk_widget_show( GTK_WIDGET( spin ) );
                                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_usize( GTK_WIDGET( spin ), 60, -2 );
+                               gtk_widget_set_size_request( GTK_WIDGET( spin ), 60, -1 );
                        }
                        {
-                               GtkWidget* label = gtk_label_new( "Step" );
+                               ui::Widget label = ui::Label( "Step" );
                                gtk_widget_show( label );
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1,
@@ -658,17 +651,17 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                               GtkEntry* entry = ui::Entry();
                                gtk_widget_show( GTK_WIDGET( entry ) );
                                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_usize( GTK_WIDGET( entry ), 50, -2 );
+                               gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
                                m_hshiftIncrement.m_entry = entry;
                                m_hshiftEntry.connect( entry );
                        }
                        {
-                               GtkWidget* label = gtk_label_new( "Vertical shift" );
+                               ui::Widget label = ui::Label( "Vertical shift" );
                                gtk_widget_show( label );
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
@@ -676,17 +669,17 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 2 ) );
+                               GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 );
                                m_vshiftIncrement.m_spin = spin;
                                m_vshiftSpinner.connect( spin );
                                gtk_widget_show( GTK_WIDGET( spin ) );
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 1, 2,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
-                               gtk_widget_set_usize( GTK_WIDGET( spin ), 60, -2 );
+                               gtk_widget_set_size_request( GTK_WIDGET( spin ), 60, -1 );
                        }
                        {
-                               GtkWidget* label = gtk_label_new( "Step" );
+                               ui::Widget label = ui::Label( "Step" );
                                gtk_widget_show( label );
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2,
@@ -694,17 +687,17 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                               GtkEntry* entry = ui::Entry();
                                gtk_widget_show( GTK_WIDGET( entry ) );
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 1, 2,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
-                               gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+                               gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
                                m_vshiftIncrement.m_entry = entry;
                                m_vshiftEntry.connect( entry );
                        }
                        {
-                               GtkWidget* label = gtk_label_new( "Horizontal stretch" );
+                               ui::Widget label = ui::Label( "Horizontal stretch" );
                                gtk_widget_show( label );
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
@@ -712,17 +705,17 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 5 ) );
+                               GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 5 );
                                m_hscaleIncrement.m_spin = spin;
                                m_hscaleSpinner.connect( spin );
                                gtk_widget_show( GTK_WIDGET( spin ) );
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 2, 3,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
-                               gtk_widget_set_usize( GTK_WIDGET( spin ), 60, -2 );
+                               gtk_widget_set_size_request( GTK_WIDGET( spin ), 60, -1 );
                        }
                        {
-                               GtkWidget* label = gtk_label_new( "Step" );
+                               ui::Widget label = ui::Label( "Step" );
                                gtk_widget_show( label );
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3,
@@ -730,17 +723,17 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                                  (GtkAttachOptions) ( 0 ), 2, 3 );
                        }
                        {
-                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                               GtkEntry* entry = ui::Entry();
                                gtk_widget_show( GTK_WIDGET( entry ) );
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 2, 3,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 2, 3 );
-                               gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+                               gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
                                m_hscaleIncrement.m_entry = entry;
                                m_hscaleEntry.connect( entry );
                        }
                        {
-                               GtkWidget* label = gtk_label_new( "Vertical stretch" );
+                               ui::Widget label = ui::Label( "Vertical stretch" );
                                gtk_widget_show( label );
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 3, 4,
@@ -748,17 +741,17 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 5 ) );
+                               GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 5 );
                                m_vscaleIncrement.m_spin = spin;
                                m_vscaleSpinner.connect( spin );
                                gtk_widget_show( GTK_WIDGET( spin ) );
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 3, 4,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
-                               gtk_widget_set_usize( GTK_WIDGET( spin ), 60, -2 );
+                               gtk_widget_set_size_request( GTK_WIDGET( spin ), 60, -1 );
                        }
                        {
-                               GtkWidget* label = gtk_label_new( "Step" );
+                               ui::Widget label = ui::Label( "Step" );
                                gtk_widget_show( label );
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 3, 4,
@@ -766,17 +759,17 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                               GtkEntry* entry = ui::Entry();
                                gtk_widget_show( GTK_WIDGET( entry ) );
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 3, 4,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
-                               gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+                               gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
                                m_vscaleIncrement.m_entry = entry;
                                m_vscaleEntry.connect( entry );
                        }
                        {
-                               GtkWidget* label = gtk_label_new( "Rotate" );
+                               ui::Widget label = ui::Label( "Rotate" );
                                gtk_widget_show( label );
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 4, 5,
@@ -784,18 +777,18 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 2 ) );
+                               GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 );
                                m_rotateIncrement.m_spin = spin;
                                m_rotateSpinner.connect( spin );
                                gtk_widget_show( GTK_WIDGET( spin ) );
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 4, 5,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
-                               gtk_widget_set_usize( GTK_WIDGET( spin ), 60, -2 );
+                               gtk_widget_set_size_request( GTK_WIDGET( spin ), 60, -1 );
                                gtk_spin_button_set_wrap( spin, TRUE );
                        }
                        {
-                               GtkWidget* label = gtk_label_new( "Step" );
+                               ui::Widget label = ui::Label( "Step" );
                                gtk_widget_show( label );
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 4, 5,
@@ -803,18 +796,18 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                               GtkEntry* entry = ui::Entry();
                                gtk_widget_show( GTK_WIDGET( entry ) );
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 4, 5,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
-                               gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+                               gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
                                m_rotateIncrement.m_entry = entry;
                                m_rotateEntry.connect( entry );
                        }
                        {
                                // match grid button
-                               GtkWidget* button = gtk_button_new_with_label( "Match Grid" );
+                               ui::Widget button = ui::Button( "Match Grid" );
                                gtk_widget_show( button );
                                gtk_table_attach( GTK_TABLE( table ), button, 2, 4, 5, 6,
                                                                  (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -824,136 +817,136 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                }
 
                {
-                       GtkWidget* frame = gtk_frame_new( "Texturing" );
+                       ui::Widget frame = ui::Frame( "Texturing" );
                        gtk_widget_show( frame );
                        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), FALSE, FALSE, 0 );
                        {
-                               GtkWidget* table = gtk_table_new( 4, 4, FALSE );
+                               ui::Widget table = ui::Table( 4, 4, FALSE );
                                gtk_widget_show( table );
                                gtk_container_add( GTK_CONTAINER( frame ), table );
                                gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
                                gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
                                gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
                                {
-                                       GtkWidget* label = gtk_label_new( "Brush" );
+                                       ui::Widget label = ui::Label( "Brush" );
                                        gtk_widget_show( label );
                                        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
-                                       GtkWidget* label = gtk_label_new( "Patch" );
+                                       ui::Widget label = ui::Label( "Patch" );
                                        gtk_widget_show( label );
                                        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
-                                       GtkWidget* label = gtk_label_new( "Width" );
+                                       ui::Widget label = ui::Label( "Width" );
                                        gtk_widget_show( label );
                                        gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
-                                       GtkWidget* label = gtk_label_new( "Height" );
+                                       ui::Widget label = ui::Label( "Height" );
                                        gtk_widget_show( label );
                                        gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
-                                       GtkWidget* button = gtk_button_new_with_label( "Axial" );
+                                       ui::Widget button = ui::Button( "Axial" );
                                        gtk_widget_show( button );
                                        gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                        g_signal_connect( G_OBJECT( button ), "clicked",
                                                                          G_CALLBACK( OnBtnAxial ), 0 );
-                                       gtk_widget_set_usize( button, 60, -2 );
+                                       gtk_widget_set_size_request( button, 60, -1 );
                                }
                                {
-                                       GtkWidget* button = gtk_button_new_with_label( "Fit" );
+                                       ui::Widget button = ui::Button( "Fit" );
                                        gtk_widget_show( button );
                                        gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                        g_signal_connect( G_OBJECT( button ), "clicked",
                                                                          G_CALLBACK( OnBtnFaceFit ), 0 );
-                                       gtk_widget_set_usize( button, 60, -2 );
+                                       gtk_widget_set_size_request( button, 60, -1 );
                                }
                                {
-                                       GtkWidget* button = gtk_button_new_with_label( "CAP" );
+                                       ui::Widget button = ui::Button( "CAP" );
                                        gtk_widget_show( button );
                                        gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 3, 4,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                        g_signal_connect( G_OBJECT( button ), "clicked",
                                                                          G_CALLBACK( OnBtnPatchdetails ), 0 );
-                                       gtk_widget_set_usize( button, 60, -2 );
+                                       gtk_widget_set_size_request( button, 60, -1 );
                                }
                                {
-                                       GtkWidget* button = gtk_button_new_with_label( "Set..." );
+                                       ui::Widget button = ui::Button( "Set..." );
                                        gtk_widget_show( button );
                                        gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 3, 4,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                        g_signal_connect( G_OBJECT( button ), "clicked",
                                                                          G_CALLBACK( OnBtnPatchreset ), 0 );
-                                       gtk_widget_set_usize( button, 60, -2 );
+                                       gtk_widget_set_size_request( button, 60, -1 );
                                }
                                {
-                                       GtkWidget* button = gtk_button_new_with_label( "Natural" );
+                                       ui::Widget button = ui::Button( "Natural" );
                                        gtk_widget_show( button );
                                        gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 3, 4,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                        g_signal_connect( G_OBJECT( button ), "clicked",
                                                                          G_CALLBACK( OnBtnPatchnatural ), 0 );
-                                       gtk_widget_set_usize( button, 60, -2 );
+                                       gtk_widget_set_size_request( button, 60, -1 );
                                }
                                {
-                                       GtkWidget* button = gtk_button_new_with_label( "Fit" );
+                                       ui::Widget button = ui::Button( "Fit" );
                                        gtk_widget_show( button );
                                        gtk_table_attach( GTK_TABLE( table ), button, 3, 4, 3, 4,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                        g_signal_connect( G_OBJECT( button ), "clicked",
                                                                          G_CALLBACK( OnBtnPatchFit ), 0 );
-                                       gtk_widget_set_usize( button, 60, -2 );
+                                       gtk_widget_set_size_request( button, 60, -1 );
                                }
                                {
-                                       GtkWidget* spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 0, 1 << 16, 1, 10, 0 ) ), 0, 6 );
+                                       ui::Widget spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
                                        gtk_widget_show( spin );
                                        gtk_table_attach( GTK_TABLE( table ), spin, 2, 3, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-                                       gtk_widget_set_usize( spin, 60, -2 );
+                                       gtk_widget_set_size_request( spin, 60, -1 );
                                        AddDialogData( *GTK_SPIN_BUTTON( spin ), m_fitHorizontal );
                                }
                                {
-                                       GtkWidget* spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 0, 1 << 16, 1, 10, 0 ) ), 0, 6 );
+                                       ui::Widget spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
                                        gtk_widget_show( spin );
                                        gtk_table_attach( GTK_TABLE( table ), spin, 3, 4, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
-                                       gtk_widget_set_usize( spin, 60, -2 );
+                                       gtk_widget_set_size_request( spin, 60, -1 );
                                        AddDialogData( *GTK_SPIN_BUTTON( spin ), m_fitVertical );
                                }
                        }
                }
                if ( !string_empty( g_pGameDescription->getKeyValue( "si_flags" ) ) ) {
                        {
-                               GtkFrame* frame = GTK_FRAME( gtk_frame_new( "Surface Flags" ) );
+                               GtkFrame* frame = ui::Frame( "Surface Flags" );
                                gtk_widget_show( GTK_WIDGET( frame ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
                                {
-                                       GtkVBox* vbox3 = GTK_VBOX( gtk_vbox_new( FALSE, 4 ) );
+                                       GtkVBox* vbox3 = ui::VBox( FALSE, 4 );
                                        //gtk_container_set_border_width(GTK_CONTAINER(vbox3), 4);
                                        gtk_widget_show( GTK_WIDGET( vbox3 ) );
                                        gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
                                        {
-                                               GtkTable* table = GTK_TABLE( gtk_table_new( 8, 4, FALSE ) );
+                                               GtkTable* table = ui::Table( 8, 4, FALSE );
                                                gtk_widget_show( GTK_WIDGET( table ) );
                                                gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
                                                gtk_table_set_row_spacings( table, 0 );
@@ -965,7 +958,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                {
                                                        for ( int r = 0; r != 8; ++r )
                                                        {
-                                                               GtkCheckButton* check = GTK_CHECK_BUTTON( gtk_check_button_new_with_label( getSurfaceFlagName( c * 8 + r ) ) );
+                                                               GtkCheckButton* check = ui::CheckButton( getSurfaceFlagName( c * 8 + r ) );
                                                                gtk_widget_show( GTK_WIDGET( check ) );
                                                                gtk_table_attach( table, GTK_WIDGET( check ), c, c + 1, r, r + 1,
                                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
@@ -979,17 +972,17 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                }
                        }
                        {
-                               GtkFrame* frame = GTK_FRAME( gtk_frame_new( "Content Flags" ) );
+                               GtkFrame* frame = ui::Frame( "Content Flags" );
                                gtk_widget_show( GTK_WIDGET( frame ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
                                {
-                                       GtkVBox* vbox3 = GTK_VBOX( gtk_vbox_new( FALSE, 4 ) );
+                                       GtkVBox* vbox3 = ui::VBox( FALSE, 4 );
                                        //gtk_container_set_border_width(GTK_CONTAINER(vbox3), 4);
                                        gtk_widget_show( GTK_WIDGET( vbox3 ) );
                                        gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
                                        {
 
-                                               GtkTable* table = GTK_TABLE( gtk_table_new( 8, 4, FALSE ) );
+                                               GtkTable* table = ui::Table( 8, 4, FALSE );
                                                gtk_widget_show( GTK_WIDGET( table ) );
                                                gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
                                                gtk_table_set_row_spacings( table, 0 );
@@ -1001,7 +994,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                {
                                                        for ( int r = 0; r != 8; ++r )
                                                        {
-                                                               GtkCheckButton* check = GTK_CHECK_BUTTON( gtk_check_button_new_with_label( getContentFlagName( c * 8 + r ) ) );
+                                                               GtkCheckButton* check = ui::CheckButton( getContentFlagName( c * 8 + r ) );
                                                                gtk_widget_show( GTK_WIDGET( check ) );
                                                                gtk_table_attach( table, GTK_WIDGET( check ), c, c + 1, r, r + 1,
                                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
@@ -1018,17 +1011,17 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                }
                        }
                        {
-                               GtkFrame* frame = GTK_FRAME( gtk_frame_new( "Value" ) );
+                               GtkFrame* frame = ui::Frame( "Value" );
                                gtk_widget_show( GTK_WIDGET( frame ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
                                {
-                                       GtkVBox* vbox3 = GTK_VBOX( gtk_vbox_new( FALSE, 4 ) );
+                                       GtkVBox* vbox3 = ui::VBox( FALSE, 4 );
                                        gtk_container_set_border_width( GTK_CONTAINER( vbox3 ), 4 );
                                        gtk_widget_show( GTK_WIDGET( vbox3 ) );
                                        gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
 
                                        {
-                                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                               GtkEntry* entry = ui::Entry();
                                                gtk_widget_show( GTK_WIDGET( entry ) );
                                                gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
                                                m_valueEntryWidget = entry;
@@ -1041,19 +1034,19 @@ GtkWindow* SurfaceInspector::BuildDialog(){
 #if TEXTOOL_ENABLED
                if ( g_bp_globals.m_texdefTypeId == TEXDEFTYPEID_BRUSHPRIMITIVES ) {
 // Shamus: Textool goodies...
-                       GtkWidget * frame = gtk_frame_new( "Textool" );
+                       ui::Widget frame = ui::Frame( "Textool" );
                        gtk_widget_show( frame );
                        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), FALSE, FALSE, 0 );
                        {
                                //Prolly should make this a member or global var, so the SI can draw on it...
                                TexTool::g_textoolWin = glwidget_new( FALSE );
                                // --> Dunno, but this stuff may be necessary... (Looks like it!)
-                               gtk_widget_ref( TexTool::g_textoolWin );
+                               g_object_ref( TexTool::g_textoolWin );
                                gtk_widget_set_events( TexTool::g_textoolWin, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK );
-                               GTK_WIDGET_SET_FLAGS( TexTool::g_textoolWin, GTK_CAN_FOCUS );
+                               gtk_widget_set_can_focus( TexTool::g_textoolWin, true );
                                // <-- end stuff...
                                gtk_widget_show( TexTool::g_textoolWin );
-                               gtk_widget_set_usize( TexTool::g_textoolWin, -1, 240 ); //Yeah!
+                               gtk_widget_set_size_request( TexTool::g_textoolWin, -1, 240 ); //Yeah!
                                gtk_container_add( GTK_CONTAINER( frame ), TexTool::g_textoolWin );
 
                                g_signal_connect( G_OBJECT( TexTool::g_textoolWin ), "size_allocate", G_CALLBACK( TexTool::size_allocate ), NULL );
@@ -1063,12 +1056,12 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                g_signal_connect( G_OBJECT( TexTool::g_textoolWin ), "motion_notify_event", G_CALLBACK( TexTool::motion ), NULL );
                        }
                        {
-                               GtkWidget * hbox = gtk_hbox_new( FALSE, 5 );
+                               ui::Widget hbox = ui::HBox( FALSE, 5 );
                                gtk_widget_show( hbox );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), FALSE, FALSE, 0 );
                                // Checkboxes go here... (Flip X/Y)
-                               GtkWidget * flipX = gtk_check_button_new_with_label( "Flip X axis" );
-                               GtkWidget * flipY = gtk_check_button_new_with_label( "Flip Y axis" );
+                               ui::Widget flipX = ui::CheckButton( "Flip X axis" );
+                               ui::Widget flipY = ui::CheckButton( "Flip Y axis" );
                                gtk_widget_show( flipX );
                                gtk_widget_show( flipY );
                                gtk_box_pack_start( GTK_BOX( hbox ), flipX, FALSE, FALSE, 0 );
@@ -1111,7 +1104,7 @@ void spin_button_set_value_no_signal( GtkSpinButton* spin, gdouble value ){
 
 void spin_button_set_step_increment( GtkSpinButton* spin, gdouble value ){
        GtkAdjustment* adjust = gtk_spin_button_get_adjustment( spin );
-       adjust->step_increment = value;
+       gtk_adjustment_set_step_increment(adjust, value);
 }
 
 void SurfaceInspector::Update(){
@@ -1214,11 +1207,11 @@ void SurfaceInspector::ApplyShader(){
 void SurfaceInspector::ApplyTexdef(){
        texdef_t shiftScaleRotate;
 
-       shiftScaleRotate.shift[0] = static_cast<float>( gtk_spin_button_get_value_as_float( m_hshiftIncrement.m_spin ) );
-       shiftScaleRotate.shift[1] = static_cast<float>( gtk_spin_button_get_value_as_float( m_vshiftIncrement.m_spin ) );
-       shiftScaleRotate.scale[0] = static_cast<float>( gtk_spin_button_get_value_as_float( m_hscaleIncrement.m_spin ) );
-       shiftScaleRotate.scale[1] = static_cast<float>( gtk_spin_button_get_value_as_float( m_vscaleIncrement.m_spin ) );
-       shiftScaleRotate.rotate = static_cast<float>( gtk_spin_button_get_value_as_float( m_rotateIncrement.m_spin ) );
+       shiftScaleRotate.shift[0] = static_cast<float>( gtk_spin_button_get_value( m_hshiftIncrement.m_spin ) );
+       shiftScaleRotate.shift[1] = static_cast<float>( gtk_spin_button_get_value( m_vshiftIncrement.m_spin ) );
+       shiftScaleRotate.scale[0] = static_cast<float>( gtk_spin_button_get_value( m_hscaleIncrement.m_spin ) );
+       shiftScaleRotate.scale[1] = static_cast<float>( gtk_spin_button_get_value( m_vscaleIncrement.m_spin ) );
+       shiftScaleRotate.rotate = static_cast<float>( gtk_spin_button_get_value( m_rotateIncrement.m_spin ) );
 
        TextureProjection projection;
 //Shamus: This is the other place that screws up, it seems, since it doesn't seem to do the
@@ -1877,14 +1870,14 @@ void focus(){
 //     << extents.maxX << ", " << extents.minY << ", " << extents.maxY << "\n";
 }
 
-gboolean size_allocate( GtkWidget * win, GtkAllocation * a, gpointer ){
+gboolean size_allocate( ui::Widget win, GtkAllocation * a, gpointer ){
        windowSize.x() = a->width;
        windowSize.y() = a->height;
        queueDraw();
        return false;
 }
 
-gboolean expose( GtkWidget * win, GdkEventExpose * e, gpointer ){
+gboolean expose( ui::Widget win, GdkEventExpose * e, gpointer ){
 //     globalOutputStream() << "--> Textool Window was exposed!\n";
 //     globalOutputStream() << "    (window width/height: " << cc << "/" << e->area.height << ")\n";
 
@@ -1983,7 +1976,7 @@ Vector2 trans;
 Vector2 trans2;
 Vector2 dragPoint;  // Defined in terms of window space (+x/-y)
 Vector2 oldTrans;
-gboolean button_press( GtkWidget * win, GdkEventButton * e, gpointer ){
+gboolean button_press( ui::Widget win, GdkEventButton * e, gpointer ){
 //     globalOutputStream() << "--> Textool button press...\n";
 
        if ( e->button == 1 ) {
@@ -2045,7 +2038,7 @@ gboolean button_press( GtkWidget * win, GdkEventButton * e, gpointer ){
        return false;
 }
 
-gboolean button_release( GtkWidget * win, GdkEventButton * e, gpointer ){
+gboolean button_release( ui::Widget win, GdkEventButton * e, gpointer ){
 //     globalOutputStream() << "--> Textool button release...\n";
 
        if ( e->button == 1 ) {
@@ -2107,7 +2100,7 @@ gboolean button_release( GtkWidget * win, GdkEventButton * e, gpointer ){
    c[1] = ((float)(y))/((float)(m_rect.bottom-m_rect.top))*(m_Maxs[1]-m_Mins[1])+m_Mins[1];
    }
  */
-gboolean motion( GtkWidget * win, GdkEventMotion * e, gpointer ){
+gboolean motion( ui::Widget win, GdkEventMotion * e, gpointer ){
 //     globalOutputStream() << "--> Textool motion...\n";
 
        if ( lButtonDown ) {
index 0e0ed24a4b8e13d3e7f4642cff4fc3c22320457c..2c1d945dcd83c413f70d636f9376c7f51068a85f 100644 (file)
@@ -19,6 +19,8 @@
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <uilib/uilib.h>
+
 #if !defined( INCLUDED_SURFACEDIALOG_H )
 #define INCLUDED_SURFACEDIALOG_H
 
@@ -26,9 +28,7 @@
 void SurfaceInspector_Construct();
 void SurfaceInspector_Destroy();
 
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-void SurfaceInspector_constructWindow( GtkWindow* widget );
+void SurfaceInspector_constructWindow( ui::Window widget );
 void SurfaceInspector_destroyWindow();
 
 bool SelectedFaces_empty();
index 3406d2a00e3d40c08bb277b1bfcc0bccca31afa9..451513735351206cf515c71529680a2a229ad4b4 100644 (file)
@@ -23,8 +23,7 @@
 #define INCLUDED_TEXTUREENTRY_H
 
 
-#include <gtk/gtkentry.h>
-#include <gtk/gtkliststore.h>
+#include <gtk/gtk.h>
 #include "gtkutil/idledraw.h"
 
 #include "generic/static.h"
index 1ab87084eea7fc6802c58b3f74ecced8384d1c85..eddd84deecfad5022e9b975f53d887d56fa0c454 100644 (file)
 #include <vector>
 
 #include <gtk/gtk.h>
-#include <gtk/gtkrange.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkvscrollbar.h>
+#include <uilib/uilib.h>
 
 #include "signal/signal.h"
 #include "math/vector.h"
@@ -210,7 +206,7 @@ void value_changed( gdouble value ){
        }
 }
 static void adjustment_value_changed( GtkAdjustment *adjustment, DeferredAdjustment* self ){
-       self->value_changed( adjustment->value );
+       self->value_changed( gtk_adjustment_get_value(adjustment) );
 }
 };
 
@@ -259,21 +255,21 @@ int m_nTotalHeight;
 
 CopiedString shader;
 
-GtkWindow* m_parent;
-GtkWidget* m_gl_widget;
-GtkWidget* m_texture_scroll;
-GtkWidget* m_treeViewTree;
-GtkWidget* m_treeViewTags;
-GtkWidget* m_tag_frame;
+ui::Window m_parent;
+ui::Widget m_gl_widget;
+ui::Widget m_texture_scroll;
+ui::Widget m_treeViewTree;
+ui::Widget m_treeViewTags;
+ui::Widget m_tag_frame;
 GtkListStore* m_assigned_store;
 GtkListStore* m_available_store;
-GtkWidget* m_assigned_tree;
-GtkWidget* m_available_tree;
-GtkWidget* m_scr_win_tree;
-GtkWidget* m_scr_win_tags;
-GtkWidget* m_tag_notebook;
-GtkWidget* m_search_button;
-GtkWidget* m_shader_info_item;
+ui::Widget m_assigned_tree;
+ui::Widget m_available_tree;
+ui::Widget m_scr_win_tree;
+ui::Widget m_scr_win_tags;
+ui::Widget m_tag_notebook;
+ui::Widget m_search_button;
+ui::Widget m_shader_info_item;
 
 std::set<CopiedString> m_all_tags;
 GtkListStore* m_all_tags_list;
@@ -741,7 +737,7 @@ void visit( const char* name ){
 
 void TextureBrowser_SetHideUnused( TextureBrowser& textureBrowser, bool hideUnused );
 
-GtkWidget* g_page_textures;
+ui::Widget g_page_textures;
 
 void TextureBrowser_toggleShow(){
        GroupDialog_showPage( g_page_textures );
@@ -1359,7 +1355,7 @@ void BuildStoreAvailableTags(   GtkListStore* storeAvailable,
        }
 }
 
-gboolean TextureBrowser_button_press( GtkWidget* widget, GdkEventButton* event, TextureBrowser* textureBrowser ){
+gboolean TextureBrowser_button_press( ui::Widget widget, GdkEventButton* event, TextureBrowser* textureBrowser ){
        if ( event->type == GDK_BUTTON_PRESS ) {
                if ( event->button == 3 ) {
                        if ( GlobalTextureBrowser().m_tags ) {
@@ -1392,7 +1388,7 @@ gboolean TextureBrowser_button_press( GtkWidget* widget, GdkEventButton* event,
        return FALSE;
 }
 
-gboolean TextureBrowser_button_release( GtkWidget* widget, GdkEventButton* event, TextureBrowser* textureBrowser ){
+gboolean TextureBrowser_button_release( ui::Widget widget, GdkEventButton* event, TextureBrowser* textureBrowser ){
        if ( event->type == GDK_BUTTON_RELEASE ) {
                if ( event->button == 3 ) {
                        if ( !GlobalTextureBrowser().m_tags ) {
@@ -1403,11 +1399,11 @@ gboolean TextureBrowser_button_release( GtkWidget* widget, GdkEventButton* event
        return FALSE;
 }
 
-gboolean TextureBrowser_motion( GtkWidget *widget, GdkEventMotion *event, TextureBrowser* textureBrowser ){
+gboolean TextureBrowser_motion( ui::Widget widget, GdkEventMotion *event, TextureBrowser* textureBrowser ){
        return FALSE;
 }
 
-gboolean TextureBrowser_scroll( GtkWidget* widget, GdkEventScroll* event, TextureBrowser* textureBrowser ){
+gboolean TextureBrowser_scroll( ui::Widget widget, GdkEventScroll* event, TextureBrowser* textureBrowser ){
        if ( event->direction == GDK_SCROLL_UP ) {
                TextureBrowser_MouseWheel( *textureBrowser, true );
        }
@@ -1423,7 +1419,7 @@ void TextureBrowser_scrollChanged( void* data, gdouble value ){
 }
 
 static void TextureBrowser_verticalScroll( GtkAdjustment *adjustment, TextureBrowser* textureBrowser ){
-       textureBrowser->m_scrollAdjustment.value_changed( adjustment->value );
+       textureBrowser->m_scrollAdjustment.value_changed( gtk_adjustment_get_value(adjustment) );
 }
 
 void TextureBrowser_updateScroll( TextureBrowser& textureBrowser ){
@@ -1434,18 +1430,18 @@ void TextureBrowser_updateScroll( TextureBrowser& textureBrowser ){
 
                GtkAdjustment *vadjustment = gtk_range_get_adjustment( GTK_RANGE( textureBrowser.m_texture_scroll ) );
 
-               vadjustment->value = -TextureBrowser_getOriginY( textureBrowser );
-               vadjustment->page_size = textureBrowser.height;
-               vadjustment->page_increment = textureBrowser.height / 2;
-               vadjustment->step_increment = 20;
-               vadjustment->lower = 0;
-               vadjustment->upper = totalHeight;
+               gtk_adjustment_set_value(vadjustment, -TextureBrowser_getOriginY( textureBrowser ));
+               gtk_adjustment_set_page_size(vadjustment, textureBrowser.height);
+               gtk_adjustment_set_page_increment(vadjustment, textureBrowser.height / 2);
+               gtk_adjustment_set_step_increment(vadjustment, 20);
+               gtk_adjustment_set_lower(vadjustment, 0);
+               gtk_adjustment_set_upper(vadjustment, totalHeight);
 
                g_signal_emit_by_name( G_OBJECT( vadjustment ), "changed" );
        }
 }
 
-gboolean TextureBrowser_size_allocate( GtkWidget* widget, GtkAllocation* allocation, TextureBrowser* textureBrowser ){
+gboolean TextureBrowser_size_allocate( ui::Widget widget, GtkAllocation* allocation, TextureBrowser* textureBrowser ){
        textureBrowser->width = allocation->width;
        textureBrowser->height = allocation->height;
        TextureBrowser_heightChanged( *textureBrowser );
@@ -1454,7 +1450,7 @@ gboolean TextureBrowser_size_allocate( GtkWidget* widget, GtkAllocation* allocat
        return FALSE;
 }
 
-gboolean TextureBrowser_expose( GtkWidget* widget, GdkEventExpose* event, TextureBrowser* textureBrowser ){
+gboolean TextureBrowser_expose( ui::Widget widget, GdkEventExpose* event, TextureBrowser* textureBrowser ){
        if ( glwidget_make_current( textureBrowser->m_gl_widget ) != FALSE ) {
                GlobalOpenGL_debugAssertNoErrors();
                TextureBrowser_evaluateHeight( *textureBrowser );
@@ -1590,14 +1586,13 @@ void TreeView_onRowActivated( GtkTreeView* treeview, GtkTreePath* path, GtkTreeV
 }
 
 void TextureBrowser_createTreeViewTree(){
-       GtkCellRenderer* renderer;
-       g_TextureBrowser.m_treeViewTree = GTK_WIDGET( gtk_tree_view_new() );
+       g_TextureBrowser.m_treeViewTree = ui::TreeView();
        gtk_tree_view_set_enable_search( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), FALSE );
 
        gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), FALSE );
        g_signal_connect( g_TextureBrowser.m_treeViewTree, "row-activated", (GCallback) TreeView_onRowActivated, NULL );
 
-       renderer = gtk_cell_renderer_text_new();
+       auto renderer = ui::CellRendererText();
        gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), -1, "", renderer, "text", 0, NULL );
 
        TextureBrowser_constructTreeStore();
@@ -1607,18 +1602,18 @@ void TextureBrowser_addTag();
 void TextureBrowser_renameTag();
 void TextureBrowser_deleteTag();
 
-void TextureBrowser_createContextMenu( GtkWidget *treeview, GdkEventButton *event ){
-       GtkWidget* menu = gtk_menu_new();
+void TextureBrowser_createContextMenu( ui::Widget treeview, GdkEventButton *event ){
+       ui::Widget menu = ui::Menu();
 
-       GtkWidget* menuitem = gtk_menu_item_new_with_label( "Add tag" );
+       ui::Widget menuitem = ui::MenuItem( "Add tag" );
        g_signal_connect( menuitem, "activate", (GCallback)TextureBrowser_addTag, treeview );
        gtk_menu_shell_append( GTK_MENU_SHELL( menu ), menuitem );
 
-       menuitem = gtk_menu_item_new_with_label( "Rename tag" );
+       menuitem = ui::MenuItem( "Rename tag" );
        g_signal_connect( menuitem, "activate", (GCallback)TextureBrowser_renameTag, treeview );
        gtk_menu_shell_append( GTK_MENU_SHELL( menu ), menuitem );
 
-       menuitem = gtk_menu_item_new_with_label( "Delete tag" );
+       menuitem = ui::MenuItem( "Delete tag" );
        g_signal_connect( menuitem, "activate", (GCallback)TextureBrowser_deleteTag, treeview );
        gtk_menu_shell_append( GTK_MENU_SHELL( menu ), menuitem );
 
@@ -1629,7 +1624,7 @@ void TextureBrowser_createContextMenu( GtkWidget *treeview, GdkEventButton *even
                                        gdk_event_get_time( (GdkEvent*)event ) );
 }
 
-gboolean TreeViewTags_onButtonPressed( GtkWidget *treeview, GdkEventButton *event ){
+gboolean TreeViewTags_onButtonPressed( ui::Widget treeview, GdkEventButton *event ){
        if ( event->type == GDK_BUTTON_PRESS && event->button == 3 ) {
                GtkTreePath *path;
                GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( treeview ) );
@@ -1647,22 +1642,21 @@ gboolean TreeViewTags_onButtonPressed( GtkWidget *treeview, GdkEventButton *even
 }
 
 void TextureBrowser_createTreeViewTags(){
-       GtkCellRenderer* renderer;
-       g_TextureBrowser.m_treeViewTags = GTK_WIDGET( gtk_tree_view_new() );
+       g_TextureBrowser.m_treeViewTags = ui::TreeView();
        gtk_tree_view_set_enable_search( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), FALSE );
 
        g_signal_connect( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), "button-press-event", (GCallback)TreeViewTags_onButtonPressed, NULL );
 
        gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), FALSE );
 
-       renderer = gtk_cell_renderer_text_new();
+       auto renderer = ui::CellRendererText();
        gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), -1, "", renderer, "text", 0, NULL );
 
        TextureBrowser_constructTreeStoreTags();
 }
 
-GtkMenuItem* TextureBrowser_constructViewMenu( GtkMenu* menu ){
-       GtkMenuItem* textures_menu_item = new_sub_menu_item_with_mnemonic( "_View" );
+ui::MenuItem TextureBrowser_constructViewMenu( GtkMenu* menu ){
+       ui::MenuItem textures_menu_item = ui::MenuItem(new_sub_menu_item_with_mnemonic( "_View" ));
 
        if ( g_Layout_enableDetachableMenus.m_value ) {
                menu_tearoff( menu );
@@ -1702,7 +1696,7 @@ GtkMenuItem* TextureBrowser_constructViewMenu( GtkMenu* menu ){
 
        if ( string_empty( g_pGameDescription->getKeyValue( "show_wads" ) ) ) {
                menu_separator( menu );
-               g_TextureBrowser.m_shader_info_item = GTK_WIDGET( create_menu_item_with_mnemonic( menu, "Shader Info", "ShaderInfo" ) );
+               g_TextureBrowser.m_shader_info_item = ui::Widget(GTK_WIDGET( create_menu_item_with_mnemonic( menu, "Shader Info", "ShaderInfo" ) ));
                gtk_widget_set_sensitive( g_TextureBrowser.m_shader_info_item, FALSE );
        }
 
@@ -1710,8 +1704,8 @@ GtkMenuItem* TextureBrowser_constructViewMenu( GtkMenu* menu ){
        return textures_menu_item;
 }
 
-GtkMenuItem* TextureBrowser_constructToolsMenu( GtkMenu* menu ){
-       GtkMenuItem* textures_menu_item = new_sub_menu_item_with_mnemonic( "_Tools" );
+ui::MenuItem TextureBrowser_constructToolsMenu( GtkMenu* menu ){
+       ui::MenuItem textures_menu_item = ui::MenuItem(new_sub_menu_item_with_mnemonic( "_Tools" ));
 
        if ( g_Layout_enableDetachableMenus.m_value ) {
                menu_tearoff( menu );
@@ -1723,8 +1717,8 @@ GtkMenuItem* TextureBrowser_constructToolsMenu( GtkMenu* menu ){
        return textures_menu_item;
 }
 
-GtkMenuItem* TextureBrowser_constructTagsMenu( GtkMenu* menu ){
-       GtkMenuItem* textures_menu_item = new_sub_menu_item_with_mnemonic( "T_ags" );
+ui::MenuItem TextureBrowser_constructTagsMenu( GtkMenu* menu ){
+       ui::MenuItem textures_menu_item = ui::MenuItem(new_sub_menu_item_with_mnemonic( "T_ags" ));
 
        if ( g_Layout_enableDetachableMenus.m_value ) {
                menu_tearoff( menu );
@@ -1926,14 +1920,14 @@ void TextureBrowser_toggleSearchButton(){
                gtk_widget_show_all( g_TextureBrowser.m_search_button );
        }
        else {
-               gtk_widget_hide_all( g_TextureBrowser.m_search_button );
+               gtk_widget_hide( g_TextureBrowser.m_search_button );
        }
 }
 
 void TextureBrowser_constructTagNotebook(){
-       g_TextureBrowser.m_tag_notebook = gtk_notebook_new();
-       GtkWidget* labelTags = gtk_label_new( "Tags" );
-       GtkWidget* labelTextures = gtk_label_new( "Textures" );
+       g_TextureBrowser.m_tag_notebook = ui::Widget(gtk_notebook_new());
+       ui::Widget labelTags = ui::Label( "Tags" );
+       ui::Widget labelTextures = ui::Label( "Textures" );
 
        gtk_notebook_append_page( GTK_NOTEBOOK( g_TextureBrowser.m_tag_notebook ), g_TextureBrowser.m_scr_win_tree, labelTextures );
        gtk_notebook_append_page( GTK_NOTEBOOK( g_TextureBrowser.m_tag_notebook ), g_TextureBrowser.m_scr_win_tags, labelTags );
@@ -1944,12 +1938,10 @@ void TextureBrowser_constructTagNotebook(){
 }
 
 void TextureBrowser_constructSearchButton(){
-       GtkTooltips* tooltips = gtk_tooltips_new();
-
-       GtkWidget* image = gtk_image_new_from_stock( GTK_STOCK_FIND, GTK_ICON_SIZE_SMALL_TOOLBAR );
-       g_TextureBrowser.m_search_button = gtk_button_new();
+       ui::Widget image = ui::Widget(gtk_image_new_from_stock( GTK_STOCK_FIND, GTK_ICON_SIZE_SMALL_TOOLBAR ));
+       g_TextureBrowser.m_search_button = ui::Button();
        g_signal_connect( G_OBJECT( g_TextureBrowser.m_search_button ), "clicked", G_CALLBACK( TextureBrowser_searchTags ), NULL );
-       gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), g_TextureBrowser.m_search_button, "Search with selected tags", "Search with selected tags" );
+       gtk_widget_set_tooltip_text(g_TextureBrowser.m_search_button, "Search with selected tags");
        gtk_container_add( GTK_CONTAINER( g_TextureBrowser.m_search_button ), image );
 }
 
@@ -2001,7 +1993,7 @@ void TextureBrowser_SetNotex(){
        g_shadernotex = name.c_str();
 }
 
-GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){
+ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){
        // The gl_widget and the tag assignment frame should be packed into a GtkVPaned with the slider
        // position stored in local.pref. gtk_paned_get_position() and gtk_paned_set_position() don't
        // seem to work in gtk 2.4 and the arrow buttons don't handle GTK_FILL, so here's another thing
@@ -2014,31 +2006,31 @@ GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){
 
        g_TextureBrowser.m_parent = toplevel;
 
-       GtkWidget* table = gtk_table_new( 3, 3, FALSE );
-       GtkWidget* frame_table = NULL;
-       GtkWidget* vbox = gtk_vbox_new( FALSE, 0 );
+       ui::Widget table = ui::Table( 3, 3, FALSE );
+       ui::Widget frame_table;
+       ui::Widget vbox = ui::VBox( FALSE, 0 );
        gtk_table_attach( GTK_TABLE( table ), vbox, 0, 1, 1, 3, GTK_FILL, GTK_FILL, 0, 0 );
        gtk_widget_show( vbox );
 
-       GtkWidget* menu_bar;
+       ui::Widget menu_bar;
 
        { // menu bar
-               menu_bar = gtk_menu_bar_new();
-               GtkWidget* menu_view = gtk_menu_new();
-               GtkWidget* view_item = (GtkWidget*)TextureBrowser_constructViewMenu( GTK_MENU( menu_view ) );
+               menu_bar = ui::Widget(gtk_menu_bar_new());
+               ui::Widget menu_view = ui::Menu();
+               auto view_item = TextureBrowser_constructViewMenu( GTK_MENU( menu_view ) );
                gtk_menu_item_set_submenu( GTK_MENU_ITEM( view_item ), menu_view );
-               gtk_menu_bar_append( GTK_MENU_BAR( menu_bar ), view_item );
+               gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), view_item );
 
-               GtkWidget* menu_tools = gtk_menu_new();
-               GtkWidget* tools_item = (GtkWidget*)TextureBrowser_constructToolsMenu( GTK_MENU( menu_tools ) );
+               ui::Widget menu_tools = ui::Menu();
+               auto tools_item = TextureBrowser_constructToolsMenu( GTK_MENU( menu_tools ) );
                gtk_menu_item_set_submenu( GTK_MENU_ITEM( tools_item ), menu_tools );
-               gtk_menu_bar_append( GTK_MENU_BAR( menu_bar ), tools_item );
+               gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), tools_item );
 
                gtk_table_attach( GTK_TABLE( table ), menu_bar, 0, 3, 0, 1, GTK_FILL, GTK_SHRINK, 0, 0 );
                gtk_widget_show( menu_bar );
        }
        { // Texture TreeView
-               g_TextureBrowser.m_scr_win_tree = gtk_scrolled_window_new( NULL, NULL );
+               g_TextureBrowser.m_scr_win_tree = ui::ScrolledWindow();
                gtk_container_set_border_width( GTK_CONTAINER( g_TextureBrowser.m_scr_win_tree ), 0 );
 
                // vertical only scrolling for treeview
@@ -2052,7 +2044,7 @@ GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){
                gtk_widget_show( GTK_WIDGET( g_TextureBrowser.m_treeViewTree ) );
        }
        { // gl_widget scrollbar
-               GtkWidget* w = gtk_vscrollbar_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,0,1,1,0 ) ) );
+               ui::Widget w = ui::Widget(gtk_vscrollbar_new( ui::Adjustment( 0,0,0,1,1,0 ) ));
                gtk_table_attach( GTK_TABLE( table ), w, 2, 3, 1, 2, GTK_SHRINK, GTK_FILL, 0, 0 );
                gtk_widget_show( w );
                g_TextureBrowser.m_texture_scroll = w;
@@ -2063,11 +2055,11 @@ GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){
                widget_set_visible( g_TextureBrowser.m_texture_scroll, g_TextureBrowser.m_showTextureScrollbar );
        }
        { // gl_widget
-               g_TextureBrowser.m_gl_widget = glwidget_new( FALSE );
-               gtk_widget_ref( g_TextureBrowser.m_gl_widget );
+               g_TextureBrowser.m_gl_widget = ui::Widget(glwidget_new( FALSE ));
+               g_object_ref( g_TextureBrowser.m_gl_widget );
 
                gtk_widget_set_events( g_TextureBrowser.m_gl_widget, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK );
-               GTK_WIDGET_SET_FLAGS( g_TextureBrowser.m_gl_widget, GTK_CAN_FOCUS );
+               gtk_widget_set_can_focus( g_TextureBrowser.m_gl_widget, true );
 
                gtk_table_attach_defaults( GTK_TABLE( table ), g_TextureBrowser.m_gl_widget, 1, 2, 1, 2 );
                gtk_widget_show( g_TextureBrowser.m_gl_widget );
@@ -2092,13 +2084,13 @@ GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){
                        TextureBrowser_buildTagList();
                }
                { // tag menu bar
-                       GtkWidget* menu_tags = gtk_menu_new();
-                       GtkWidget* tags_item = (GtkWidget*)TextureBrowser_constructTagsMenu( GTK_MENU( menu_tags ) );
+                       ui::Widget menu_tags = ui::Menu();
+                       auto tags_item = TextureBrowser_constructTagsMenu( GTK_MENU( menu_tags ) );
                        gtk_menu_item_set_submenu( GTK_MENU_ITEM( tags_item ), menu_tags );
-                       gtk_menu_bar_append( GTK_MENU_BAR( menu_bar ), tags_item );
+                       gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), tags_item );
                }
                { // Tag TreeView
-                       g_TextureBrowser.m_scr_win_tags = gtk_scrolled_window_new( NULL, NULL );
+                       g_TextureBrowser.m_scr_win_tags = ui::ScrolledWindow();
                        gtk_container_set_border_width( GTK_CONTAINER( g_TextureBrowser.m_scr_win_tags ), 0 );
 
                        // vertical only scrolling for treeview
@@ -2121,9 +2113,9 @@ GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){
                        gtk_box_pack_end( GTK_BOX( vbox ), g_TextureBrowser.m_search_button, FALSE, FALSE, 0 );
                }
                { // Tag frame
-                       frame_table = gtk_table_new( 3, 3, FALSE );
+                       frame_table = ui::Table( 3, 3, FALSE );
 
-                       g_TextureBrowser.m_tag_frame = gtk_frame_new( "Tag assignment" );
+                       g_TextureBrowser.m_tag_frame = ui::Frame( "Tag assignment" );
                        gtk_frame_set_label_align( GTK_FRAME( g_TextureBrowser.m_tag_frame ), 0.5, 0.5 );
                        gtk_frame_set_shadow_type( GTK_FRAME( g_TextureBrowser.m_tag_frame ), GTK_SHADOW_NONE );
 
@@ -2134,7 +2126,7 @@ GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){
                        gtk_container_add( GTK_CONTAINER( g_TextureBrowser.m_tag_frame ), frame_table );
                }
                { // assigned tag list
-                       GtkWidget* scrolled_win = gtk_scrolled_window_new( NULL, NULL );
+                       ui::Widget scrolled_win = ui::ScrolledWindow();
                        gtk_container_set_border_width( GTK_CONTAINER( scrolled_win ), 0 );
                        gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
 
@@ -2143,9 +2135,9 @@ GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){
                        GtkTreeSortable* sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_assigned_store );
                        gtk_tree_sortable_set_sort_column_id( sortable, TAG_COLUMN, GTK_SORT_ASCENDING );
 
-                       GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
+                       auto renderer = ui::CellRendererText();
 
-                       g_TextureBrowser.m_assigned_tree = gtk_tree_view_new_with_model( GTK_TREE_MODEL( g_TextureBrowser.m_assigned_store ) );
+                       g_TextureBrowser.m_assigned_tree = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( g_TextureBrowser.m_assigned_store ) ));
                        g_object_unref( G_OBJECT( g_TextureBrowser.m_assigned_store ) );
                        g_signal_connect( g_TextureBrowser.m_assigned_tree, "row-activated", (GCallback) TextureBrowser_removeTags, NULL );
                        gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_assigned_tree ), FALSE );
@@ -2153,7 +2145,7 @@ GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){
                        GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( g_TextureBrowser.m_assigned_tree ) );
                        gtk_tree_selection_set_mode( selection, GTK_SELECTION_MULTIPLE );
 
-                       GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", TAG_COLUMN, NULL );
+                       GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", TAG_COLUMN}} );
                        gtk_tree_view_append_column( GTK_TREE_VIEW( g_TextureBrowser.m_assigned_tree ), column );
                        gtk_widget_show( g_TextureBrowser.m_assigned_tree );
 
@@ -2163,7 +2155,7 @@ GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){
                        gtk_table_attach( GTK_TABLE( frame_table ), scrolled_win, 0, 1, 1, 3, GTK_FILL, GTK_FILL, 0, 0 );
                }
                { // available tag list
-                       GtkWidget* scrolled_win = gtk_scrolled_window_new( NULL, NULL );
+                       ui::Widget scrolled_win = ui::ScrolledWindow();
                        gtk_container_set_border_width( GTK_CONTAINER( scrolled_win ), 0 );
                        gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
 
@@ -2171,9 +2163,9 @@ GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){
                        GtkTreeSortable* sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_available_store );
                        gtk_tree_sortable_set_sort_column_id( sortable, TAG_COLUMN, GTK_SORT_ASCENDING );
 
-                       GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
+                       auto renderer = ui::CellRendererText();
 
-                       g_TextureBrowser.m_available_tree = gtk_tree_view_new_with_model( GTK_TREE_MODEL( g_TextureBrowser.m_available_store ) );
+                       g_TextureBrowser.m_available_tree = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( g_TextureBrowser.m_available_store ) ));
                        g_object_unref( G_OBJECT( g_TextureBrowser.m_available_store ) );
                        g_signal_connect( g_TextureBrowser.m_available_tree, "row-activated", (GCallback) TextureBrowser_assignTags, NULL );
                        gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_available_tree ), FALSE );
@@ -2181,7 +2173,7 @@ GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){
                        GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( g_TextureBrowser.m_available_tree ) );
                        gtk_tree_selection_set_mode( selection, GTK_SELECTION_MULTIPLE );
 
-                       GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", TAG_COLUMN, NULL );
+                       GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", TAG_COLUMN}} );
                        gtk_tree_view_append_column( GTK_TREE_VIEW( g_TextureBrowser.m_available_tree ), column );
                        gtk_widget_show( g_TextureBrowser.m_available_tree );
 
@@ -2191,10 +2183,10 @@ GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){
                        gtk_table_attach( GTK_TABLE( frame_table ), scrolled_win, 2, 3, 1, 3, GTK_FILL, GTK_FILL, 0, 0 );
                }
                { // tag arrow buttons
-                       GtkWidget* m_btn_left = gtk_button_new();
-                       GtkWidget* m_btn_right = gtk_button_new();
-                       GtkWidget* m_arrow_left = gtk_arrow_new( GTK_ARROW_LEFT, GTK_SHADOW_OUT );
-                       GtkWidget* m_arrow_right = gtk_arrow_new( GTK_ARROW_RIGHT, GTK_SHADOW_OUT );
+                       ui::Widget m_btn_left = ui::Button();
+                       ui::Widget m_btn_right = ui::Button();
+                       ui::Widget m_arrow_left = ui::Widget(gtk_arrow_new( GTK_ARROW_LEFT, GTK_SHADOW_OUT ));
+                       ui::Widget m_arrow_right = ui::Widget(gtk_arrow_new( GTK_ARROW_RIGHT, GTK_SHADOW_OUT ));
                        gtk_container_add( GTK_CONTAINER( m_btn_left ), m_arrow_left );
                        gtk_container_add( GTK_CONTAINER( m_btn_right ), m_arrow_right );
 
@@ -2214,8 +2206,8 @@ GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){
                        gtk_widget_show( m_arrow_right );
                }
                { // tag fram labels
-                       GtkWidget* m_lbl_assigned = gtk_label_new( "Assigned" );
-                       GtkWidget* m_lbl_unassigned = gtk_label_new( "Available" );
+                       ui::Widget m_lbl_assigned = ui::Label( "Assigned" );
+                       ui::Widget m_lbl_unassigned = ui::Label( "Available" );
 
                        gtk_table_attach( GTK_TABLE( frame_table ), m_lbl_assigned, 0, 1, 0, 1, GTK_EXPAND, GTK_SHRINK, 0, 0 );
                        gtk_table_attach( GTK_TABLE( frame_table ), m_lbl_unassigned, 2, 3, 0, 1, GTK_EXPAND, GTK_SHRINK, 0, 0 );
@@ -2240,7 +2232,7 @@ void TextureBrowser_destroyWindow(){
        g_signal_handler_disconnect( G_OBJECT( g_TextureBrowser.m_gl_widget ), g_TextureBrowser.m_sizeHandler );
        g_signal_handler_disconnect( G_OBJECT( g_TextureBrowser.m_gl_widget ), g_TextureBrowser.m_exposeHandler );
 
-       gtk_widget_unref( g_TextureBrowser.m_gl_widget );
+       g_object_unref( g_TextureBrowser.m_gl_widget );
 }
 
 const Vector3& TextureBrowser_getBackgroundColour( TextureBrowser& textureBrowser ){
@@ -2334,7 +2326,7 @@ void TextureBrowser_renameTag(){
        }
        else
        {
-               gtk_MessageBox( GTK_WIDGET( g_TextureBrowser.m_parent ), "Select a single tag for renaming." );
+               ui::Widget(GTK_WIDGET( g_TextureBrowser.m_parent )).alert( "Select a single tag for renaming." );
        }
 }
 
@@ -2345,9 +2337,9 @@ void TextureBrowser_deleteTag(){
        gtk_tree_selection_selected_foreach( selection, GtkTreeSelectionForeachFunc( TextureBrowser_selectionHelper ), &selected );
 
        if ( g_slist_length( selected ) == 1 ) { // we only delete a single tag
-               EMessageBoxReturn result = gtk_MessageBox( GTK_WIDGET( g_TextureBrowser.m_parent ), "Are you sure you want to delete the selected tag?", "Delete Tag", eMB_YESNO, eMB_ICONQUESTION );
+               auto result = ui::Widget(GTK_WIDGET( g_TextureBrowser.m_parent )).alert( "Are you sure you want to delete the selected tag?", "Delete Tag", ui::alert_type::YESNO, ui::alert_icon::Question );
 
-               if ( result == eIDYES ) {
+               if ( result == ui::alert_response::YES ) {
                        GtkTreeIter iterSelected;
                        gchar *rowTag;
 
@@ -2374,7 +2366,7 @@ void TextureBrowser_deleteTag(){
                }
        }
        else {
-               gtk_MessageBox( GTK_WIDGET( g_TextureBrowser.m_parent ), "Select a single tag for deletion." );
+               ui::Widget(GTK_WIDGET( g_TextureBrowser.m_parent )).alert( "Select a single tag for deletion." );
        }
 }
 
@@ -2426,7 +2418,7 @@ void TextureBrowser_RefreshShaders(){
        ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Shaders" );
        GlobalShaderSystem().refresh();
        UpdateAllWindows();
-       GtkTreeSelection* selection = gtk_tree_view_get_selection((GtkTreeView*)GlobalTextureBrowser().m_treeViewTree);
+       GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(GlobalTextureBrowser().m_treeViewTree));
        GtkTreeModel* model = NULL;
        GtkTreeIter iter;
        if ( gtk_tree_selection_get_selected (selection, &model, &iter) )
@@ -2466,9 +2458,9 @@ void TextureBrowser_showAll(){
 }
 
 void TextureBrowser_showUntagged(){
-       EMessageBoxReturn result = gtk_MessageBox( GTK_WIDGET( g_TextureBrowser.m_parent ), "WARNING! This function might need a lot of memory and time. Are you sure you want to use it?", "Show Untagged", eMB_YESNO, eMB_ICONWARNING );
+       auto result = ui::Widget(GTK_WIDGET( g_TextureBrowser.m_parent )).alert( "WARNING! This function might need a lot of memory and time. Are you sure you want to use it?", "Show Untagged", ui::alert_type::YESNO, ui::alert_icon::Warning );
 
-       if ( result == eIDYES ) {
+       if ( result == ui::alert_response::YES ) {
                g_TextureBrowser.m_found_shaders.clear();
                TagBuilder.GetUntagged( g_TextureBrowser.m_found_shaders );
                std::set<CopiedString>::iterator iter;
index edc67b221f7c217004d0716dab2f373e5a9956a7..15ec907c5da1dcaf6e53328bcd793e9d62a7572a 100644 (file)
 #if !defined( INCLUDED_TEXWINDOW_H )
 #define INCLUDED_TEXWINDOW_H
 
+#include <uilib/uilib.h>
 #include "math/vector.h"
 #include "generic/callbackfwd.h"
 #include "signal/signalfwd.h"
 #include "xml/xmltextags.h"
 
-typedef struct _GtkWidget GtkWidget;
-
 class TextureBrowser;
 TextureBrowser& GlobalTextureBrowser();
 
-typedef struct _GtkWindow GtkWindow;
-GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel );
+ui::Widget TextureBrowser_constructWindow( ui::Window toplevel );
 void TextureBrowser_destroyWindow();
 
 
@@ -49,7 +47,7 @@ typedef Callback1<const char*> StringImportCallback;
 template<typename FirstArgument, void( *func ) (FirstArgument)>
 class FreeCaller1;
 
-extern GtkWidget* g_page_textures;
+extern ui::Widget g_page_textures;
 void TextureBrowser_exportTitle( const StringImportCallback& importer );
 typedef FreeCaller1<const StringImportCallback&, TextureBrowser_exportTitle> TextureBrowserExportTitleCaller;
 
index d36e492a753077eeba8e26cfe67f526d7bb0f58a..9e1f20cfbd202abfb6053fd7677f77d362044845 100644 (file)
@@ -24,9 +24,8 @@
 #include "debugging/debugging.h"
 
 #include <map>
-#include <gtk/gtktreemodel.h>
-#include <gtk/gtktreednd.h>
-#include <gtk/gtkmain.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
 
 #include "iscenegraph.h"
 #include "nameable.h"
@@ -280,7 +279,7 @@ static GtkTreePath* graph_tree_model_get_path( GtkTreeModel* tree_model, GtkTree
        graph_type& graph = *GRAPH_TREE_MODEL( tree_model )->graph;
        graph_type::iterator i = graph_iterator_read_tree_iter( iter );
 
-       GtkTreePath* path = gtk_tree_path_new();
+       GtkTreePath* path = ui::TreePath();
 
        for ( std::size_t depth = ( *i ).first.get().size(); depth != 0; --depth )
        {
@@ -882,7 +881,7 @@ static GtkTreePath* graph_tree_model_get_path( GtkTreeModel* tree_model, GtkTree
        ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
        GraphTreeNode* graph = GRAPH_TREE_MODEL( tree_model )->m_graph;
 
-       GtkTreePath* path = gtk_tree_path_new();
+       GtkTreePath* path = ui::TreePath();
 
        for ( GraphTreeNode* node = ( *graph_iterator_read_tree_iter( iter ) ).second; node != graph; node = node->m_parent )
        {
@@ -1369,7 +1368,7 @@ TestGraphTreeModel(){
 
        {
                GtkTreeIter iter;
-               GtkTreePath* path = gtk_tree_path_new_from_string( "0" );
+               GtkTreePath* path = ui::TreePath( "0" );
                gtk_tree_model_get_iter( model, &iter, path );
                gtk_tree_path_free( path );
 
@@ -1379,7 +1378,7 @@ TestGraphTreeModel(){
 
        {
                GtkTreeIter iter;
-               GtkTreePath* path = gtk_tree_path_new_from_string( "1" );
+               GtkTreePath* path = ui::TreePath( "1" );
                gtk_tree_model_get_iter( model, &iter, path );
                gtk_tree_path_free( path );
 
index b86702e7727cc2996afd648e3b8debe691f0fea8..ed33cb2f7a09c0a69db3b09b290cfec46117f427 100644 (file)
@@ -28,7 +28,7 @@
 #include <gdk/gdkwin32.h>
 #include <shellapi.h>
 bool open_url( const char* url ){
-       return ShellExecute( (HWND)GDK_WINDOW_HWND( GTK_WIDGET( MainFrame_getWindow() )->window ), "open", url, 0, 0, SW_SHOW ) > (HINSTANCE)32;
+       return ShellExecute( (HWND)GDK_WINDOW_HWND( gtk_widget_get_window( MainFrame_getWindow() ) ), "open", url, 0, 0, SW_SHOW ) > (HINSTANCE)32;
 }
 #endif
 
@@ -55,6 +55,6 @@ void OpenURL( const char *url ){
        // let's put a little comment
        globalOutputStream() << "OpenURL: " << url << "\n";
        if ( !open_url( url ) ) {
-               gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), "Failed to launch browser!" );
+               MainFrame_getWindow().alert( "Failed to launch browser!" );
        }
 }
index f3d1ae6f77438bf431f3acaead01255488a17192..7bbbf194da74d268b53f1570f317dc6bcfc32c8c 100644 (file)
@@ -36,7 +36,7 @@
 #include "watchbsp.h"
 
 #include <algorithm>
-#include <gtk/gtkmain.h>
+#include <gtk/gtk.h>
 
 #include "cmdlib.h"
 #include "convert.h"
@@ -77,86 +77,87 @@ void message_print( message_info_t* self, const char* characters, std::size_t le
 
 
 #include <glib.h>
+#include <uilib/uilib.h>
 #include "xmlstuff.h"
 
 class CWatchBSP
 {
 private:
-// a flag we have set to true when using an external BSP plugin
-// the resulting code with that is a bit dirty, cleaner solution would be to seperate the succession of commands from the listening loop
-// (in two seperate classes probably)
-bool m_bBSPPlugin;
-
-// EIdle: we are not listening
-//   DoMonitoringLoop will change state to EBeginStep
-// EBeginStep: the socket is up for listening, we are expecting incoming connection
-//   incoming connection will change state to EWatching
-// EWatching: we have a connection, monitor it
-//   connection closed will see if we start a new step (EBeginStep) or launch Quake3 and end (EIdle)
-enum EWatchBSPState { EIdle, EBeginStep, EWatching } m_eState;
-socket_t *m_pListenSocket;
-socket_t *m_pInSocket;
-netmessage_t msg;
-GPtrArray *m_pCmd;
-// used to timeout EBeginStep
-GTimer    *m_pTimer;
-std::size_t m_iCurrentStep;
-// name of the map so we can run the engine
-char    *m_sBSPName;
-// buffer we use in push mode to receive data directly from the network
-xmlParserInputBufferPtr m_xmlInputBuffer;
-xmlParserInputPtr m_xmlInput;
-xmlParserCtxtPtr m_xmlParserCtxt;
-// call this to switch the set listening mode
-bool SetupListening();
-// start a new EBeginStep
-void DoEBeginStep();
-// the xml and sax parser state
-char m_xmlBuf[MAX_NETMESSAGE];
-bool m_bNeedCtxtInit;
-message_info_t m_message_info;
+       // a flag we have set to true when using an external BSP plugin
+       // the resulting code with that is a bit dirty, cleaner solution would be to seperate the succession of commands from the listening loop
+       // (in two seperate classes probably)
+       bool m_bBSPPlugin;
+
+       // EIdle: we are not listening
+       //   DoMonitoringLoop will change state to EBeginStep
+       // EBeginStep: the socket is up for listening, we are expecting incoming connection
+       //   incoming connection will change state to EWatching
+       // EWatching: we have a connection, monitor it
+       //   connection closed will see if we start a new step (EBeginStep) or launch Quake3 and end (EIdle)
+       enum EWatchBSPState { EIdle, EBeginStep, EWatching } m_eState;
+       socket_t *m_pListenSocket;
+       socket_t *m_pInSocket;
+       netmessage_t msg;
+       GPtrArray *m_pCmd;
+       // used to timeout EBeginStep
+       GTimer    *m_pTimer;
+       std::size_t m_iCurrentStep;
+       // name of the map so we can run the engine
+       char    *m_sBSPName;
+       // buffer we use in push mode to receive data directly from the network
+       xmlParserInputBufferPtr m_xmlInputBuffer;
+       xmlParserInputPtr m_xmlInput;
+       xmlParserCtxtPtr m_xmlParserCtxt;
+       // call this to switch the set listening mode
+       bool SetupListening();
+       // start a new EBeginStep
+       void DoEBeginStep();
+       // the xml and sax parser state
+       char m_xmlBuf[MAX_NETMESSAGE];
+       bool m_bNeedCtxtInit;
+       message_info_t m_message_info;
 
 public:
-CWatchBSP(){
-       m_pCmd = 0;
-       m_bBSPPlugin = false;
-       m_pListenSocket = NULL;
-       m_pInSocket = NULL;
-       m_eState = EIdle;
-       m_pTimer = g_timer_new();
-       m_sBSPName = NULL;
-       m_xmlInputBuffer = NULL;
-       m_bNeedCtxtInit = true;
-}
-virtual ~CWatchBSP(){
-       EndMonitoringLoop();
-       Net_Shutdown();
-
-       g_timer_destroy( m_pTimer );
-}
-
-bool HasBSPPlugin() const
-{ return m_bBSPPlugin; }
+       CWatchBSP(){
+               m_pCmd = 0;
+               m_bBSPPlugin = false;
+               m_pListenSocket = NULL;
+               m_pInSocket = NULL;
+               m_eState = EIdle;
+               m_pTimer = g_timer_new();
+               m_sBSPName = NULL;
+               m_xmlInputBuffer = NULL;
+               m_bNeedCtxtInit = true;
+       }
+       virtual ~CWatchBSP(){
+               EndMonitoringLoop();
+               Net_Shutdown();
 
-// called regularly to keep listening
-void RoutineProcessing();
-// start a monitoring loop with the following steps
-void DoMonitoringLoop( GPtrArray *pCmd, const char *sBSPName );
-void EndMonitoringLoop(){
-       Reset();
-       if ( m_sBSPName ) {
-               string_release( m_sBSPName, string_length( m_sBSPName ) );
-               m_sBSPName = 0;
+               g_timer_destroy( m_pTimer );
        }
-       if ( m_pCmd ) {
-               g_ptr_array_free( m_pCmd, TRUE );
-               m_pCmd = 0;
+
+       bool HasBSPPlugin() const
+       { return m_bBSPPlugin; }
+
+       // called regularly to keep listening
+       void RoutineProcessing();
+       // start a monitoring loop with the following steps
+       void DoMonitoringLoop( GPtrArray *pCmd, const char *sBSPName );
+       void EndMonitoringLoop(){
+               Reset();
+               if ( m_sBSPName ) {
+                       string_release( m_sBSPName, string_length( m_sBSPName ) );
+                       m_sBSPName = 0;
+               }
+               if ( m_pCmd ) {
+                       g_ptr_array_free( m_pCmd, TRUE );
+                       m_pCmd = 0;
+               }
        }
-}
-// close everything - may be called from the outside to abort the process
-void Reset();
-// start a listening loop for an external process, possibly a BSP plugin
-void ExternalListen();
+       // close everything - may be called from the outside to abort the process
+       void Reset();
+       // start a listening loop for an external process, possibly a BSP plugin
+       void ExternalListen();
 };
 
 CWatchBSP* g_pWatchBSP;
@@ -176,10 +177,10 @@ int g_WatchBSP_Timeout = 10;
 
 
 void Build_constructPreferences( PreferencesPage& page ){
-       GtkWidget* monitorbsp = page.appendCheckBox( "", "Enable Build Process Monitoring", g_WatchBSP_Enabled );
-       GtkWidget* leakstop = page.appendCheckBox( "", "Stop Compilation on Leak", g_WatchBSP_LeakStop );
-       GtkWidget* runengine = page.appendCheckBox( "", "Run Engine After Compile", g_WatchBSP_RunQuake );
-       GtkWidget* sleep = page.appendCheckBox ( "", "Sleep When Running the Engine", g_WatchBSP_DoSleep );
+       ui::CheckButton monitorbsp = page.appendCheckBox( "", "Enable Build Process Monitoring", g_WatchBSP_Enabled );
+       ui::CheckButton leakstop = page.appendCheckBox( "", "Stop Compilation on Leak", g_WatchBSP_LeakStop );
+       ui::CheckButton runengine = page.appendCheckBox( "", "Run Engine After Compile", g_WatchBSP_RunQuake );
+       ui::CheckButton sleep = page.appendCheckBox ( "", "Sleep When Running the Engine", g_WatchBSP_DoSleep );
        Widget_connectToggleDependency( leakstop, monitorbsp );
        Widget_connectToggleDependency( runengine, monitorbsp );
        Widget_connectToggleDependency( sleep, runengine );
@@ -359,29 +360,30 @@ static void saxEndElement( message_info_t *data, const xmlChar *name ){
 
 class MessageOutputStream : public TextOutputStream
 {
-message_info_t* m_data;
+       message_info_t* m_data;
 public:
-MessageOutputStream( message_info_t* data ) : m_data( data ){
-}
-std::size_t write( const char* buffer, std::size_t length ){
-       if ( m_data->pGeometry != 0 ) {
-               m_data->pGeometry->saxCharacters( m_data, reinterpret_cast<const xmlChar*>( buffer ), int(length) );
+       MessageOutputStream( message_info_t* data ) : m_data( data ){
        }
-       else
-       {
-               if ( m_data->ignore_depth == 0 ) {
-                       // output the message using the level
-                       message_print( m_data, buffer, length );
-                       // if this message has error level flag, we mark the depth to stop the compilation when we get out
-                       // we don't set the msg level if we don't stop on leak
-                       if ( m_data->msg_level == 3 ) {
-                               m_data->stop_depth = m_data->recurse - 1;
+
+       std::size_t write( const char* buffer, std::size_t length ){
+               if ( m_data->pGeometry != 0 ) {
+                       m_data->pGeometry->saxCharacters( m_data, reinterpret_cast<const xmlChar*>( buffer ), int(length) );
+               }
+               else
+               {
+                       if ( m_data->ignore_depth == 0 ) {
+                               // output the message using the level
+                               message_print( m_data, buffer, length );
+                               // if this message has error level flag, we mark the depth to stop the compilation when we get out
+                               // we don't set the msg level if we don't stop on leak
+                               if ( m_data->msg_level == 3 ) {
+                                       m_data->stop_depth = m_data->recurse - 1;
+                               }
                        }
                }
-       }
 
-       return length;
-}
+               return length;
+       }
 };
 
 template<typename T>
@@ -488,7 +490,7 @@ void CWatchBSP::Reset(){
        }
        m_eState = EIdle;
        if ( s_routine_id ) {
-               gtk_timeout_remove( s_routine_id );
+               g_source_remove( s_routine_id );
        }
 }
 
@@ -514,7 +516,7 @@ void CWatchBSP::DoEBeginStep(){
        if ( SetupListening() == false ) {
                const char* msg = "Failed to get a listening socket on port 39000.\nTry running with Build monitoring disabled if you can't fix this.\n";
                globalOutputStream() << msg;
-               gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), msg, "Build monitoring", eMB_OK, eMB_ICONERROR );
+               MainFrame_getWindow().alert( msg, "Build monitoring", ui::alert_type::OK, ui::alert_icon::Error );
                return;
        }
        // set the timer for timeouts and step cancellation
@@ -531,7 +533,7 @@ void CWatchBSP::DoEBeginStep(){
                        msg << reinterpret_cast<const char*>( g_ptr_array_index( m_pCmd, m_iCurrentStep ) );
                        msg << "\nCheck that the file exists and that you don't run out of system resources.\n";
                        globalOutputStream() << msg.c_str();
-                       gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), msg.c_str(), "Build monitoring", eMB_OK, eMB_ICONERROR );
+                       MainFrame_getWindow().alert( msg.c_str(), "Build monitoring", ui::alert_type::OK, ui::alert_icon::Error );
                        return;
                }
                // re-initialise the debug window
@@ -540,7 +542,7 @@ void CWatchBSP::DoEBeginStep(){
                }
        }
        m_eState = EBeginStep;
-       s_routine_id = gtk_timeout_add( 25, watchbsp_routine, this );
+       s_routine_id = g_timeout_add( 25, watchbsp_routine, this );
 }
 
 
@@ -560,15 +562,15 @@ void CWatchBSP::DoEBeginStep(){
 class RunEngineConfiguration
 {
 public:
-const char* executable;
-const char* mp_executable;
-bool do_sp_mp;
-
-RunEngineConfiguration() :
-       executable( g_pGameDescription->getRequiredKeyValue( ENGINE_ATTRIBUTE ) ),
-       mp_executable( g_pGameDescription->getKeyValue( MP_ENGINE_ATTRIBUTE ) ){
-       do_sp_mp = !string_empty( mp_executable );
-}
+       const char* executable;
+       const char* mp_executable;
+       bool do_sp_mp;
+
+       RunEngineConfiguration() :
+               executable( g_pGameDescription->getRequiredKeyValue( ENGINE_ATTRIBUTE ) ),
+               mp_executable( g_pGameDescription->getKeyValue( MP_ENGINE_ATTRIBUTE ) ){
+               do_sp_mp = !string_empty( mp_executable );
+       }
 };
 
 inline void GlobalGameDescription_string_write_mapparameter( StringOutputStream& string, const char* mapname ){
@@ -611,7 +613,7 @@ void CWatchBSP::RoutineProcessing(){
        case EBeginStep:
                // timeout: if we don't get an incoming connection fast enough, go back to idle
                if ( g_timer_elapsed( m_pTimer, NULL ) > g_WatchBSP_Timeout ) {
-                       gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ),  "The connection timed out, assuming the build process failed\nMake sure you are using a networked version of Q3Map?\nOtherwise you need to disable BSP Monitoring in prefs.", "BSP process monitoring", eMB_OK );
+                       MainFrame_getWindow().alert(  "The connection timed out, assuming the build process failed\nMake sure you are using a networked version of Q3Map?\nOtherwise you need to disable BSP Monitoring in prefs.", "BSP process monitoring", ui::alert_type::OK );
                        EndMonitoringLoop();
 #if 0
                        if ( m_bBSPPlugin ) {
@@ -744,7 +746,7 @@ void CWatchBSP::RoutineProcessing(){
                                                        StringOutputStream msg;
                                                        msg << "Failed to execute the following command: " << cmd.c_str() << cmdline.c_str();
                                                        globalOutputStream() << msg.c_str();
-                                                       gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ),  msg.c_str(), "Build monitoring", eMB_OK, eMB_ICONERROR );
+                                                       MainFrame_getWindow().alert( msg.c_str(), "Build monitoring", ui::alert_type::OK, ui::alert_icon::Error );
                                                }
                                        }
                                        EndMonitoringLoop();
@@ -772,8 +774,8 @@ void CWatchBSP::DoMonitoringLoop( GPtrArray *pCmd, const char *sBSPName ){
        if ( m_eState != EIdle ) {
                globalOutputStream() << "WatchBSP got a monitoring request while not idling...\n";
                // prompt the user, should we cancel the current process and go ahead?
-               if ( gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ),  "I am already monitoring a Build process.\nDo you want me to override and start a new compilation?",
-                                                        "Build process monitoring", eMB_YESNO ) == eIDYES ) {
+               if ( MainFrame_getWindow().alert( "I am already monitoring a Build process.\nDo you want me to override and start a new compilation?",
+                                                        "Build process monitoring", ui::alert_type::YESNO ) == ui::alert_response::YES ) {
                        // disconnect and set EIdle state
                        Reset();
                }
index 989c1196309ef7ea40f9fc65cffc1802dba0e4bf..d30d0e3c0da30b989473e5761e9045e31f8c6981 100644 (file)
@@ -22,7 +22,7 @@
 #include "windowobservers.h"
 
 #include <vector>
-#include <gdk/gdkevents.h>
+#include <gdk/gdk.h>
 #include "generic/bitfield.h"
 
 namespace
@@ -50,7 +50,7 @@ inline void WindowObservers_OnModifierUp( WindowObservers& observers, ModifierFl
 
 #include <gdk/gdkkeysyms.h>
 
-gboolean selection_modifier_key_press( GtkWidget* widget, GdkEventKey* event, WindowObservers& observers ){
+gboolean selection_modifier_key_press( ui::Widget widget, GdkEventKey* event, WindowObservers& observers ){
        switch ( event->keyval )
        {
        case GDK_Alt_L:
@@ -72,7 +72,7 @@ gboolean selection_modifier_key_press( GtkWidget* widget, GdkEventKey* event, Wi
        return FALSE;
 }
 
-gboolean selection_modifier_key_release( GtkWidget* widget, GdkEventKey* event, WindowObservers& observers ){
+gboolean selection_modifier_key_release( ui::Widget widget, GdkEventKey* event, WindowObservers& observers ){
        switch ( event->keyval )
        {
        case GDK_Alt_L:
@@ -109,21 +109,21 @@ void WindowObservers_UpdateModifiers( WindowObservers& observers, ModifierFlags
        WindowObservers_UpdateModifier( observers, modifiers, c_modifierControl );
 }
 
-gboolean modifiers_button_press( GtkWidget* widget, GdkEventButton* event, WindowObservers* observers ){
+gboolean modifiers_button_press( ui::Widget widget, GdkEventButton* event, WindowObservers* observers ){
        if ( event->type == GDK_BUTTON_PRESS ) {
                WindowObservers_UpdateModifiers( *observers, modifiers_for_state( event->state ) );
        }
        return FALSE;
 }
 
-gboolean modifiers_button_release( GtkWidget* widget, GdkEventButton* event, WindowObservers* observers ){
+gboolean modifiers_button_release( ui::Widget widget, GdkEventButton* event, WindowObservers* observers ){
        if ( event->type == GDK_BUTTON_RELEASE ) {
                WindowObservers_UpdateModifiers( *observers, modifiers_for_state( event->state ) );
        }
        return FALSE;
 }
 
-gboolean modifiers_motion( GtkWidget *widget, GdkEventMotion *event, WindowObservers* observers ){
+gboolean modifiers_motion( ui::Widget widget, GdkEventMotion *event, WindowObservers* observers ){
        WindowObservers_UpdateModifiers( *observers, modifiers_for_state( event->state ) );
        return FALSE;
 }
@@ -139,12 +139,12 @@ void GlobalWindowObservers_add( WindowObserver* observer ){
        g_window_observers.push_back( observer );
 }
 
-void GlobalWindowObservers_connectTopLevel( GtkWindow* window ){
+void GlobalWindowObservers_connectTopLevel( ui::Window window ){
        g_signal_connect( G_OBJECT( window ), "key_press_event", G_CALLBACK( selection_modifier_key_press ), &g_window_observers );
        g_signal_connect( G_OBJECT( window ), "key_release_event", G_CALLBACK( selection_modifier_key_release ), &g_window_observers );
 }
 
-void GlobalWindowObservers_connectWidget( GtkWidget* widget ){
+void GlobalWindowObservers_connectWidget( ui::Widget widget ){
        g_signal_connect( G_OBJECT( widget ), "button_press_event", G_CALLBACK( modifiers_button_press ), &g_window_observers );
        g_signal_connect( G_OBJECT( widget ), "button_release_event", G_CALLBACK( modifiers_button_release ), &g_window_observers );
        g_signal_connect( G_OBJECT( widget ), "motion_notify_event", G_CALLBACK( modifiers_motion ), &g_window_observers );
index eab5fe5989e4606a5b2a828a3cdf87fedf808262..9785d9dc9df3d552ed6a2b41e93c74bf27e612ec 100644 (file)
 
 #include "windowobserver.h"
 
-#include <gdk/gdktypes.h>
+#include <gdk/gdk.h>
+#include <uilib/uilib.h>
 
 #include "math/vector.h"
 
 class WindowObserver;
 void GlobalWindowObservers_add( WindowObserver* observer );
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-void GlobalWindowObservers_connectWidget( GtkWidget* widget );
-void GlobalWindowObservers_connectTopLevel( GtkWindow* window );
+void GlobalWindowObservers_connectWidget( ui::Widget widget );
+void GlobalWindowObservers_connectTopLevel( ui::Window window );
 
 inline ButtonIdentifier button_for_button( unsigned int button ){
        switch ( button )
index a30303f4c8273bee5cbb4c57fc33f6719a19b4cb..b51f3cd305e1a38a013ec7d2809375d06b1405cb 100644 (file)
@@ -68,8 +68,7 @@ class IGL2DWindow;
 class ISAXHandler
 {
 public:
-virtual void Release(){
-}
+virtual void Release(){}
 virtual void saxStartElement( message_info_t* ctx, const xmlChar* name, const xmlChar** attrs ) = 0;
 virtual void saxEndElement( message_info_t* ctx, const xmlChar* name ) = 0;
 virtual void saxCharacters( message_info_t* ctx, const xmlChar* ch, int len ) = 0;
index b094b7744d5f034f57216469357dc65d59068734..1810607584b4c53def8c8d36dfb97a9c481ec9a0 100644 (file)
@@ -39,8 +39,9 @@
 #include "image.h"
 #include "gtkutil/messagebox.h"
 
-#include <gtk/gtklabel.h>
-#include <gtk/gtkmenuitem.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
+#include <gdk/gdkkeysyms.h>
 
 #include "generic/callback.h"
 #include "string/string.h"
@@ -548,7 +549,7 @@ void WXY_Print(){
        unsigned char* img;
        const char* filename;
 
-       filename = file_dialog( GTK_WIDGET( MainFrame_getWindow() ), FALSE, "Save Image", 0, FILTER_BMP );
+       filename = ui::file_dialog( GTK_WIDGET( MainFrame_getWindow() ), FALSE, "Save Image", 0, FILTER_BMP );
        if ( !filename ) {
                return;
        }
@@ -705,12 +706,12 @@ bool XYWnd::chaseMouseMotion( int pointx, int pointy ){
 Shader* XYWnd::m_state_selected = 0;
 
 void xy_update_xor_rectangle( XYWnd& self, rect_t area ){
-       if ( GTK_WIDGET_VISIBLE( self.GetWidget() ) ) {
+       if ( gtk_widget_get_visible( self.GetWidget() ) ) {
                self.m_XORRectangle.set( rectangle_from_area( area.min, area.max, self.Width(), self.Height() ) );
        }
 }
 
-gboolean xywnd_button_press( GtkWidget* widget, GdkEventButton* event, XYWnd* xywnd ){
+gboolean xywnd_button_press( ui::Widget widget, GdkEventButton* event, XYWnd* xywnd ){
        if ( event->type == GDK_BUTTON_PRESS ) {
                g_pParentWnd->SetActiveXY( xywnd );
 
@@ -721,7 +722,7 @@ gboolean xywnd_button_press( GtkWidget* widget, GdkEventButton* event, XYWnd* xy
        return FALSE;
 }
 
-gboolean xywnd_button_release( GtkWidget* widget, GdkEventButton* event, XYWnd* xywnd ){
+gboolean xywnd_button_release( ui::Widget widget, GdkEventButton* event, XYWnd* xywnd ){
        if ( event->type == GDK_BUTTON_RELEASE ) {
                xywnd->XY_MouseUp( static_cast<int>( event->x ), static_cast<int>( event->y ), buttons_for_event_button( event ) );
 
@@ -730,7 +731,7 @@ gboolean xywnd_button_release( GtkWidget* widget, GdkEventButton* event, XYWnd*
        return FALSE;
 }
 
-gboolean xywnd_focus_in( GtkWidget* widget, GdkEventFocus* event, XYWnd* xywnd ){
+gboolean xywnd_focus_in( ui::Widget widget, GdkEventFocus* event, XYWnd* xywnd ){
        if ( event->type == GDK_FOCUS_CHANGE ) {
                if ( event->in ) {
                        g_pParentWnd->SetActiveXY( xywnd );
@@ -746,7 +747,7 @@ void xywnd_motion( gdouble x, gdouble y, guint state, void* data ){
        reinterpret_cast<XYWnd*>( data )->XY_MouseMoved( static_cast<int>( x ), static_cast<int>( y ), buttons_for_state( state ) );
 }
 
-gboolean xywnd_wheel_scroll( GtkWidget* widget, GdkEventScroll* event, XYWnd* xywnd ){
+gboolean xywnd_wheel_scroll( ui::Widget widget, GdkEventScroll* event, XYWnd* xywnd ){
        if ( event->direction == GDK_SCROLL_UP ) {
                XYWnd_ZoomIn( xywnd );
        }
@@ -756,7 +757,7 @@ gboolean xywnd_wheel_scroll( GtkWidget* widget, GdkEventScroll* event, XYWnd* xy
        return FALSE;
 }
 
-gboolean xywnd_size_allocate( GtkWidget* widget, GtkAllocation* allocation, XYWnd* xywnd ){
+gboolean xywnd_size_allocate( ui::Widget widget, GtkAllocation* allocation, XYWnd* xywnd ){
        xywnd->m_nWidth = allocation->width;
        xywnd->m_nHeight = allocation->height;
        xywnd->updateProjection();
@@ -764,7 +765,7 @@ gboolean xywnd_size_allocate( GtkWidget* widget, GtkAllocation* allocation, XYWn
        return FALSE;
 }
 
-gboolean xywnd_expose( GtkWidget* widget, GdkEventExpose* event, XYWnd* xywnd ){
+gboolean xywnd_expose( ui::Widget widget, GdkEventExpose* event, XYWnd* xywnd ){
        if ( glwidget_make_current( xywnd->GetWidget() ) != FALSE ) {
                if ( Map_Valid( g_map ) && ScreenUpdates_Enabled() ) {
                        GlobalOpenGL_debugAssertNoErrors();
@@ -826,10 +827,10 @@ XYWnd::XYWnd() :
        m_window_observer->setRectangleDrawCallback( ReferenceCaller1<XYWnd, rect_t, xy_update_xor_rectangle>( *this ) );
        m_window_observer->setView( m_view );
 
-       gtk_widget_ref( m_gl_widget );
+       g_object_ref( m_gl_widget );
 
        gtk_widget_set_events( m_gl_widget, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK );
-       GTK_WIDGET_SET_FLAGS( m_gl_widget, GTK_CAN_FOCUS );
+       gtk_widget_set_can_focus( m_gl_widget, true );
 
        m_sizeHandler = g_signal_connect( G_OBJECT( m_gl_widget ), "size_allocate", G_CALLBACK( xywnd_size_allocate ), this );
        m_exposeHandler = g_signal_connect( G_OBJECT( m_gl_widget ), "expose_event", G_CALLBACK( xywnd_expose ), this );
@@ -865,7 +866,7 @@ XYWnd::~XYWnd(){
        g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_sizeHandler );
        g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_exposeHandler );
 
-       gtk_widget_unref( m_gl_widget );
+       g_object_unref( m_gl_widget );
 
        m_window_observer->release();
 }
@@ -944,12 +945,12 @@ void XYWnd::Clipper_Crosshair_OnMouseMoved( int x, int y ){
        if ( ClipMode() && GlobalClipPoints_Find( mousePosition, (VIEWTYPE)m_viewType, m_fScale ) != 0 ) {
                GdkCursor *cursor;
                cursor = gdk_cursor_new( GDK_CROSSHAIR );
-               gdk_window_set_cursor( m_gl_widget->window, cursor );
+               gdk_window_set_cursor( gtk_widget_get_window(m_gl_widget), cursor );
                gdk_cursor_unref( cursor );
        }
        else
        {
-               gdk_window_set_cursor( m_gl_widget->window, 0 );
+               gdk_window_set_cursor( gtk_widget_get_window(m_gl_widget), 0 );
        }
 }
 
@@ -1058,15 +1059,15 @@ void XYWnd::NewBrushDrag( int x, int y ){
                                                                "textures/common/caulk" : TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ) );
 }
 
-void entitycreate_activated( GtkWidget* item ){
+void entitycreate_activated( ui::Widget item ){
        scene::Node* world_node = Map_FindWorldspawn( g_map );
-       const char* entity_name = gtk_label_get_text( GTK_LABEL( GTK_BIN( item )->child ) );
+       const char* entity_name = gtk_label_get_text( GTK_LABEL( gtk_bin_get_child(GTK_BIN( item )) ) );
 
        if ( !( world_node && string_equal( entity_name, "worldspawn" ) ) ) {
                g_pParentWnd->ActiveXY()->OnEntityCreate( entity_name );
        }
        else {
-               GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( MainFrame_getWindow() ), "There's already a worldspawn in your map!"
+               GlobalRadiant().m_pfnMessageBox( MainFrame_getWindow(), "There's already a worldspawn in your map!"
                                                                                                                                                          "",
                                                                                 "Info",
                                                                                 eMB_OK,
@@ -1075,7 +1076,7 @@ void entitycreate_activated( GtkWidget* item ){
 }
 
 void EntityClassMenu_addItem( GtkMenu* menu, const char* name ){
-       GtkMenuItem* item = GTK_MENU_ITEM( gtk_menu_item_new_with_label( name ) );
+       GtkMenuItem* item = ui::MenuItem( name );
        g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( entitycreate_activated ), item );
        gtk_widget_show( GTK_WIDGET( item ) );
        menu_add_item( menu, item );
@@ -1105,11 +1106,11 @@ void visit( EntityClass* e ){
        m_previous = e->name();
 }
 void pushMenu( const CopiedString& name ){
-       GtkMenuItem* item = GTK_MENU_ITEM( gtk_menu_item_new_with_label( name.c_str() ) );
+       GtkMenuItem* item = ui::MenuItem( name.c_str() );
        gtk_widget_show( GTK_WIDGET( item ) );
        container_add_widget( GTK_CONTAINER( m_stack.back().first ), GTK_WIDGET( item ) );
 
-       GtkMenu* submenu = GTK_MENU( gtk_menu_new() );
+       GtkMenu* submenu = ui::Menu();
        gtk_menu_item_set_submenu( item, GTK_WIDGET( submenu ) );
 
        m_stack.push_back( MenuPair( submenu, name ) );
@@ -1152,7 +1153,7 @@ void XYWnd::OnContextMenu(){
        }
 
        if ( m_mnuDrop == 0 ) { // first time, load it up
-               GtkMenu* menu = m_mnuDrop = GTK_MENU( gtk_menu_new() );
+               GtkMenu* menu = m_mnuDrop = ui::Menu();
 
                EntityClassMenuInserter inserter( menu );
                GlobalEntityClassManager().forEach( inserter );
@@ -1172,7 +1173,7 @@ void XYWnd_moveDelta( int x, int y, unsigned int state, void* data ){
        reinterpret_cast<XYWnd*>( data )->Scroll( -x, y );
 }
 
-gboolean XYWnd_Move_focusOut( GtkWidget* widget, GdkEventFocus* event, XYWnd* xywnd ){
+gboolean XYWnd_Move_focusOut( ui::Widget widget, GdkEventFocus* event, XYWnd* xywnd ){
        xywnd->Move_End();
        return FALSE;
 }
@@ -1182,13 +1183,13 @@ void XYWnd::Move_Begin(){
                Move_End();
        }
        m_move_started = true;
-       g_xywnd_freezePointer.freeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow(), XYWnd_moveDelta, this );
+       g_xywnd_freezePointer.freeze_pointer( m_parent  ? m_parent : MainFrame_getWindow(), XYWnd_moveDelta, this );
        m_move_focusOut = g_signal_connect( G_OBJECT( m_gl_widget ), "focus_out_event", G_CALLBACK( XYWnd_Move_focusOut ), this );
 }
 
 void XYWnd::Move_End(){
        m_move_started = false;
-       g_xywnd_freezePointer.unfreeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow() );
+       g_xywnd_freezePointer.unfreeze_pointer( m_parent ? m_parent : MainFrame_getWindow() );
        g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_move_focusOut );
 }
 
@@ -1217,7 +1218,7 @@ void XYWnd_zoomDelta( int x, int y, unsigned int state, void* data ){
        }
 }
 
-gboolean XYWnd_Zoom_focusOut( GtkWidget* widget, GdkEventFocus* event, XYWnd* xywnd ){
+gboolean XYWnd_Zoom_focusOut( ui::Widget widget, GdkEventFocus* event, XYWnd* xywnd ){
        xywnd->Zoom_End();
        return FALSE;
 }
@@ -1228,13 +1229,13 @@ void XYWnd::Zoom_Begin(){
        }
        m_zoom_started = true;
        g_dragZoom = 0;
-       g_xywnd_freezePointer.freeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow(), XYWnd_zoomDelta, this );
+       g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), XYWnd_zoomDelta, this );
        m_zoom_focusOut = g_signal_connect( G_OBJECT( m_gl_widget ), "focus_out_event", G_CALLBACK( XYWnd_Zoom_focusOut ), this );
 }
 
 void XYWnd::Zoom_End(){
        m_zoom_started = false;
-       g_xywnd_freezePointer.unfreeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow() );
+       g_xywnd_freezePointer.unfreeze_pointer( m_parent ? m_parent : MainFrame_getWindow() );
        g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_zoom_focusOut );
 }
 
@@ -1255,7 +1256,7 @@ void XYWnd::SetViewType( VIEWTYPE viewType ){
        m_viewType = viewType;
        updateModelview();
 
-       if ( m_parent != 0 ) {
+       if ( m_parent ) {
                gtk_window_set_title( m_parent, ViewType_getTitle( m_viewType ) );
        }
 }
@@ -1485,12 +1486,12 @@ void XYWnd::XY_DisableBackground( void ){
 void WXY_BackgroundSelect( void ){
        bool brushesSelected = Scene_countSelectedBrushes( GlobalSceneGraph() ) != 0;
        if ( !brushesSelected ) {
-               gtk_MessageBox( 0, "You have to select some brushes to get the bounding box for.\n",
-                                               "No selection", eMB_OK, eMB_ICONERROR );
+               ui::root.alert( "You have to select some brushes to get the bounding box for.\n",
+                                               "No selection", ui::alert_type::OK, ui::alert_icon::Error );
                return;
        }
 
-       const char *filename = file_dialog( GTK_WIDGET( MainFrame_getWindow() ), TRUE, "Background Image", NULL, NULL );
+       const char *filename = MainFrame_getWindow().file_dialog( TRUE, "Background Image", NULL, NULL );
        g_pParentWnd->ActiveXY()->XY_DisableBackground();
        if ( filename ) {
                g_pParentWnd->ActiveXY()->XY_LoadBackgroundImage( filename );
@@ -2537,19 +2538,19 @@ void ToggleShowGrid(){
 
 ToggleShown g_xy_top_shown( true );
 
-void XY_Top_Shown_Construct( GtkWindow* parent ){
+void XY_Top_Shown_Construct( ui::Window parent ){
        g_xy_top_shown.connect( GTK_WIDGET( parent ) );
 }
 
 ToggleShown g_yz_side_shown( false );
 
-void YZ_Side_Shown_Construct( GtkWindow* parent ){
+void YZ_Side_Shown_Construct( ui::Window parent ){
        g_yz_side_shown.connect( GTK_WIDGET( parent ) );
 }
 
 ToggleShown g_xz_front_shown( false );
 
-void XZ_Front_Shown_Construct( GtkWindow* parent ){
+void XZ_Front_Shown_Construct( ui::Window parent ){
        g_xz_front_shown.connect( GTK_WIDGET( parent ) );
 }
 
@@ -2744,14 +2745,14 @@ void XYWindow_Construct(){
        GlobalToggles_insert( "ToggleView", ToggleShown::ToggleCaller( g_xy_top_shown ), ToggleItem::AddCallbackCaller( g_xy_top_shown.m_item ), Accelerator( 'V', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
        GlobalToggles_insert( "ToggleSideView", ToggleShown::ToggleCaller( g_yz_side_shown ), ToggleItem::AddCallbackCaller( g_yz_side_shown.m_item ) );
        GlobalToggles_insert( "ToggleFrontView", ToggleShown::ToggleCaller( g_xz_front_shown ), ToggleItem::AddCallbackCaller( g_xz_front_shown.m_item ) );
-       GlobalCommands_insert( "NextView", FreeCaller<XY_Next>(), Accelerator( GDK_Tab, (GdkModifierType)GDK_CONTROL_MASK ) );
-       GlobalCommands_insert( "ZoomIn", FreeCaller<XY_ZoomIn>(), Accelerator( GDK_Delete ) );
-       GlobalCommands_insert( "ZoomOut", FreeCaller<XY_ZoomOut>(), Accelerator( GDK_Insert ) );
-       GlobalCommands_insert( "ViewTop", FreeCaller<XY_Top>(), Accelerator( GDK_KP_Home ) );
-       GlobalCommands_insert( "ViewSide", FreeCaller<XY_Side>(), Accelerator( GDK_KP_Page_Down ) );
-       GlobalCommands_insert( "ViewFront", FreeCaller<XY_Front>(), Accelerator( GDK_KP_End ) );
+       GlobalCommands_insert( "NextView", FreeCaller<XY_Next>(), Accelerator( GDK_KEY_Tab, (GdkModifierType)GDK_CONTROL_MASK ) );
+       GlobalCommands_insert( "ZoomIn", FreeCaller<XY_ZoomIn>(), Accelerator( GDK_KEY_Delete ) );
+       GlobalCommands_insert( "ZoomOut", FreeCaller<XY_ZoomOut>(), Accelerator( GDK_KEY_Insert ) );
+       GlobalCommands_insert( "ViewTop", FreeCaller<XY_Top>(), Accelerator( GDK_KEY_KP_Home ) );
+       GlobalCommands_insert( "ViewSide", FreeCaller<XY_Side>(), Accelerator( GDK_KEY_KP_Page_Down ) );
+       GlobalCommands_insert( "ViewFront", FreeCaller<XY_Front>(), Accelerator( GDK_KEY_KP_End ) );
        GlobalCommands_insert( "Zoom100", FreeCaller<XY_Zoom100>() );
-       GlobalCommands_insert( "CenterXYView", FreeCaller<XY_Focus>(), Accelerator( GDK_Tab, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+       GlobalCommands_insert( "CenterXYView", FreeCaller<XY_Focus>(), Accelerator( GDK_KEY_Tab, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
 
        GlobalPreferenceSystem().registerPreference( "ClipCaulk", BoolImportStringCaller( g_clip_useCaulk ), BoolExportStringCaller( g_clip_useCaulk ) );
 
index cbf37b430f1a0bdfb496f79faa279f8582e928a4..66709784af2ba5bcfdf93d1b257949b27e9b81c9 100644 (file)
@@ -40,7 +40,6 @@ namespace scene
 {
 class Node;
 }
-typedef struct _GtkWindow GtkWindow;
 typedef struct _GtkMenu GtkMenu;
 
 
@@ -65,21 +64,21 @@ inline const char* ViewType_getTitle( VIEWTYPE viewtype ){
 
 class XYWnd
 {
-GtkWidget* m_gl_widget;
+ui::Widget m_gl_widget;
 guint m_sizeHandler;
 guint m_exposeHandler;
 
 DeferredDraw m_deferredDraw;
 DeferredMotion m_deferred_motion;
 public:
-GtkWindow* m_parent;
+ui::Window m_parent;
 XYWnd();
 ~XYWnd();
 
 void queueDraw(){
        m_deferredDraw.draw();
 }
-GtkWidget* GetWidget(){
+ui::Widget GetWidget(){
        return m_gl_widget;
 }
 
@@ -281,10 +280,9 @@ extern xywindow_globals_t g_xywindow_globals;
 
 VIEWTYPE GlobalXYWnd_getCurrentViewType();
 
-typedef struct _GtkWindow GtkWindow;
-void XY_Top_Shown_Construct( GtkWindow* parent );
-void YZ_Side_Shown_Construct( GtkWindow* parent );
-void XZ_Front_Shown_Construct( GtkWindow* parent );
+void XY_Top_Shown_Construct( ui::Window parent );
+void YZ_Side_Shown_Construct( ui::Window parent );
+void XZ_Front_Shown_Construct( ui::Window parent );
 
 void XYWindow_Construct();
 void XYWindow_Destroy();