From 69b4f74e6c95e22d6c6ce10d0e137c875fd83cc4 Mon Sep 17 00:00:00 2001 From: TimePath Date: Fri, 29 Dec 2017 22:39:44 +1100 Subject: [PATCH] GTK: wrap GTK_WIDGET --- contrib/brushexport/callbacks.cpp | 44 +++++------ contrib/brushexport/callbacks.h | 12 +-- contrib/camera/dialogs.cpp | 4 +- contrib/gtkgensurf/bitmap.cpp | 2 +- contrib/gtkgensurf/gendlgs.cpp | 96 ++++++++++++------------ contrib/prtview/ConfigDialog.cpp | 12 +-- libs/gtkutil/accelerator.cpp | 4 +- libs/gtkutil/cursor.cpp | 2 +- libs/gtkutil/dialog.cpp | 12 +-- libs/gtkutil/menu.cpp | 4 +- libs/gtkutil/messagebox.cpp | 8 +- libs/gtkutil/nonmodal.cpp | 12 +-- libs/gtkutil/paned.cpp | 12 +-- libs/gtkutil/toolbar.cpp | 8 +- libs/gtkutil/window.cpp | 6 +- libs/uilib/uilib.h | 3 + radiant/build.cpp | 10 +-- radiant/commands.cpp | 20 ++--- radiant/dialog.cpp | 18 ++--- radiant/entity.cpp | 4 +- radiant/entityinspector.cpp | 66 ++++++++-------- radiant/entitylist.cpp | 2 +- radiant/gtkdlgs.cpp | 68 ++++++++--------- radiant/mainframe.cpp | 48 ++++++------ radiant/map.cpp | 14 ++-- radiant/mru.cpp | 12 +-- radiant/patchdialog.cpp | 120 +++++++++++++++--------------- radiant/patchmanip.cpp | 28 +++---- radiant/pluginmenu.cpp | 6 +- radiant/plugintoolbar.cpp | 6 +- radiant/preferences.cpp | 4 +- radiant/select.cpp | 22 +++--- radiant/surfacedialog.cpp | 50 ++++++------- radiant/texwindow.cpp | 18 ++--- radiant/xywindow.cpp | 4 +- 35 files changed, 383 insertions(+), 378 deletions(-) diff --git a/contrib/brushexport/callbacks.cpp b/contrib/brushexport/callbacks.cpp index fd6a6000..c09ae137 100644 --- a/contrib/brushexport/callbacks.cpp +++ b/contrib/brushexport/callbacks.cpp @@ -13,12 +13,12 @@ void DestroyWindow(); namespace callbacks { -void OnDestroy( GtkWidget* w, gpointer data ){ +void OnDestroy( ui::Widget w, gpointer data ){ DestroyWindow(); } -void OnExportClicked( GtkButton* button, gpointer user_data ){ - ui::Widget window = lookup_widget( GTK_WIDGET( button ), "w_plugplug2" ); +void OnExportClicked( ui::Button button, gpointer user_data ){ + ui::Widget window = lookup_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 ) { @@ -30,7 +30,7 @@ void OnExportClicked( GtkButton* button, gpointer user_data ){ // get ignore list from ui std::set ignore; - GtkTreeView* view = GTK_TREE_VIEW( lookup_widget( GTK_WIDGET( button ), "t_materialist" ) ); + GtkTreeView* view = GTK_TREE_VIEW( lookup_widget( button , "t_materialist" ) ); ui::ListStore list = ui::ListStore(GTK_LIST_STORE( gtk_tree_view_get_model( view ) )); GtkTreeIter iter; @@ -51,7 +51,7 @@ void OnExportClicked( GtkButton* button, gpointer user_data ){ // collapse mode collapsemode mode = COLLAPSE_NONE; - GtkWidget* radio = lookup_widget( GTK_WIDGET( button ), "r_collapse" ); + GtkWidget* radio = lookup_widget( button , "r_collapse" ); ASSERT_NOTNULL( radio ); if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radio ) ) ) { @@ -59,14 +59,14 @@ void OnExportClicked( GtkButton* button, gpointer user_data ){ } else { - radio = lookup_widget( GTK_WIDGET( button ), "r_collapsebymaterial" ); + radio = lookup_widget( button , "r_collapsebymaterial" ); ASSERT_NOTNULL( radio ); if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radio ) ) ) { mode = COLLAPSE_BY_MATERIAL; } else { - radio = lookup_widget( GTK_WIDGET( button ), "r_nocollapse" ); + radio = lookup_widget( button , "r_nocollapse" ); ASSERT_NOTNULL( radio ); ASSERT_TRUE( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radio ) ) ); mode = COLLAPSE_NONE; @@ -74,7 +74,7 @@ void OnExportClicked( GtkButton* button, gpointer user_data ){ } // export materials? - GtkWidget* toggle = lookup_widget( GTK_WIDGET( button ), "t_exportmaterials" ); + GtkWidget* toggle = lookup_widget( button , "t_exportmaterials" ); ASSERT_NOTNULL( toggle ); bool exportmat = FALSE; @@ -84,7 +84,7 @@ void OnExportClicked( GtkButton* button, gpointer user_data ){ } // limit material names? - toggle = lookup_widget( GTK_WIDGET( button ), "t_limitmatnames" ); + toggle = lookup_widget( button , "t_limitmatnames" ); ASSERT_NOTNULL( toggle ); bool limitMatNames = FALSE; @@ -94,7 +94,7 @@ void OnExportClicked( GtkButton* button, gpointer user_data ){ } // create objects instead of groups? - toggle = lookup_widget( GTK_WIDGET( button ), "t_objects" ); + toggle = lookup_widget( button , "t_objects" ); ASSERT_NOTNULL( toggle ); bool objects = FALSE; @@ -107,20 +107,20 @@ void OnExportClicked( GtkButton* button, gpointer user_data ){ ExportSelection( ignore, mode, exportmat, path, limitMatNames, objects ); } -void OnAddMaterial( GtkButton* button, gpointer user_data ){ - GtkEntry* edit = GTK_ENTRY( lookup_widget( GTK_WIDGET( button ), "ed_materialname" ) ); +void OnAddMaterial( ui::Button button, gpointer user_data ){ + GtkEntry* edit = GTK_ENTRY( lookup_widget( button , "ed_materialname" ) ); ASSERT_NOTNULL( edit ); const gchar* name = gtk_entry_get_text( edit ); if ( g_utf8_strlen( name, -1 ) > 0 ) { - ui::ListStore list = ui::ListStore(GTK_LIST_STORE( gtk_tree_view_get_model( GTK_TREE_VIEW( lookup_widget( GTK_WIDGET( button ), "t_materialist" ) ) ) )); + ui::ListStore list = ui::ListStore(GTK_LIST_STORE( gtk_tree_view_get_model( GTK_TREE_VIEW( lookup_widget( button , "t_materialist" ) ) ) )); list.append(0, name); gtk_entry_set_text( edit, "" ); } } -void OnRemoveMaterial( GtkButton* button, gpointer user_data ){ - GtkTreeView* view = GTK_TREE_VIEW( lookup_widget( GTK_WIDGET( button ), "t_materialist" ) ); +void OnRemoveMaterial( ui::Button button, gpointer user_data ){ + GtkTreeView* view = GTK_TREE_VIEW( lookup_widget( button , "t_materialist" ) ); ui::ListStore list = ui::ListStore(GTK_LIST_STORE( gtk_tree_view_get_model( view ) )); GtkTreeSelection* sel = gtk_tree_view_get_selection( view ); @@ -130,17 +130,17 @@ void OnRemoveMaterial( GtkButton* button, gpointer user_data ){ } } -void OnExportMatClicked( GtkButton* button, gpointer user_data ){ - GtkWidget* toggleLimit = lookup_widget( GTK_WIDGET( button ), "t_limitmatnames" ); - GtkWidget* toggleObject = lookup_widget( GTK_WIDGET( button ), "t_objects" ); +void OnExportMatClicked( ui::Button button, gpointer user_data ){ + GtkWidget* toggleLimit = lookup_widget( button , "t_limitmatnames" ); + GtkWidget* toggleObject = lookup_widget( button , "t_objects" ); if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ) ) ) { - gtk_widget_set_sensitive( GTK_WIDGET( toggleLimit ), TRUE ); - gtk_widget_set_sensitive( GTK_WIDGET( toggleObject ), TRUE ); + gtk_widget_set_sensitive( toggleLimit , TRUE ); + gtk_widget_set_sensitive( toggleObject , TRUE ); } else { - gtk_widget_set_sensitive( GTK_WIDGET( toggleLimit ), FALSE ); - gtk_widget_set_sensitive( GTK_WIDGET( toggleObject ), FALSE ); + gtk_widget_set_sensitive( toggleLimit , FALSE ); + gtk_widget_set_sensitive( toggleObject , FALSE ); } } diff --git a/contrib/brushexport/callbacks.h b/contrib/brushexport/callbacks.h index eece65a1..ca4b9a14 100644 --- a/contrib/brushexport/callbacks.h +++ b/contrib/brushexport/callbacks.h @@ -1,10 +1,12 @@ +#include + namespace callbacks { -void OnDestroy( GtkWidget *, gpointer ); -void OnExportClicked( GtkButton *, gpointer ); -void OnAddMaterial( GtkButton *, gpointer ); -void OnRemoveMaterial( GtkButton *, gpointer ); -void OnExportMatClicked( GtkButton * button, gpointer ); +void OnDestroy( ui::Widget, gpointer ); +void OnExportClicked( ui::Button, gpointer ); +void OnAddMaterial( ui::Button, gpointer ); +void OnRemoveMaterial( ui::Button, gpointer ); +void OnExportMatClicked( ui::Button button, gpointer ); } // callbacks diff --git a/contrib/camera/dialogs.cpp b/contrib/camera/dialogs.cpp index b8f65689..e2366239 100644 --- a/contrib/camera/dialogs.cpp +++ b/contrib/camera/dialogs.cpp @@ -611,7 +611,7 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){ // Select the last item in the listbox li = g_list_last( GTK_LIST( GTK_COMBO( g_pPathListCombo )->list )->children ); - gtk_list_select_child( GTK_LIST( GTK_COMBO( g_pPathListCombo )->list ), GTK_WIDGET( li->data ) ); + gtk_list_select_child( GTK_LIST( GTK_COMBO( g_pPathListCombo )->list ), li->data ); // If this was the first one, refresh the event list if ( GetCurrentCam()->GetCam()->numTargets() == 1 ) { @@ -675,7 +675,7 @@ void RefreshCamListCombo( void ){ combo_cam = firstCam; while ( li && combo_cam ) { if ( combo_cam == GetCurrentCam() ) { - gtk_list_select_child( GTK_LIST( GTK_COMBO( g_pCamListCombo )->list ), GTK_WIDGET( li->data ) ); + gtk_list_select_child( GTK_LIST( GTK_COMBO( g_pCamListCombo )->list ), li->data ); break; } li = li->next; diff --git a/contrib/gtkgensurf/bitmap.cpp b/contrib/gtkgensurf/bitmap.cpp index 2ca7e6b4..68eea5c2 100644 --- a/contrib/gtkgensurf/bitmap.cpp +++ b/contrib/gtkgensurf/bitmap.cpp @@ -438,7 +438,7 @@ bool OpenBitmap(){ if ( g_pWnd ) { gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_file" ) ), gbmp.name ); - gtk_widget_set_sensitive( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_reload" ) ), + gtk_widget_set_sensitive( g_object_get_data( G_OBJECT( g_pWnd , "bmp_reload" ) ), strlen( gbmp.name ) ? TRUE : FALSE ); UpdatePreview( true ); diff --git a/contrib/gtkgensurf/gendlgs.cpp b/contrib/gtkgensurf/gendlgs.cpp index 00978939..a6545f34 100644 --- a/contrib/gtkgensurf/gendlgs.cpp +++ b/contrib/gtkgensurf/gendlgs.cpp @@ -32,7 +32,7 @@ //#define BUFF_SIZE 32768 #define ENABLE_WIDGET( name,enable ) \ - gtk_widget_set_sensitive( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), ( name ) ) ), ( enable ) ) + gtk_widget_set_sensitive( g_object_get_data( G_OBJECT( g_pWnd , ( name ) ) ), ( enable ) ) #define CHECK_WIDGET( name,check ) \ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( g_object_get_data( G_OBJECT( g_pWnd ), name ) ), check ) @@ -111,12 +111,12 @@ static void SetupControls(){ case EXTENTS_TAB: if ( Game != QUAKE3 ) { - gtk_widget_hide( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "use_patches" ) ) ); + gtk_widget_hide( g_object_get_data( G_OBJECT( g_pWnd , "use_patches" ) ) ); ENABLE_WIDGET( "use_patches", FALSE ); } else { - gtk_widget_show( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "use_patches" ) ) ); + gtk_widget_show( g_object_get_data( G_OBJECT( g_pWnd , "use_patches" ) ) ); ENABLE_WIDGET( "use_patches", TRUE ); } @@ -316,7 +316,7 @@ static void SetDlgValues( int tab ){ Decimate ); if ( Game == QUAKE3 && UsePatches ) { - gtk_widget_set_sensitive( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "decimate" ) ), FALSE ); + gtk_widget_set_sensitive( g_object_get_data( G_OBJECT( g_pWnd , "decimate" ) ), FALSE ); if ( NH % 2 ) { NH++; @@ -363,7 +363,7 @@ static void SetDlgValues( int tab ){ } else { - gtk_widget_set_sensitive( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "decimate" ) ), TRUE ); + gtk_widget_set_sensitive( g_object_get_data( G_OBJECT( g_pWnd , "decimate" ) ), TRUE ); gpointer spin = g_object_get_data( G_OBJECT( g_pWnd ), "nh" ); GtkAdjustment *adj = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); @@ -718,7 +718,7 @@ static void main_about( GtkWidget *widget, gpointer data ){ } static void main_go( GtkWidget *widget, gpointer data ){ - GtkWidget *notebook = GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "notebook" ) ); + GtkWidget *notebook = g_object_get_data( G_OBJECT( g_pWnd , "notebook" ) ); char Text[256]; ReadDlgValues( current_tab ); @@ -1100,19 +1100,19 @@ void create_tooltips(){ // Main gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "go" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "go" ) ), "Accept all input and generate a surface in Q3Radiant", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "open" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "open" ) ), "Open a previously saved GenSurf settings file.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "save" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "save" ) ), "Save all settings to a file.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "defaults" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "defaults" ) ), "Restore default values from DEFAULTS.SRF. If this file does not exist, GenSurf " "initializes all input parameters to reasonable values. You can create your own " "default surface by setting all parameters to your liking, then saving a settings " @@ -1120,105 +1120,105 @@ void create_tooltips(){ "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "main_preview" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "main_preview" ) ), "View a wire-frame representation of the surface", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "main_antialiasing" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "main_antialiasing" ) ), "The lines in the preview window are antialiased for better quality", "" ); // General tab gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( wave_radios[0] ), + wave_radios[0] , "Builds a surface with alternating hills and valleys. Uses the general form Z=cos(X) " "x sin(Y)", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( wave_radios[1] ), + wave_radios[1] , "Builds a surface with ridges parallel to the vertical axis.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( wave_radios[2] ), + wave_radios[2] , "Builds a surface with ridges parallel to the horizontal axis.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( wave_radios[3] ), + wave_radios[3] , "Builds a map from a bitmap image representing a contour plot. Click the \"Bitmap\" " "tab to select the image. GenSurf only supports 256-color (8 bit) " "bitmaps. GenSurf will work with any 256-color bitmap, but gray scale bitmaps are a bit " "more intuitive.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( wave_radios[4] ), + wave_radios[4] , "Builds a random surface using the Plasma Cloud technique. Variance is controlled " "by the Roughness input. To build a surface with completely random values not " "dependent on neighboring vertices, use one of the other waveforms with 0 amplitude.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "wavelength" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "wavelength" ) ), "Enter the wavelength (distance between crests). NOTE: Wavelengths equal to the grid " "size or 2 times the grid size will result in 0 amplitudes. For best results, the " "wavelength value should be at least 4 times the grid size (extents divided by the " "number of divisions", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "amplitude" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "amplitude" ) ), "Enter the height of hills/ridges.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "roughness" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "roughness" ) ), "Enter the roughness value (noise) for the surface. For fractal surfaces, this value " "is used as a variance in the fractal calculations.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "random" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "random" ) ), "Seed value for the pseudo-random number generator.", "" ); // Extents tab gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "hmin" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "hmin" ) ), "Minimum horizontal coordinate of the surface, i.e. X for a surface parallel to " "the XY or XZ planes, Y for a surface parallel to the YZ plane. For best results, " "the extents (maximum-minimum values) in a given direction should be evenly " "divisible by the number of divisions in that direction.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "hmax" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "hmax" ) ), "Maximum horizontal coordinate of the surface, i.e. X for a surface parallel to " "the XY or XZ planes, Y for a surface parallel to the YZ plane. For best results, " "the extents (maximum-minimum values) in a given direction should be evenly " "divisible by the number of divisions in that direction.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "vmin" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "vmin" ) ), "Minimum vertical coordinate of the surface, i.e. Y for a surface parallel to " "the XY plane, Z for a surface parallel to the XZ or YZ planes. For best results, " "the extents (maximum-minimum values) in a given direction should be evenly " "divisible by the number of divisions in that direction.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "vmax" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "vmax" ) ), "Maximum vertical coordinate of the surface, i.e. Y for a surface parallel to " "the XY plane, Z for a surface parallel to the XZ or YZ planes. For best results, " "the extents (maximum-minimum values) in a given direction should be evenly " "divisible by the number of divisions in that direction.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "nh" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "nh" ) ), "Number of divisions in the horizontal direction. For best results, the extents " "in a given direction should be evenly divisible by the number of divisions in " "that direction.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "nv" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "nv" ) ), "Number of divisions in the vertical direction. For best results, the extents " "in a given direction should be evenly divisible by the number of divisions in " "that direction.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "use_patches" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "use_patches" ) ), "Produce one or more curved patches in the shape of your selected surface rather " "than producing solid brushes. Depending on the size of your surface (and the " "user's graphic detail settings, which you cannot control), curved surfaces will " @@ -1226,7 +1226,7 @@ void create_tooltips(){ "concerning curved surfaces on the GenSurf web page before using this feature.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "decimate" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "decimate" ) ), "Use the slider to control the number of vertices discarded by GenSurf. For many " "surfaces, you can produce roughly the same shape surface with a high decimation " "value. This will generally result in a map with lower polygon counts (and better " @@ -1234,71 +1234,71 @@ void create_tooltips(){ "surfaces in Q3", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "z00" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "z00" ) ), "Enter the height of the surface at the lower left corner. This value will likely " "be modified unless \"Linear Borders\" is checked.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "z01" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "z01" ) ), "Enter the height of the surface at the upper left corner. This value will likely " "be modified unless \"Linear Borders\" is checked.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "z10" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "z10" ) ), "Enter the height of the surface at the lower right corner. This value will likely " "be modified unless \"Linear Borders\" is checked.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "z11" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "z11" ) ), "Enter the height of the surface at the upper right corner. This value will likely " "be modified unless \"Linear Borders\" is checked.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "linearborder" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "linearborder" ) ), "Restrict the edges of the surface to a straight line. This will help match up " "brush edges if you drop this surface into another map.", "" ); // Bitmap tab gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_file" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "bmp_file" ) ), "Type the name of an 8-bit bitmap image file, or click Browse to select an image " "from a list of those available on your system.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_file_browse" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "bmp_file_browse" ) ), "Select a bitmap image file from a list of those available on your system.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_reload" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "bmp_reload" ) ), "Reload the selected bitmap file after making changes in an external image editor.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_black" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "bmp_black" ) ), "Enter the value corresponding to color index 0 in the bitmap file. For gray scale " "images, color 0 is normally black.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_white" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "bmp_white" ) ), "Enter the value corresponding to color index 255 in the bitmap file. For gray scale " "images, color 255 is normally white.", "" ); // Fixpoints tab gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "fix_value" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "fix_value" ) ), "Enter a value for the selected vertex. This value will not be adjusted when applying " "a waveform or roughness to the surface. Unlock this vertex (so that it will be " "adjusted normally) by clicking \"Free\". This vertex will influence vertices within " "the \"Range affected\" of this vertex.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "fix_range" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "fix_range" ) ), "Enter the range away from the selected vertex that other vertices will be affected. " "Use 0 if you don't want other vertices to be influenced by the currently selected " "one. Note: this box is disabled if you've chosen the fractal generator, as it uses " "a completely different method for determining values.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "fix_rate" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "fix_rate" ) ), "Enter a rate of change for the surface affected by the fixed value. 0 gives a smooth " "sinusoidal curve, values less than 0 give progressively sharper spikes, and values " "greater than 0 take on a square shape. Values less than -30 or greater than 30 are " @@ -1306,32 +1306,32 @@ void create_tooltips(){ "you also specify a \"range affected\".", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "fix_free" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "fix_free" ) ), "Click this to free (unlock the value of) the currently selected vertex.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "fix_freeall" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "fix_freeall" ) ), "Click this to free (unlock the values of) all vertices.", "" ); // Texture tab gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "texture1" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "texture1" ) ), "Enter the name of the texture or shader used for the surface faces.", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "texture2" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "texture2" ) ), "Enter the name of the texture or shader used for faces other than the surface. Under " "normal circumstances this should be \"common/caulk\"", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "texture3" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "texture3" ) ), "Enter the name of the texture or shader used for \"steep\" surface faces, where \"steep\" " "is the angle specified below. If this entry is left blank or if the \"steep\" angle is 0, " "all surface faces will use the texture specified by \"Surface\".", "" ); gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), - GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "detail" ) ), + g_object_get_data( G_OBJECT( g_pWnd , "detail" ) ), "Check this box to use the detail content property on the generated brushes. Compile " "times will be considerably shorter if the detail property is used, though the surface " "will not block visibility at all. If you use the detail property, you should make sure " diff --git a/contrib/prtview/ConfigDialog.cpp b/contrib/prtview/ConfigDialog.cpp index c8090053..6e248977 100644 --- a/contrib/prtview/ConfigDialog.cpp +++ b/contrib/prtview/ConfigDialog.cpp @@ -123,7 +123,7 @@ static void SetClipText( GtkWidget* label ){ static void OnScroll2d( GtkAdjustment *adj, gpointer data ){ portals.width_2d = static_cast( gtk_adjustment_get_value(adj) ); - Set2DText( GTK_WIDGET( data ) ); + Set2DText( ui::Widget::from(data) ); Portals_shadersChanged(); SceneChangeNotify(); @@ -131,21 +131,21 @@ static void OnScroll2d( GtkAdjustment *adj, gpointer data ){ static void OnScroll3d( GtkAdjustment *adj, gpointer data ){ portals.width_3d = static_cast( gtk_adjustment_get_value(adj) ); - Set3DText( GTK_WIDGET( data ) ); + Set3DText( ui::Widget::from( data ) ); SceneChangeNotify(); } static void OnScrollTrans( GtkAdjustment *adj, gpointer data ){ portals.trans_3d = static_cast( gtk_adjustment_get_value(adj) ); - Set3DTransText( GTK_WIDGET( data ) ); + Set3DTransText( ui::Widget::from( data ) ); SceneChangeNotify(); } static void OnScrollClip( GtkAdjustment *adj, gpointer data ){ portals.clip_range = static_cast( gtk_adjustment_get_value(adj) ); - SetClipText( GTK_WIDGET( data ) ); + SetClipText( ui::Widget::from( data ) ); SceneChangeNotify(); } @@ -331,8 +331,8 @@ void DoConfigDialog(){ 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"); - zlist.connect("changed", G_CALLBACK(+[](GtkComboBox *self, void *) { - OnSelchangeZbuffer(GTK_WIDGET(self), GINT_TO_POINTER(gtk_combo_box_get_active(self))); + zlist.connect("changed", G_CALLBACK(+[](ui::ComboBox self, void *) { + OnSelchangeZbuffer(self, GINT_TO_POINTER(gtk_combo_box_get_active(self))); }), nullptr); table = ui::Table( 2, 2, FALSE ); diff --git a/libs/gtkutil/accelerator.cpp b/libs/gtkutil/accelerator.cpp index fcac228a..67d917bf 100644 --- a/libs/gtkutil/accelerator.cpp +++ b/libs/gtkutil/accelerator.cpp @@ -232,7 +232,7 @@ bool Buttons_press( ButtonMask& buttons, guint button, guint state ){ { ui::Window toplevel = *i; ASSERT_MESSAGE( window_has_accel( toplevel ), "ERROR" ); - ASSERT_MESSAGE( gtk_widget_is_toplevel( GTK_WIDGET(toplevel) ), "disabling accel for non-toplevel window" ); + ASSERT_MESSAGE( gtk_widget_is_toplevel( toplevel ), "disabling accel for non-toplevel window" ); gtk_window_remove_accel_group( toplevel, global_accel ); #if 0 globalOutputStream() << reinterpret_cast( toplevel ) << ": disabled global accelerators\n"; @@ -255,7 +255,7 @@ bool Buttons_release( ButtonMask& buttons, guint button, guint state ){ { ui::Window toplevel = *i; ASSERT_MESSAGE( !window_has_accel( toplevel ), "ERROR" ); - ASSERT_MESSAGE( gtk_widget_is_toplevel( GTK_WIDGET(toplevel) ), "enabling accel for non-toplevel window" ); + ASSERT_MESSAGE( gtk_widget_is_toplevel( toplevel ), "enabling accel for non-toplevel window" ); toplevel.add_accel_group( global_accel ); #if 0 globalOutputStream() << reinterpret_cast( toplevel ) << ": enabled global accelerators\n"; diff --git a/libs/gtkutil/cursor.cpp b/libs/gtkutil/cursor.cpp index 69e95e88..bb56fe61 100644 --- a/libs/gtkutil/cursor.cpp +++ b/libs/gtkutil/cursor.cpp @@ -97,7 +97,7 @@ void FreezePointer::freeze_pointer(ui::Window window, FreezePointer::MotionDelta GdkCursor* cursor = create_blank_cursor(); //GdkGrabStatus status = - gdk_pointer_grab( gtk_widget_get_window(GTK_WIDGET(window)), TRUE, mask, 0, cursor, GDK_CURRENT_TIME ); + gdk_pointer_grab( gtk_widget_get_window(window), TRUE, mask, 0, cursor, GDK_CURRENT_TIME ); gdk_cursor_unref( cursor ); Sys_GetCursorPos( window, &recorded_x, &recorded_y ); diff --git a/libs/gtkutil/dialog.cpp b/libs/gtkutil/dialog.cpp index 8fa34e65..c8267310 100644 --- a/libs/gtkutil/dialog.cpp +++ b/libs/gtkutil/dialog.cpp @@ -58,7 +58,7 @@ ui::Table create_dialog_table( unsigned int rows, unsigned int columns, unsigned ui::Button create_dialog_button( const char* label, GCallback func, gpointer data ){ auto button = ui::Button( label ); - gtk_widget_set_size_request( GTK_WIDGET( button ), 64, -1 ); + gtk_widget_set_size_request( button , 64, -1 ); button.show(); button.connect( "clicked", func, data ); return button; @@ -86,7 +86,7 @@ gboolean modal_dialog_delete( ui::Widget widget, GdkEvent* event, ModalDialog* d } EMessageBoxReturn modal_dialog_show( ui::Window window, ModalDialog& dialog ){ - gtk_grab_add( GTK_WIDGET( window ) ); + gtk_grab_add( window ); window.show(); dialog.loop = true; @@ -96,7 +96,7 @@ EMessageBoxReturn modal_dialog_show( ui::Window window, ModalDialog& dialog ){ } window.hide(); - gtk_grab_remove( GTK_WIDGET( window ) ); + gtk_grab_remove( window ); return dialog.ret; } @@ -118,11 +118,11 @@ ui::Window create_fixedsize_modal_dialog_window( ui::Window parent, const char* window_remove_minmax( window ); - //gtk_widget_set_size_request(GTK_WIDGET(window), width, height); + //gtk_widget_set_size_request(window, width, height); //gtk_window_set_default_size(window, width, height); //gtk_window_resize(window, width, height); //GdkGeometry geometry = { width, height, -1, -1, width, height, -1, -1, -1, -1, GDK_GRAVITY_STATIC, }; - //gtk_window_set_geometry_hints(window, GTK_WIDGET(window), &geometry, (GdkWindowHints)(GDK_HINT_POS|GDK_HINT_MIN_SIZE|GDK_HINT_BASE_SIZE)); + //gtk_window_set_geometry_hints(window, window, &geometry, (GdkWindowHints)(GDK_HINT_POS|GDK_HINT_MIN_SIZE|GDK_HINT_BASE_SIZE)); return window; } @@ -251,7 +251,7 @@ ui::Table DialogRow_new( const char* name, ui::Widget widget ){ gtk_table_set_col_spacings( table, 4 ); gtk_table_set_row_spacings( table, 0 ); - gtk_table_attach( table, GTK_WIDGET( DialogLabel_new( name ) ), 0, 1, 0, 1, + gtk_table_attach( table, DialogLabel_new( name ), 0, 1, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); diff --git a/libs/gtkutil/menu.cpp b/libs/gtkutil/menu.cpp index 6d71b23e..93638e34 100644 --- a/libs/gtkutil/menu.cpp +++ b/libs/gtkutil/menu.cpp @@ -40,7 +40,7 @@ void menu_add_item( ui::Menu menu, ui::MenuItem item ){ ui::MenuItem menu_separator( ui::Menu menu ){ auto menu_item = ui::MenuItem(GTK_MENU_ITEM( gtk_menu_item_new() )); menu.add(menu_item); - gtk_widget_set_sensitive( GTK_WIDGET( menu_item ), FALSE ); + gtk_widget_set_sensitive( menu_item , FALSE ); menu_item.show(); return menu_item; } @@ -48,7 +48,7 @@ ui::MenuItem menu_separator( ui::Menu menu ){ ui::TearoffMenuItem menu_tearoff( ui::Menu menu ){ auto menu_item = ui::TearoffMenuItem(GTK_TEAROFF_MENU_ITEM( gtk_tearoff_menu_item_new() )); menu.add(menu_item); -// gtk_widget_set_sensitive(GTK_WIDGET(menu_item), FALSE); -- controls whether menu is detachable +// gtk_widget_set_sensitive(menu_item, FALSE); -- controls whether menu is detachable menu_item.show(); return menu_item; } diff --git a/libs/gtkutil/messagebox.cpp b/libs/gtkutil/messagebox.cpp index 334c4e78..28e29a14 100644 --- a/libs/gtkutil/messagebox.cpp +++ b/libs/gtkutil/messagebox.cpp @@ -110,8 +110,8 @@ EMessageBoxReturn gtk_MessageBox( ui::Widget parent, const char* text, const cha if ( type == eMB_OK ) { auto button = create_modal_dialog_button( "OK", ok_button ); hbox.pack_start( button, TRUE, FALSE, 0 ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); widget_make_default( button ); button.show(); @@ -121,7 +121,7 @@ EMessageBoxReturn gtk_MessageBox( ui::Widget parent, const char* text, const cha { auto button = create_modal_dialog_button( "OK", ok_button ); hbox.pack_start( button, TRUE, FALSE, 0 ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); widget_make_default( button ); button.show(); } @@ -129,7 +129,7 @@ EMessageBoxReturn gtk_MessageBox( ui::Widget parent, const char* text, const cha { auto button = create_modal_dialog_button( "OK", cancel_button ); hbox.pack_start( button, TRUE, FALSE, 0 ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); button.show(); } diff --git a/libs/gtkutil/nonmodal.cpp b/libs/gtkutil/nonmodal.cpp index 97c4bce2..f150ec2a 100644 --- a/libs/gtkutil/nonmodal.cpp +++ b/libs/gtkutil/nonmodal.cpp @@ -6,7 +6,7 @@ gboolean escape_clear_focus_widget(ui::Widget widget, GdkEventKey *event, gpointer data) { if (event->keyval == GDK_KEY_Escape) { - gtk_window_set_focus(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(widget))), NULL); + gtk_window_set_focus(GTK_WINDOW(gtk_widget_get_toplevel(widget)), NULL); return TRUE; } return FALSE; @@ -25,7 +25,7 @@ gboolean NonModalEntry::focus_in(ui::Entry entry, GdkEventFocus *event, NonModal gboolean NonModalEntry::focus_out(ui::Entry entry, GdkEventFocus *event, NonModalEntry *self) { - if (self->m_editing && gtk_widget_get_visible(GTK_WIDGET(entry))) { + if (self->m_editing && gtk_widget_get_visible(entry)) { self->m_apply(); } self->m_editing = false; @@ -43,7 +43,7 @@ gboolean NonModalEntry::enter(ui::Entry entry, GdkEventKey *event, NonModalEntry if (event->keyval == GDK_KEY_Return) { self->m_apply(); self->m_editing = false; - gtk_window_set_focus(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(entry))), NULL); + gtk_window_set_focus(GTK_WINDOW(gtk_widget_get_toplevel(entry)), NULL); return TRUE; } return FALSE; @@ -54,7 +54,7 @@ gboolean NonModalEntry::escape(ui::Entry entry, GdkEventKey *event, NonModalEntr if (event->keyval == GDK_KEY_Escape) { self->m_cancel(); self->m_editing = false; - gtk_window_set_focus(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(entry))), NULL); + gtk_window_set_focus(GTK_WINDOW(gtk_widget_get_toplevel(entry)), NULL); return TRUE; } return FALSE; @@ -78,7 +78,7 @@ gboolean NonModalSpinner::changed(ui::SpinButton spin, NonModalSpinner *self) gboolean NonModalSpinner::enter(ui::SpinButton spin, GdkEventKey *event, NonModalSpinner *self) { if (event->keyval == GDK_KEY_Return) { - gtk_window_set_focus(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(spin))), NULL); + gtk_window_set_focus(GTK_WINDOW(gtk_widget_get_toplevel(spin)), NULL); return TRUE; } return FALSE; @@ -88,7 +88,7 @@ gboolean NonModalSpinner::escape(ui::SpinButton spin, GdkEventKey *event, NonMod { if (event->keyval == GDK_KEY_Escape) { self->m_cancel(); - gtk_window_set_focus(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(spin))), NULL); + gtk_window_set_focus(GTK_WINDOW(gtk_widget_get_toplevel(spin)), NULL); return TRUE; } return FALSE; diff --git a/libs/gtkutil/paned.cpp b/libs/gtkutil/paned.cpp index 4149f8b7..1aeec45c 100644 --- a/libs/gtkutil/paned.cpp +++ b/libs/gtkutil/paned.cpp @@ -70,25 +70,25 @@ ui::HPaned create_split_views( ui::Widget topleft, ui::Widget topright, ui::Widg { auto vsplit = ui::VPaned(ui::New); - gtk_paned_add1( GTK_PANED( hsplit ), GTK_WIDGET( vsplit ) ); + gtk_paned_add1( GTK_PANED( hsplit ), vsplit ); vsplit.show(); vsplit.connect( "size_allocate", G_CALLBACK( vpaned_allocate ), &g_vpaned1 ); vsplit.connect( "notify::position", G_CALLBACK( paned_position ), &g_vpaned1 ); - gtk_paned_add1( GTK_PANED( vsplit ), GTK_WIDGET( create_framed_widget( topleft ) ) ); - gtk_paned_add2( GTK_PANED( vsplit ), GTK_WIDGET( create_framed_widget( topright ) ) ); + gtk_paned_add1( GTK_PANED( vsplit ), create_framed_widget( topleft ) ); + gtk_paned_add2( GTK_PANED( vsplit ), create_framed_widget( topright ) ); } { auto vsplit = ui::VPaned(ui::New); - gtk_paned_add2( GTK_PANED( hsplit ), GTK_WIDGET( vsplit ) ); + gtk_paned_add2( GTK_PANED( hsplit ), vsplit ); vsplit.show(); vsplit.connect( "size_allocate", G_CALLBACK( vpaned_allocate ), &g_vpaned2 ); vsplit.connect( "notify::position", G_CALLBACK( paned_position ), &g_vpaned2 ); - gtk_paned_add1( GTK_PANED( vsplit ), GTK_WIDGET( create_framed_widget( botleft ) ) ); - gtk_paned_add2( GTK_PANED( vsplit ), GTK_WIDGET( create_framed_widget( botright ) ) ); + gtk_paned_add1( GTK_PANED( vsplit ), create_framed_widget( botleft ) ); + gtk_paned_add2( GTK_PANED( vsplit ), create_framed_widget( botright ) ); } return hsplit; } diff --git a/libs/gtkutil/toolbar.cpp b/libs/gtkutil/toolbar.cpp index 04863609..d2ab45a7 100644 --- a/libs/gtkutil/toolbar.cpp +++ b/libs/gtkutil/toolbar.cpp @@ -32,13 +32,13 @@ void toolbar_append( ui::Toolbar toolbar, ui::ToolItem button, const char* description ){ - gtk_widget_show_all(GTK_WIDGET(button)); - gtk_widget_set_tooltip_text(GTK_WIDGET(button), description); + gtk_widget_show_all(button); + gtk_widget_set_tooltip_text(button, description); toolbar.add(button); } ui::ToolButton toolbar_append_button( ui::Toolbar toolbar, const char* description, const char* icon, const Callback& callback ){ - auto button = ui::ToolButton(GTK_TOOL_BUTTON(gtk_tool_button_new(GTK_WIDGET(new_local_image(icon)), nullptr))); + auto button = ui::ToolButton(GTK_TOOL_BUTTON(gtk_tool_button_new(new_local_image(icon), nullptr))); button_connect_callback(button, callback); toolbar_append(toolbar, button, description); return button; @@ -47,7 +47,7 @@ ui::ToolButton toolbar_append_button( ui::Toolbar toolbar, const char* descripti ui::ToggleToolButton toolbar_append_toggle_button( ui::Toolbar toolbar, const char* description, const char* icon, const Callback& callback ){ auto button = ui::ToggleToolButton(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_icon_widget(GTK_TOOL_BUTTON(button), new_local_image(icon)); gtk_tool_button_set_label(GTK_TOOL_BUTTON(button), description); toolbar_append(toolbar, button, description); return button; diff --git a/libs/gtkutil/window.cpp b/libs/gtkutil/window.cpp index 3da0b3b1..411e2b5a 100644 --- a/libs/gtkutil/window.cpp +++ b/libs/gtkutil/window.cpp @@ -40,11 +40,11 @@ inline void CHECK_MINIMIZE( ui::Widget w ){ static gboolean main_window_iconified( ui::Widget widget, GdkEventWindowState* event, gpointer data ){ if ( ( event->changed_mask & ( GDK_WINDOW_STATE_ICONIFIED | GDK_WINDOW_STATE_WITHDRAWN ) ) != 0 ) { if ( ( event->new_window_state & ( GDK_WINDOW_STATE_ICONIFIED | GDK_WINDOW_STATE_WITHDRAWN ) ) != 0 ) { - CHECK_MINIMIZE( ui::Widget(GTK_WIDGET( data )) ); + CHECK_MINIMIZE( ui::Widget::from( data ) ); } else { - CHECK_RESTORE( ui::Widget(GTK_WIDGET( data )) ); + CHECK_RESTORE( ui::Widget::from( data ) ); } } return FALSE; @@ -112,7 +112,7 @@ gboolean persistent_floating_window_delete( ui::Window floating, GdkEvent *event ui::Window create_persistent_floating_window( const char* title, ui::Window main_window ){ ui::Window window = ui::Window(GTK_WINDOW( create_floating_window( title, main_window ) )); - gtk_widget_set_events( GTK_WIDGET( window ), GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK ); + gtk_widget_set_events( window , GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK ); connect_floating_window_delete_present( window, main_window ); window.connect( "delete_event", G_CALLBACK( persistent_floating_window_delete ), 0 ); diff --git a/libs/uilib/uilib.h b/libs/uilib/uilib.h index 4a6eff47..e15bdbe4 100644 --- a/libs/uilib/uilib.h +++ b/libs/uilib/uilib.h @@ -189,6 +189,9 @@ namespace ui { void unref() { g_object_unref(_handle); } + void ref() + { g_object_ref(_handle); } + template gulong connect(char const *detailed_signal, Lambda &&c_handler, void *data); diff --git a/radiant/build.cpp b/radiant/build.cpp index b76b5ec4..d4285bf4 100644 --- a/radiant/build.cpp +++ b/radiant/build.cpp @@ -839,7 +839,7 @@ ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi window.add(table1); { auto vbox = create_dialog_vbox( 4 ); - gtk_table_attach( table1, GTK_WIDGET( vbox ), 1, 2, 0, 1, + gtk_table_attach( table1, vbox , 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); { @@ -853,7 +853,7 @@ ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi } { auto frame = create_dialog_frame( "Build menu" ); - gtk_table_attach( table1, GTK_WIDGET( frame ), 0, 1, 0, 1, + gtk_table_attach( table1, frame , 0, 1, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); { @@ -890,7 +890,7 @@ ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi } { auto frame = create_dialog_frame( "Commandline" ); - gtk_table_attach( table1, GTK_WIDGET( frame ), 0, 1, 1, 2, + gtk_table_attach( table1, frame , 0, 1, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); { @@ -1003,9 +1003,9 @@ void Build_constructMenu( ui::Menu menu ){ void Build_refreshMenu( ui::Menu menu ){ - for ( BuildMenuItems::iterator i = g_BuildMenuItems.begin(); i != g_BuildMenuItems.end(); ++i ) + for (auto i = g_BuildMenuItems.begin(); i != g_BuildMenuItems.end(); ++i ) { - menu.remove(ui::Widget(GTK_WIDGET((*i).m_item))); + menu.remove(ui::MenuItem(i->m_item)); } g_BuildMenuItems.clear(); diff --git a/radiant/commands.cpp b/radiant/commands.cpp index b8a67ddf..02ad4447 100644 --- a/radiant/commands.cpp +++ b/radiant/commands.cpp @@ -165,7 +165,7 @@ struct command_list_dialog_t : public ModalDialog } ModalDialogButton m_close_button; - GtkTreeView *m_list; + ui::TreeView m_list; GtkTreeIter m_command_iter; GtkTreeModel *m_model; bool m_waiting_for_key; @@ -178,7 +178,7 @@ void accelerator_clear_button_clicked( GtkButton *btn, gpointer dialogptr ){ // just unhighlight, user wanted to cancel dialog.m_waiting_for_key = false; gtk_list_store_set( GTK_LIST_STORE( dialog.m_model ), &dialog.m_command_iter, 2, false, -1 ); - gtk_widget_set_sensitive( GTK_WIDGET( dialog.m_list ), true ); + gtk_widget_set_sensitive( dialog.m_list , true ); dialog.m_model = NULL; return; } @@ -223,7 +223,7 @@ void accelerator_edit_button_clicked( GtkButton *btn, gpointer dialogptr ){ dialog.m_model = model; // 2. disallow changing the row - //gtk_widget_set_sensitive(GTK_WIDGET(dialog.m_list), false); + //gtk_widget_set_sensitive(dialog.m_list, false); // 3. highlight the row gtk_list_store_set( GTK_LIST_STORE( model ), &iter, 2, true, -1 ); @@ -274,7 +274,7 @@ bool accelerator_window_key_press( ui::Widget widget, GdkEventKey *event, gpoint Shortcuts::iterator thisShortcutIterator = g_shortcuts.find( commandName ); if ( thisShortcutIterator == g_shortcuts.end() ) { gtk_list_store_set( GTK_LIST_STORE( dialog.m_model ), &dialog.m_command_iter, 2, false, -1 ); - gtk_widget_set_sensitive( GTK_WIDGET( dialog.m_list ), true ); + gtk_widget_set_sensitive( dialog.m_list , true ); return true; } @@ -341,7 +341,7 @@ public: GlobalShortcuts_foreach( verify_visitor ); gtk_list_store_set( GTK_LIST_STORE( dialog.m_model ), &dialog.m_command_iter, 2, false, -1 ); - gtk_widget_set_sensitive( GTK_WIDGET( dialog.m_list ), true ); + gtk_widget_set_sensitive( dialog.m_list , true ); if ( verify_visitor.allow ) { // clear the ACTUAL accelerator first @@ -405,8 +405,8 @@ void DoCommandListDlg(){ { ui::ListStore store = ui::ListStore(gtk_list_store_new( 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INT )); - ui::Widget view = ui::TreeView(ui::TreeModel(GTK_TREE_MODEL(store))); - dialog.m_list = GTK_TREE_VIEW( view ); + auto view = ui::TreeView(ui::TreeModel(GTK_TREE_MODEL(store))); + dialog.m_list = view; gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), false ); // annoying @@ -476,9 +476,9 @@ public: auto button = create_modal_dialog_button( "Close", dialog.m_close_button ); vbox.pack_start( button, FALSE, FALSE, 0 ); widget_make_default( button ); - gtk_widget_grab_default( GTK_WIDGET( button ) ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_grab_default( button ); + gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); } modal_dialog_show( window, dialog ); diff --git a/radiant/dialog.cpp b/radiant/dialog.cpp index a5a39ecf..e588f93f 100644 --- a/radiant/dialog.cpp +++ b/radiant/dialog.cpp @@ -50,7 +50,7 @@ ui::Entry DialogEntry_new(){ auto entry = ui::Entry(ui::New); entry.show(); - gtk_widget_set_size_request( GTK_WIDGET( entry ), 64, -1 ); + gtk_widget_set_size_request( entry , 64, -1 ); return entry; } @@ -70,7 +70,7 @@ DialogEntryRow DialogEntryRow_new( const char* name ){ auto entry = DialogEntry_new(); alignment.add(entry); - return DialogEntryRow( ui::Widget(GTK_WIDGET( DialogRow_new( name, alignment ) )), entry ); + return DialogEntryRow( ui::Widget(DialogRow_new( name, alignment )), entry ); } @@ -83,7 +83,7 @@ ui::SpinButton DialogSpinner_new( double value, double lower, double upper, int } auto spin = ui::SpinButton( ui::Adjustment( value, lower, upper, step, 10, 0 ), step, digits ); spin.show(); - gtk_widget_set_size_request( GTK_WIDGET( spin ), 64, -1 ); + gtk_widget_set_size_request( spin , 64, -1 ); return spin; } @@ -103,7 +103,7 @@ DialogSpinnerRow DialogSpinnerRow_new( const char* name, double value, double lo auto spin = DialogSpinner_new( value, lower, upper, fraction ); alignment.add(spin); - return DialogSpinnerRow( ui::Widget(GTK_WIDGET( DialogRow_new( name, alignment ) )), spin ); + return DialogSpinnerRow( ui::Widget(DialogRow_new( name, alignment )), spin ); } @@ -458,7 +458,7 @@ ui::CheckButton Dialog::addCheckBox( ui::Widget vbox, const char* name, const ch check.show(); AddBoolToggleData( *GTK_TOGGLE_BUTTON( check ), importViewer, exportViewer ); - DialogVBox_packRow( ui::VBox(GTK_VBOX( vbox )), ui::Widget(GTK_WIDGET( DialogRow_new( name, check ) ) )); + DialogVBox_packRow( ui::VBox(GTK_VBOX( vbox )), ui::Widget(DialogRow_new( name, check ) )); return check; } @@ -496,7 +496,7 @@ void Dialog::addSlider( ui::Widget vbox, const char* name, int& data, gboolean d if ( draw_value == FALSE ) { auto hbox2 = ui::HBox( FALSE, 0 ); hbox2.show(); - vbox.pack_start( GTK_WIDGET( hbox2 ), FALSE, FALSE, 0 ); + vbox.pack_start( hbox2 , FALSE, FALSE, 0 ); { ui::Widget label = ui::Label( low ); label.show(); @@ -561,7 +561,7 @@ void Dialog::addRadioIcons( ui::Widget vbox, const char* name, StringArrayRange guint pos = static_cast( icon - icons.first ); auto image = new_local_image( *icon ); image.show(); - gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( image ), pos, pos + 1, 0, 1, + gtk_table_attach( GTK_TABLE( table ), image , pos, pos + 1, 0, 1, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -610,10 +610,10 @@ ui::Widget Dialog::addPathEntry( ui::Widget vbox, const char* name, bool browse_ AddTextEntryData( *GTK_ENTRY(pathEntry.m_entry), importViewer, exportViewer ); - auto row = DialogRow_new( name, ui::Widget(GTK_WIDGET( pathEntry.m_frame )) ); + auto row = DialogRow_new( name, ui::Widget(pathEntry.m_frame ) ); DialogVBox_packRow( ui::VBox(GTK_VBOX( vbox )), row ); - return ui::Widget(GTK_WIDGET( row )); + return ui::Widget(row ); } ui::Widget Dialog::addPathEntry( ui::Widget vbox, const char* name, CopiedString& data, bool browse_directory ){ diff --git a/radiant/entity.cpp b/radiant/entity.cpp index cf726aca..fbb268fb 100644 --- a/radiant/entity.cpp +++ b/radiant/entity.cpp @@ -289,7 +289,7 @@ int g_iLastLightIntensity; void Entity_createFromSelection( const char* name, const Vector3& origin ){ #if 0 if ( string_equal_nocase( name, "worldspawn" ) ) { - ui::alert( GTK_WIDGET( MainFrame_getWindow() ), "Can't create an entity with worldspawn.", "info" ); + ui::alert( MainFrame_getWindow( ), "Can't create an entity with worldspawn.", "info" ); return; } #endif @@ -392,7 +392,7 @@ void Entity_createFromSelection( const char* name, const Vector3& origin ){ #if 0 bool DoNormalisedColor( Vector3& color ){ - if ( !color_dialog( GTK_WIDGET( MainFrame_getWindow() ), color ) ) { + if ( !color_dialog( MainFrame_getWindow( ), color ) ) { return false; } /* diff --git a/radiant/entityinspector.cpp b/radiant/entityinspector.cpp index 23dd957d..a82d7797 100644 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@ -240,7 +240,7 @@ void update(){ } typedef MemberCaller UpdateCaller; void browse( const BrowsedPathEntry::SetPathCallback& setPath ){ - const char *filename = misc_model_dialog( ui::Widget(gtk_widget_get_toplevel( GTK_WIDGET( m_entry.m_entry.m_frame ) ) )); + const char *filename = misc_model_dialog( ui::Widget(gtk_widget_get_toplevel( m_entry.m_entry.m_frame ) )); if ( filename != 0 ) { setPath( filename ); @@ -288,7 +288,7 @@ void release(){ delete this; } ui::Widget getWidget() const { - return ui::Widget(GTK_WIDGET( m_entry.m_entry.m_frame )); + return ui::Widget(m_entry.m_entry.m_frame ); } void apply(){ StringOutputStream value( 64 ); @@ -303,7 +303,7 @@ void update(){ } typedef MemberCaller UpdateCaller; void browse( const BrowsedPathEntry::SetPathCallback& setPath ){ - const char *filename = browse_sound( ui::Widget(gtk_widget_get_toplevel( GTK_WIDGET( m_entry.m_entry.m_frame ) )) ); + const char *filename = browse_sound( ui::Widget(gtk_widget_get_toplevel( m_entry.m_entry.m_frame )) ); if ( filename != 0 ) { setPath( filename ); @@ -335,7 +335,7 @@ void release(){ delete this; } ui::Widget getWidget() const { - return ui::Widget(GTK_WIDGET( m_entry )); + return ui::Widget(m_entry ); } void apply(){ StringOutputStream angle( 32 ); @@ -396,7 +396,7 @@ void release(){ delete this; } ui::Widget getWidget() const { - return ui::Widget(GTK_WIDGET( m_hbox )); + return ui::Widget(m_hbox ); } void apply(){ StringOutputStream angle( 32 ); @@ -410,18 +410,18 @@ void update(){ if ( !string_empty( value ) ) { float f = float(atof( value ) ); if ( f == -1 ) { - gtk_widget_set_sensitive( GTK_WIDGET( m_entry ), FALSE ); + gtk_widget_set_sensitive( m_entry , FALSE ); radio_button_set_active_no_signal( m_radio.m_radio, 0 ); m_entry.text(""); } else if ( f == -2 ) { - gtk_widget_set_sensitive( GTK_WIDGET( m_entry ), FALSE ); + gtk_widget_set_sensitive( m_entry , FALSE ); radio_button_set_active_no_signal( m_radio.m_radio, 1 ); m_entry.text(""); } else { - gtk_widget_set_sensitive( GTK_WIDGET( m_entry ), TRUE ); + gtk_widget_set_sensitive( m_entry , TRUE ); radio_button_set_active_no_signal( m_radio.m_radio, 2 ); StringOutputStream angle( 32 ); angle << angle_normalised( f ); @@ -499,7 +499,7 @@ void release(){ delete this; } ui::Widget getWidget() const { - return ui::Widget(GTK_WIDGET( m_hbox )); + return ui::Widget(m_hbox ); } void apply(){ StringOutputStream angles( 64 ); @@ -586,7 +586,7 @@ void release(){ delete this; } ui::Widget getWidget() const { - return ui::Widget(GTK_WIDGET( m_hbox )); + return ui::Widget(m_hbox ); } void apply(){ StringOutputStream vector3( 64 ); @@ -679,7 +679,7 @@ void release(){ delete this; } ui::Widget getWidget() const { - return ui::Widget(GTK_WIDGET( m_combo )); + return ui::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() ); @@ -858,11 +858,11 @@ void SurfaceFlags_setEntityClass( EntityClass* eclass ){ { for ( int i = 0; i < g_spawnflag_count; ++i ) { - auto widget = ui::Widget(GTK_WIDGET(g_entitySpawnflagsCheck[i])); + auto widget = ui::CheckButton(g_entitySpawnflagsCheck[i]); auto label = ui::Label(GTK_LABEL(gtk_bin_get_child(GTK_BIN(widget)))); label.text(" "); widget.hide(); - g_object_ref( widget ); + widget.ref(); ui::Container(GTK_CONTAINER(g_spawnflagsTable)).remove(widget); } } @@ -872,7 +872,7 @@ void SurfaceFlags_setEntityClass( EntityClass* eclass ){ { for ( int i = 0; i < g_spawnflag_count; ++i ) { - ui::Widget widget = ui::Widget(GTK_WIDGET( g_entitySpawnflagsCheck[i] )); + auto widget = ui::CheckButton(g_entitySpawnflagsCheck[i] ); widget.show(); StringOutputStream str( 16 ); @@ -897,10 +897,10 @@ void EntityClassList_selectEntityClass( EntityClass* eclass ){ char* text; gtk_tree_model_get( model, &iter, 0, &text, -1 ); if ( strcmp( text, eclass->name() ) == 0 ) { - GtkTreeView* view = g_entityClassList; + auto view = ui::TreeView(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_get_realized( GTK_WIDGET(view) ) ) { + if ( gtk_widget_get_realized( view ) ) { gtk_tree_view_scroll_to_cell( view, path, 0, FALSE, 0, 0 ); } gtk_tree_path_free( path ); @@ -1091,7 +1091,7 @@ void EntityClassList_createEntity(){ GtkTreeModel* model; GtkTreeIter iter; if ( gtk_tree_selection_get_selected( gtk_tree_view_get_selection( view ), &model, &iter ) == FALSE ) { - ui::Widget(gtk_widget_get_toplevel( GTK_WIDGET( g_entityClassList ) )).alert( "You must have a selected class to create an entity", "info" ); + ui::Widget(gtk_widget_get_toplevel( ui::TreeView(g_entityClassList) )).alert( "You must have a selected class to create an entity", "info" ); return; } @@ -1119,14 +1119,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" ) ) { - ui::Widget(gtk_widget_get_toplevel( GTK_WIDGET( g_entityKeyEntry )) ).alert( "Cannot change \"classname\" key back to worldspawn.", 0, ui::alert_type::OK ); + ui::Widget(gtk_widget_get_toplevel( 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(), " " ) ) { - ui::Widget(gtk_widget_get_toplevel( GTK_WIDGET( g_entityKeyEntry )) ).alert( "No spaces are allowed in entity keys.", 0, ui::alert_type::OK ); + ui::Widget(gtk_widget_get_toplevel( g_entityKeyEntry ) ).alert( "No spaces are allowed in entity keys.", 0, ui::alert_type::OK ); return; } @@ -1200,7 +1200,7 @@ static gint EntityClassList_keypress( ui::Widget widget, GdkEventKey* event, gpo // select the entity that starts with the key pressed if ( code <= 'Z' && code >= 'A' ) { - GtkTreeView* view = g_entityClassList; + auto view = ui::TreeView(g_entityClassList); GtkTreeModel* model; GtkTreeIter iter; if ( gtk_tree_selection_get_selected( gtk_tree_view_get_selection( view ), &model, &iter ) == FALSE @@ -1216,7 +1216,7 @@ static gint EntityClassList_keypress( ui::Widget 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_get_realized( GTK_WIDGET(view) ) ) { + if ( gtk_widget_get_realized( view ) ) { gtk_tree_view_scroll_to_cell( view, path, 0, FALSE, 0, 0 ); } gtk_tree_path_free( path ); @@ -1258,11 +1258,11 @@ static void SpawnflagCheck_toggled( ui::Widget widget, gpointer data ){ EntityInspector_applySpawnflags(); } -static gint EntityEntry_keypress( GtkEntry* widget, GdkEventKey* event, gpointer data ){ +static gint EntityEntry_keypress( ui::Entry widget, GdkEventKey* event, gpointer data ){ if ( event->keyval == GDK_KEY_Return ) { - if ( widget == g_entityKeyEntry ) { + if ( widget._handle == g_entityKeyEntry._handle ) { g_entityValueEntry.text( "" ); - gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), GTK_WIDGET( g_entityValueEntry ) ); + gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( widget ) ), g_entityValueEntry ); } else { @@ -1271,7 +1271,7 @@ static gint EntityEntry_keypress( GtkEntry* widget, GdkEventKey* event, gpointer return TRUE; } if ( event->keyval == GDK_KEY_Escape ) { - gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), NULL ); + gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( widget ) ), NULL ); return TRUE; } @@ -1354,7 +1354,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ { auto text = ui::TextView(ui::New); - gtk_widget_set_size_request( GTK_WIDGET( text ), 0, -1 ); // allow shrinking + gtk_widget_set_size_request( text , 0, -1 ); // allow shrinking gtk_text_view_set_wrap_mode( text, GTK_WRAP_WORD ); gtk_text_view_set_editable( text, FALSE ); text.show(); @@ -1385,7 +1385,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ for ( int i = 0; i < MAX_FLAGS; i++ ) { auto check = ui::CheckButton( "" ); - g_object_ref( GTK_WIDGET( check ) ); + check.ref(); g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( check.connect( "toggled", G_CALLBACK( SpawnflagCheck_toggled ), 0 ) ) ); g_entitySpawnflagsCheck[i] = check; } @@ -1444,10 +1444,10 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1, + gtk_table_attach( table, entry , 1, 2, 0, 1, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); - gtk_widget_set_events( GTK_WIDGET( entry ), GDK_KEY_PRESS_MASK ); + gtk_widget_set_events( entry , GDK_KEY_PRESS_MASK ); entry.connect( "key_press_event", G_CALLBACK( EntityEntry_keypress ), 0 ); g_entityKeyEntry = entry; } @@ -1455,10 +1455,10 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2, + gtk_table_attach( table, entry , 1, 2, 1, 2, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); - gtk_widget_set_events( GTK_WIDGET( entry ), GDK_KEY_PRESS_MASK ); + gtk_widget_set_events( entry , GDK_KEY_PRESS_MASK ); entry.connect( "key_press_event", G_CALLBACK( EntityEntry_keypress ), 0 ); g_entityValueEntry = entry; } @@ -1466,7 +1466,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ { auto label = ui::Label( "Value" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2, + gtk_table_attach( table, label , 0, 1, 1, 2, (GtkAttachOptions)( GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); @@ -1475,7 +1475,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ { auto label = ui::Label( "Key" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1, + gtk_table_attach( table, label , 0, 1, 0, 1, (GtkAttachOptions)( GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); diff --git a/radiant/entitylist.cpp b/radiant/entitylist.cpp index 8f677c2f..602ea1e5 100644 --- a/radiant/entitylist.cpp +++ b/radiant/entitylist.cpp @@ -118,7 +118,7 @@ void entitylist_treeviewcolumn_celldatafunc( GtkTreeViewColumn* column, GtkCellR g_object_set( G_OBJECT( renderer ), "text", name, "visible", TRUE, NULL ); //globalOutputStream() << "rendering cell " << makeQuoted(name) << "\n"; - GtkStyle* style = gtk_widget_get_style( GTK_WIDGET( getEntityList().m_tree_view ) ); + GtkStyle* style = gtk_widget_get_style( ui::TreeView( getEntityList().m_tree_view ) ); if ( instance->childSelected() ) { g_object_set( G_OBJECT( renderer ), "cell-background-gdk", &style->base[GTK_STATE_ACTIVE], NULL ); } diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index 32c025f6..e35159fa 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -170,7 +170,7 @@ gboolean OnSelchangeComboWhatgame( ui::Widget widget, GameCombo* combo ){ gamecombo_t gamecombo = gamecombo_for_gamename( gamename ); combo->fsgame_entry.text( gamecombo.fs_game ); - gtk_widget_set_sensitive( GTK_WIDGET( combo->fsgame_entry ), gamecombo.sensitive ); + gtk_widget_set_sensitive( combo->fsgame_entry , gamecombo.sensitive ); return FALSE; } @@ -210,7 +210,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal window.add(table1); { auto vbox = create_dialog_vbox( 4 ); - gtk_table_attach( table1, GTK_WIDGET( vbox ), 1, 2, 0, 1, + gtk_table_attach( table1, vbox , 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); { @@ -224,7 +224,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal } { auto frame = create_dialog_frame( "Project settings" ); - gtk_table_attach( table1, GTK_WIDGET( frame ), 0, 1, 0, 1, + gtk_table_attach( table1, frame , 0, 1, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); { @@ -234,7 +234,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal { auto label = ui::Label( "Select mod" ); label.show(); - gtk_table_attach( table2, GTK_WIDGET( label ), 0, 1, 0, 1, + gtk_table_attach( table2, label , 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); @@ -249,7 +249,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal gtk_combo_box_text_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().custom ); dialog.game_combo.game_select.show(); - gtk_table_attach( table2, GTK_WIDGET( dialog.game_combo.game_select ), 1, 2, 0, 1, + gtk_table_attach( table2, dialog.game_combo.game_select , 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -259,7 +259,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal { auto label = ui::Label( "fs_game" ); label.show(); - gtk_table_attach( table2, GTK_WIDGET( label ), 0, 1, 1, 2, + gtk_table_attach( table2, label , 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); @@ -267,7 +267,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table2, GTK_WIDGET( entry ), 1, 2, 1, 2, + gtk_table_attach( table2, entry , 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -277,7 +277,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal if ( globalMappingMode().do_mapping_mode ) { auto label = ui::Label( "Mapping mode" ); label.show(); - gtk_table_attach( table2, GTK_WIDGET( label ), 0, 1, 3, 4, + gtk_table_attach( table2, label , 0, 1, 3, 4, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); @@ -287,7 +287,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal gtk_combo_box_text_append_text( combo, globalMappingMode().mp_mapping_mode ); combo.show(); - gtk_table_attach( table2, GTK_WIDGET( combo ), 1, 2, 3, 4, + gtk_table_attach( table2, combo , 1, 2, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -303,7 +303,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal gtk_combo_box_set_active( dialog.game_combo.game_select, gamecombo.game ); dialog.game_combo.fsgame_entry.text( gamecombo.fs_game ); - gtk_widget_set_sensitive( GTK_WIDGET( dialog.game_combo.fsgame_entry ), gamecombo.sensitive ); + gtk_widget_set_sensitive( dialog.game_combo.fsgame_entry , gamecombo.sensitive ); if ( globalMappingMode().do_mapping_mode ) { const char *gamemode = gamemode_get(); @@ -389,7 +389,7 @@ void DoSides( int type, int axis ){ entry.show(); hbox.pack_start( entry, FALSE, FALSE, 0 ); sides_entry = entry; - gtk_widget_grab_focus( GTK_WIDGET( entry ) ); + gtk_widget_grab_focus( entry ); } { auto vbox = create_dialog_vbox( 4 ); @@ -398,12 +398,12 @@ void DoSides( int type, int axis ){ auto button = create_dialog_button( "OK", G_CALLBACK( dialog_button_ok ), &dialog ); vbox.pack_start( button, FALSE, FALSE, 0 ); widget_make_default( button ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); } { auto button = create_dialog_button( "Cancel", G_CALLBACK( dialog_button_cancel ), &dialog ); vbox.pack_start( button, FALSE, FALSE, 0 ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); } } } @@ -514,7 +514,7 @@ void DoAbout(){ { auto label = ui::Label( "Vendor:" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1, + gtk_table_attach( table, label , 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); @@ -522,7 +522,7 @@ void DoAbout(){ { auto label = ui::Label( "Version:" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2, + gtk_table_attach( table, label , 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); @@ -530,7 +530,7 @@ void DoAbout(){ { auto label = ui::Label( "Renderer:" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 2, 3, + gtk_table_attach( table, label , 0, 1, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); @@ -538,7 +538,7 @@ void DoAbout(){ { auto label = ui::Label( reinterpret_cast( glGetString( GL_VENDOR ) ) ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 0, 1, + gtk_table_attach( table, label , 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); @@ -546,7 +546,7 @@ void DoAbout(){ { auto label = ui::Label( reinterpret_cast( glGetString( GL_VERSION ) ) ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 1, 2, + gtk_table_attach( table, label , 1, 2, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); @@ -554,7 +554,7 @@ void DoAbout(){ { auto label = ui::Label( reinterpret_cast( glGetString( GL_RENDERER ) ) ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 2, 3, + gtk_table_attach( table, label , 1, 2, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); @@ -625,7 +625,7 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){ { auto label = ui::Label( "Texture x:" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1, + gtk_table_attach( table, label , 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); @@ -633,7 +633,7 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){ { auto label = ui::Label( "Texture y:" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2, + gtk_table_attach( table, label , 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); @@ -641,7 +641,7 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1, + gtk_table_attach( table, entry , 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -650,7 +650,7 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2, + gtk_table_attach( table, entry , 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -665,12 +665,12 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){ auto button = create_modal_dialog_button( "OK", ok_button ); vbox.pack_start( button, FALSE, FALSE, 0 ); widget_make_default( button ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); } { auto button = create_modal_dialog_button( "Cancel", cancel_button ); vbox.pack_start( button, FALSE, FALSE, 0 ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); } } } @@ -685,7 +685,7 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){ y.text( buf ); // Set focus after intializing the values - gtk_widget_grab_focus( GTK_WIDGET( x ) ); + gtk_widget_grab_focus( x ); EMessageBoxReturn ret = modal_dialog_show( window, dialog ); if ( ret == eIDOK ) { @@ -724,7 +724,7 @@ static void editor_save( ui::Widget widget, gpointer data ){ gpointer text = g_object_get_data( G_OBJECT( data ), "text" ); if ( f == 0 ) { - ui::Widget(GTK_WIDGET( data )).alert( "Error saving file !" ); + ui::Widget::from(data).alert( "Error saving file !" ); return; } @@ -877,7 +877,7 @@ EMessageBoxReturn DoLightIntensityDlg( int *intensity ){ entry.show(); vbox.pack_start( entry, TRUE, TRUE, 0 ); - gtk_widget_grab_focus( GTK_WIDGET( entry ) ); + gtk_widget_grab_focus( entry ); intensity_entry = entry; } @@ -890,12 +890,12 @@ EMessageBoxReturn DoLightIntensityDlg( int *intensity ){ auto button = create_modal_dialog_button( "OK", ok_button ); vbox.pack_start( button, FALSE, FALSE, 0 ); widget_make_default( button ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_KEY_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); + gtk_widget_add_accelerator( button , "clicked", accel_group, GDK_KEY_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); } { auto button = create_modal_dialog_button( "Cancel", cancel_button ); vbox.pack_start( button, FALSE, FALSE, 0 ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_KEY_Escape, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); + gtk_widget_add_accelerator( button , "clicked", accel_group, GDK_KEY_Escape, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); } } } @@ -945,7 +945,7 @@ EMessageBoxReturn DoShaderTagDlg( CopiedString* tag, const char* title ){ entry.show(); vbox.pack_start( entry, TRUE, TRUE, 0 ); - gtk_widget_grab_focus( GTK_WIDGET( entry ) ); + gtk_widget_grab_focus( entry ); textentry = entry; } @@ -958,12 +958,12 @@ EMessageBoxReturn DoShaderTagDlg( CopiedString* tag, const char* title ){ auto button = create_modal_dialog_button( "OK", ok_button ); vbox.pack_start( button, FALSE, FALSE, 0 ); widget_make_default( button ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_KEY_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); + gtk_widget_add_accelerator( button , "clicked", accel_group, GDK_KEY_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); } { auto button = create_modal_dialog_button( "Cancel", cancel_button ); vbox.pack_start( button, FALSE, FALSE, 0 ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_KEY_Escape, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); + gtk_widget_add_accelerator( button , "clicked", accel_group, GDK_KEY_Escape, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); } } } @@ -1017,7 +1017,7 @@ EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, const auto button = create_modal_dialog_button( "OK", ok_button ); vbox.pack_start( button, FALSE, FALSE, 0 ); widget_make_default( button ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_KEY_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); + gtk_widget_add_accelerator( button , "clicked", accel_group, GDK_KEY_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); } } } diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index ecafc384..c06c2904 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -1631,7 +1631,7 @@ WaitDialog create_wait_dialog( const char* title, const char* text ){ gtk_misc_set_alignment( GTK_MISC( dialog.m_label ), 0.0, 0.5 ); gtk_label_set_justify( dialog.m_label, GTK_JUSTIFY_LEFT ); dialog.m_label.show(); - gtk_widget_set_size_request( GTK_WIDGET( dialog.m_label ), 200, -1 ); + gtk_widget_set_size_request( dialog.m_label , 200, -1 ); dialog.m_window.add(dialog.m_label); } @@ -1692,7 +1692,7 @@ void ScreenUpdates_Disable( const char* message, const char* title ){ bool isActiveApp = MainFrame_isActiveApp(); g_wait = create_wait_dialog( title, message ); - gtk_grab_add( GTK_WIDGET( g_wait.m_window ) ); + gtk_grab_add( g_wait.m_window ); if ( isActiveApp ) { g_wait.m_window.show(); @@ -1711,9 +1711,9 @@ void ScreenUpdates_Enable(){ g_wait_stack.pop_back(); if ( g_wait_stack.empty() ) { EverySecondTimer_enable(); - //gtk_widget_set_sensitive(GTK_WIDGET(MainFrame_getWindow()), TRUE); + //gtk_widget_set_sensitive(MainFrame_getWindow(), TRUE); - gtk_grab_remove( GTK_WIDGET( g_wait.m_window ) ); + gtk_grab_remove( g_wait.m_window ); destroy_floating_window( g_wait.m_window ); g_wait.m_window = ui::Window{ui::null}; @@ -2321,7 +2321,7 @@ ui::Toolbar create_main_toolbar( MainFrame::EViewStyle style ){ toolbar.show(); auto space = [&]() { - auto btn = ui::Widget(GTK_WIDGET(gtk_separator_tool_item_new())); + auto btn = ui::ToolItem(gtk_separator_tool_item_new()); btn.show(); toolbar.add(btn); }; @@ -2386,8 +2386,8 @@ ui::Toolbar create_main_toolbar( MainFrame::EViewStyle style ){ // disable the console and texture button in the regular layouts if ( style == MainFrame::eRegular || style == MainFrame::eRegularLeft ) { - gtk_widget_set_sensitive( GTK_WIDGET( g_view_console_button ), FALSE ); - gtk_widget_set_sensitive( GTK_WIDGET( g_view_textures_button ), FALSE ); + gtk_widget_set_sensitive( g_view_console_button , FALSE ); + gtk_widget_set_sensitive( g_view_textures_button , FALSE ); } return toolbar; @@ -2402,15 +2402,15 @@ ui::Widget create_main_statusbar( ui::Widget pStatusLabel[c_count_status] ){ gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); gtk_misc_set_padding( GTK_MISC( label ), 4, 2 ); label.show(); - gtk_table_attach_defaults( table, GTK_WIDGET( label ), 0, 1, 0, 1 ); - pStatusLabel[c_command_status] = ui::Widget(GTK_WIDGET( label )); + gtk_table_attach_defaults( table, label , 0, 1, 0, 1 ); + pStatusLabel[c_command_status] = ui::Widget(label ); } for ( int i = 1; i < c_count_status; ++i ) { auto frame = ui::Frame(); frame.show(); - gtk_table_attach_defaults( table, GTK_WIDGET( frame ), i, i + 1, 0, 1 ); + gtk_table_attach_defaults( table, frame , i, i + 1, 0, 1 ); gtk_frame_set_shadow_type( frame, GTK_SHADOW_IN ); auto label = ui::Label( "Label" ); @@ -2419,10 +2419,10 @@ ui::Widget create_main_statusbar( ui::Widget pStatusLabel[c_count_status] ){ gtk_misc_set_padding( GTK_MISC( label ), 4, 2 ); label.show(); frame.add(label); - pStatusLabel[i] = ui::Widget(GTK_WIDGET( label )); + pStatusLabel[i] = ui::Widget(label ); } - return ui::Widget(GTK_WIDGET( table )); + return ui::Widget(table ); } #if 0 @@ -2674,7 +2674,7 @@ ui::Window create_splash(){ image.show(); window.add(image); - gtk_widget_set_size_request( GTK_WIDGET( window ), -1, -1 ); + gtk_widget_set_size_request( window , -1, -1 ); window.show(); return window; @@ -2722,7 +2722,7 @@ void MainFrame::Create(){ } #endif - gtk_widget_add_events( GTK_WIDGET( window ), GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK ); + gtk_widget_add_events( window , GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK ); window.connect( "delete_event", G_CALLBACK( mainframe_delete ), this ); m_position_tracker.connect( window ); @@ -2809,7 +2809,7 @@ void MainFrame::Create(){ // xy m_pXYWnd = new XYWnd(); m_pXYWnd->SetViewType( XY ); - ui::Widget xy_window = ui::Widget(GTK_WIDGET( create_framed_widget( m_pXYWnd->GetWidget() ) )); + ui::Widget xy_window = ui::Widget(create_framed_widget( m_pXYWnd->GetWidget( ) )); { ui::Widget vsplit2 = ui::VPaned(ui::New); @@ -2831,14 +2831,14 @@ void MainFrame::Create(){ m_pCamWnd = NewCamWnd(); GlobalCamera_setCamWnd( *m_pCamWnd ); CamWnd_setParent( *m_pCamWnd, window ); - GtkFrame* camera_window = create_framed_widget( CamWnd_getWidget( *m_pCamWnd ) ); + auto camera_window = create_framed_widget( CamWnd_getWidget( *m_pCamWnd ) ); - gtk_paned_add1( GTK_PANED( vsplit2 ), GTK_WIDGET( camera_window ) ); + gtk_paned_add1( GTK_PANED( vsplit2 ), camera_window ); // textures - GtkFrame* texture_window = create_framed_widget( TextureBrowser_constructWindow( window ) ); + auto texture_window = create_framed_widget( TextureBrowser_constructWindow( window ) ); - gtk_paned_add2( GTK_PANED( vsplit2 ), GTK_WIDGET( texture_window ) ); + gtk_paned_add2( GTK_PANED( vsplit2 ), texture_window ); } } } @@ -2933,8 +2933,8 @@ void MainFrame::Create(){ } { - GtkFrame* frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) ); - g_page_textures = GroupDialog_addPage( "Textures", ui::Widget(GTK_WIDGET( frame )), TextureBrowserExportTitleCaller() ); + auto frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) ); + g_page_textures = GroupDialog_addPage( "Textures", frame, TextureBrowserExportTitleCaller() ); } GroupDialog_show(); @@ -2966,8 +2966,8 @@ void MainFrame::Create(){ vbox.pack_start( split, TRUE, TRUE, 0 ); { - GtkFrame* frame = create_framed_widget( TextureBrowser_constructWindow( window ) ); - g_page_textures = GroupDialog_addPage( "Textures", ui::Widget(GTK_WIDGET( frame )), TextureBrowserExportTitleCaller() ); + auto frame = create_framed_widget( TextureBrowser_constructWindow( window ) ); + g_page_textures = GroupDialog_addPage( "Textures", frame, TextureBrowserExportTitleCaller() ); } } @@ -3008,7 +3008,7 @@ void MainFrame::SaveWindowInfo(){ g_layout_globals.m_position = m_position_tracker.getPosition(); - g_layout_globals.nState = gdk_window_get_state( gtk_widget_get_window(GTK_WIDGET( m_window )) ); + g_layout_globals.nState = gdk_window_get_state( gtk_widget_get_window(m_window ) ); } void MainFrame::Shutdown(){ diff --git a/radiant/map.cpp b/radiant/map.cpp index dbfb6c7d..8da86544 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -786,7 +786,7 @@ void DoMapInfo(){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1, + gtk_table_attach( table, entry , 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_editable_set_editable( GTK_EDITABLE(entry), FALSE ); @@ -796,7 +796,7 @@ void DoMapInfo(){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2, + gtk_table_attach( table, entry , 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_editable_set_editable( GTK_EDITABLE(entry), FALSE ); @@ -2065,16 +2065,16 @@ void DoFind(){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1, + gtk_table_attach( table, entry , 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_grab_focus( GTK_WIDGET( entry ) ); + gtk_widget_grab_focus( entry ); entity = entry; } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2, + gtk_table_attach( table, entry , 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -2088,12 +2088,12 @@ void DoFind(){ auto button = create_dialog_button( "Find", G_CALLBACK( dialog_button_ok ), &dialog ); hbox.pack_start( button, FALSE, FALSE, 0 ); widget_make_default( button ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); } { auto button = create_dialog_button( "Close", G_CALLBACK( dialog_button_cancel ), &dialog ); hbox.pack_start( button, FALSE, FALSE, 0 ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); } } } diff --git a/radiant/mru.cpp b/radiant/mru.cpp index 71133c55..4f0df1a2 100644 --- a/radiant/mru.cpp +++ b/radiant/mru.cpp @@ -120,8 +120,8 @@ void MRU_AddFile( const char *str ){ MRU_SetText( i, MRU_GetText( i - 1 ) ); MRU_SetText( 0, str ); - gtk_widget_set_sensitive( GTK_WIDGET( MRU_items[0] ), TRUE ); - ui::Widget(GTK_WIDGET( MRU_items[MRU_used - 1] )).show(); + gtk_widget_set_sensitive( ui::MenuItem(MRU_items[0]) , TRUE ); + ui::MenuItem(MRU_items[MRU_used - 1] ).show(); } void MRU_Init(){ @@ -135,8 +135,8 @@ void MRU_AddWidget( GtkMenuItem *widget, std::size_t pos ){ MRU_items[pos] = widget; if ( pos < MRU_used ) { MRU_updateWidget( pos, MRU_GetText( pos ) ); - gtk_widget_set_sensitive( GTK_WIDGET( MRU_items[0] ), TRUE ); - ui::Widget(GTK_WIDGET( MRU_items[pos] )).show(); + gtk_widget_set_sensitive( ui::MenuItem(MRU_items[0]) , TRUE ); + ui::MenuItem(MRU_items[pos]).show(); } } } @@ -161,7 +161,7 @@ void MRU_Activate( std::size_t index ){ if ( MRU_used == 0 ) { auto label = ui::Label(GTK_LABEL(gtk_bin_get_child(GTK_BIN(MRU_items[0] )) )); label.text("Recent Files"); - gtk_widget_set_sensitive( GTK_WIDGET( MRU_items[0] ), FALSE ); + gtk_widget_set_sensitive( ui::MenuItem(MRU_items[0]), FALSE ); } else { @@ -195,7 +195,7 @@ LoadMRU g_load_mru4( 4 ); void MRU_constructMenu( ui::Menu menu ){ { auto item = create_menu_item_with_mnemonic( menu, "_1", LoadMRUCaller( g_load_mru1 ) ); - gtk_widget_set_sensitive( GTK_WIDGET( item ), FALSE ); + gtk_widget_set_sensitive( item , FALSE ); MRU_AddWidget( item, 0 ); } { diff --git a/radiant/patchdialog.cpp b/radiant/patchdialog.cpp index 464bc06f..77ea3a65 100644 --- a/radiant/patchdialog.cpp +++ b/radiant/patchdialog.cpp @@ -171,15 +171,15 @@ void update(){ if ( subdivisions.m_enabled ) { entry_set_int( m_horizontal, static_cast( subdivisions.m_x ) ); entry_set_int( m_vertical, static_cast( subdivisions.m_y ) ); - gtk_widget_set_sensitive( GTK_WIDGET( m_horizontal ), TRUE ); - gtk_widget_set_sensitive( GTK_WIDGET( m_vertical ), TRUE ); + gtk_widget_set_sensitive( m_horizontal , TRUE ); + gtk_widget_set_sensitive( m_vertical , TRUE ); } else { m_horizontal.text(""); m_vertical.text(""); - gtk_widget_set_sensitive( GTK_WIDGET( m_horizontal ), FALSE ); - gtk_widget_set_sensitive( GTK_WIDGET( m_vertical ), FALSE ); + gtk_widget_set_sensitive( m_horizontal , FALSE ); + gtk_widget_set_sensitive( m_vertical , FALSE ); } } void cancel(){ @@ -595,14 +595,14 @@ ui::Window PatchInspector::BuildDialog(){ { auto label = ui::Label( "Row:" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1, + gtk_table_attach( table, label , 0, 1, 0, 1, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); } { auto label = ui::Label( "Column:" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 0, 1, + gtk_table_attach( table, label , 1, 2, 0, 1, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); } @@ -612,10 +612,10 @@ ui::Window PatchInspector::BuildDialog(){ AddDialogData( *GTK_COMBO_BOX(combo), m_nRow ); combo.show(); - gtk_table_attach( table, GTK_WIDGET( combo ), 0, 1, 1, 2, + gtk_table_attach( table, combo , 0, 1, 1, 2, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( combo ), 60, -1 ); + gtk_widget_set_size_request( combo , 60, -1 ); m_pRowCombo = combo; } @@ -625,10 +625,10 @@ ui::Window PatchInspector::BuildDialog(){ AddDialogData( *GTK_COMBO_BOX(combo), m_nCol ); combo.show(); - gtk_table_attach( table, GTK_WIDGET( combo ), 1, 2, 1, 2, + gtk_table_attach( table, combo , 1, 2, 1, 2, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( combo ), 60, -1 ); + gtk_widget_set_size_request( combo , 60, -1 ); m_pColCombo = combo; } } @@ -640,42 +640,42 @@ ui::Window PatchInspector::BuildDialog(){ { auto label = ui::Label( "X:" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1, + gtk_table_attach( table, label , 0, 1, 0, 1, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); } { auto label = ui::Label( "Y:" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2, + gtk_table_attach( table, label , 0, 1, 1, 2, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); } { auto label = ui::Label( "Z:" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 2, 3, + gtk_table_attach( table, label , 0, 1, 2, 3, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); } { auto label = ui::Label( "S:" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 3, 4, + gtk_table_attach( table, label , 0, 1, 3, 4, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); } { auto label = ui::Label( "T:" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 4, 5, + gtk_table_attach( table, label , 0, 1, 4, 5, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1, + gtk_table_attach( table, entry , 1, 2, 0, 1, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); AddDialogData( *GTK_ENTRY(entry), m_fX ); @@ -685,7 +685,7 @@ ui::Window PatchInspector::BuildDialog(){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2, + gtk_table_attach( table, entry , 1, 2, 1, 2, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); AddDialogData( *GTK_ENTRY(entry), m_fY ); @@ -695,7 +695,7 @@ ui::Window PatchInspector::BuildDialog(){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 2, 3, + gtk_table_attach( table, entry , 1, 2, 2, 3, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); AddDialogData( *GTK_ENTRY(entry), m_fZ ); @@ -705,7 +705,7 @@ ui::Window PatchInspector::BuildDialog(){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 3, 4, + gtk_table_attach( table, entry , 1, 2, 3, 4, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); AddDialogData( *GTK_ENTRY(entry), m_fS ); @@ -715,7 +715,7 @@ ui::Window PatchInspector::BuildDialog(){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 4, 5, + gtk_table_attach( table, entry , 1, 2, 4, 5, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); AddDialogData( *GTK_ENTRY(entry), m_fT ); @@ -742,14 +742,14 @@ ui::Window PatchInspector::BuildDialog(){ { auto label = ui::Label( "Fixed" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1, + gtk_table_attach( table, label , 0, 1, 0, 1, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); } { auto check = ui::CheckButton(GTK_CHECK_BUTTON( gtk_check_button_new() )); check.show(); - gtk_table_attach( table, GTK_WIDGET( check ), 1, 2, 0, 1, + gtk_table_attach( table, check , 1, 2, 0, 1, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); m_subdivisions.m_enabled = check; @@ -759,14 +759,14 @@ ui::Window PatchInspector::BuildDialog(){ { auto label = ui::Label( "Horizontal" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2, + gtk_table_attach( table, label , 0, 1, 1, 2, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2, + gtk_table_attach( table, entry , 1, 2, 1, 2, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); m_subdivisions.m_horizontal = entry; @@ -775,14 +775,14 @@ ui::Window PatchInspector::BuildDialog(){ { auto label = ui::Label( "Vertical" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 2, 3, + gtk_table_attach( table, label , 0, 1, 2, 3, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 2, 3, + gtk_table_attach( table, entry , 1, 2, 2, 3, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); m_subdivisions.m_vertical = entry; @@ -826,7 +826,7 @@ ui::Window PatchInspector::BuildDialog(){ { auto label = ui::Label( "Horizontal Shift Step" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 0, 1, + gtk_table_attach( table, label , 2, 4, 0, 1, (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ), (GtkAttachOptions)( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); @@ -834,7 +834,7 @@ ui::Window PatchInspector::BuildDialog(){ { auto label = ui::Label( "Vertical Shift Step" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 1, 2, + gtk_table_attach( table, label , 2, 4, 1, 2, (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ), (GtkAttachOptions)( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); @@ -842,7 +842,7 @@ ui::Window PatchInspector::BuildDialog(){ { auto label = ui::Label( "Horizontal Stretch Step" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 2, 3, 2, 3, + gtk_table_attach( table, label , 2, 3, 2, 3, (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ), (GtkAttachOptions)( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); @@ -850,16 +850,16 @@ ui::Window PatchInspector::BuildDialog(){ { auto button = ui::Button( "Flip" ); button.show(); - gtk_table_attach( table, GTK_WIDGET( button ), 3, 4, 2, 3, + gtk_table_attach( table, button , 3, 4, 2, 3, (GtkAttachOptions)( GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); button.connect( "clicked", G_CALLBACK( OnBtnPatchFlipX ), 0 ); - gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 ); + gtk_widget_set_size_request( button , 60, -1 ); } { auto label = ui::Label( "Vertical Stretch Step" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 2, 3, 3, 4, + gtk_table_attach( table, label , 2, 3, 3, 4, (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ), (GtkAttachOptions)( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); @@ -867,16 +867,16 @@ ui::Window PatchInspector::BuildDialog(){ { auto button = ui::Button( "Flip" ); button.show(); - gtk_table_attach( table, GTK_WIDGET( button ), 3, 4, 3, 4, + gtk_table_attach( table, button , 3, 4, 3, 4, (GtkAttachOptions)( GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); button.connect( "clicked", G_CALLBACK( OnBtnPatchFlipY ), 0 ); - gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 ); + gtk_widget_set_size_request( button , 60, -1 ); } { auto label = ui::Label( "Rotate Step" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 4, 5, + gtk_table_attach( table, label , 2, 4, 4, 5, (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ), (GtkAttachOptions)( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); @@ -884,10 +884,10 @@ ui::Window PatchInspector::BuildDialog(){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 0, 1, + gtk_table_attach( table, entry , 0, 1, 0, 1, (GtkAttachOptions)( GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 ); + gtk_widget_set_size_request( entry , 50, -1 ); g_object_set_data( G_OBJECT( window ), "hshift_entry", (void *) 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 @@ -899,19 +899,19 @@ ui::Window PatchInspector::BuildDialog(){ auto spin = ui::SpinButton( adj, 1, 0 ); spin.show(); - gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 0, 1, + gtk_table_attach( table, spin , 1, 2, 0, 1, (GtkAttachOptions)( 0 ), (GtkAttachOptions)( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 ); + gtk_widget_set_size_request( spin , 10, -1 ); gtk_widget_set_can_focus( spin, false ); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 1, 2, + gtk_table_attach( table, entry , 0, 1, 1, 2, (GtkAttachOptions)( GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 ); + gtk_widget_set_size_request( entry , 50, -1 ); entry_set_float( entry, g_pi_globals.shift[1] ); auto adj = ui::Adjustment( 0, -8192, 8192, 1, 1, 0 ); @@ -920,19 +920,19 @@ ui::Window PatchInspector::BuildDialog(){ auto spin = ui::SpinButton( adj, 1, 0 ); spin.show(); - gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 1, 2, + gtk_table_attach( table, spin , 1, 2, 1, 2, (GtkAttachOptions)( 0 ), (GtkAttachOptions)( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 ); + gtk_widget_set_size_request( spin , 10, -1 ); gtk_widget_set_can_focus( spin, false ); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 2, 3, + gtk_table_attach( table, entry , 0, 1, 2, 3, (GtkAttachOptions)( GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 ); + gtk_widget_set_size_request( entry , 50, -1 ); entry_set_float( entry, g_pi_globals.scale[0] ); auto adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 ); @@ -941,19 +941,19 @@ ui::Window PatchInspector::BuildDialog(){ auto spin = ui::SpinButton( adj, 1, 0 ); spin.show(); - gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 2, 3, + gtk_table_attach( table, spin , 1, 2, 2, 3, (GtkAttachOptions)( 0 ), (GtkAttachOptions)( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 ); + gtk_widget_set_size_request( spin , 10, -1 ); gtk_widget_set_can_focus( spin, false ); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 3, 4, + gtk_table_attach( table, entry , 0, 1, 3, 4, (GtkAttachOptions)( GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 ); + gtk_widget_set_size_request( entry , 50, -1 ); entry_set_float( entry, g_pi_globals.scale[1] ); auto adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 ); @@ -962,19 +962,19 @@ ui::Window PatchInspector::BuildDialog(){ auto spin = ui::SpinButton( adj, 1, 0 ); spin.show(); - gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 3, 4, + gtk_table_attach( table, spin , 1, 2, 3, 4, (GtkAttachOptions)( 0 ), (GtkAttachOptions)( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 ); + gtk_widget_set_size_request( spin , 10, -1 ); gtk_widget_set_can_focus( spin, false ); } { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 4, 5, + gtk_table_attach( table, entry , 0, 1, 4, 5, (GtkAttachOptions)( GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 ); + gtk_widget_set_size_request( entry , 50, -1 ); entry_set_float( entry, g_pi_globals.rotate ); 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 @@ -983,10 +983,10 @@ ui::Window PatchInspector::BuildDialog(){ auto spin = ui::SpinButton( adj, 1, 0 ); spin.show(); - gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 4, 5, + gtk_table_attach( table, spin , 1, 2, 4, 5, (GtkAttachOptions)( 0 ), (GtkAttachOptions)( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 ); + gtk_widget_set_size_request( spin , 10, -1 ); gtk_widget_set_can_focus( spin, false ); } } @@ -998,35 +998,35 @@ ui::Window PatchInspector::BuildDialog(){ button.show(); hbox2.pack_end(button, TRUE, FALSE, 0); button.connect( "clicked", G_CALLBACK( OnBtnPatchAutoCap ), 0 ); - gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 ); + gtk_widget_set_size_request( button , 60, -1 ); } { auto button = ui::Button( "CAP" ); button.show(); hbox2.pack_end(button, TRUE, FALSE, 0); button.connect( "clicked", G_CALLBACK( OnBtnPatchdetails ), 0 ); - gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 ); + gtk_widget_set_size_request( button , 60, -1 ); } { auto button = ui::Button( "Set..." ); button.show(); hbox2.pack_end(button, TRUE, FALSE, 0); button.connect( "clicked", G_CALLBACK( OnBtnPatchreset ), 0 ); - gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 ); + gtk_widget_set_size_request( button , 60, -1 ); } { auto button = ui::Button( "Natural" ); button.show(); hbox2.pack_end(button, TRUE, FALSE, 0); button.connect( "clicked", G_CALLBACK( OnBtnPatchnatural ), 0 ); - gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 ); + gtk_widget_set_size_request( button , 60, -1 ); } { auto button = ui::Button( "Fit" ); button.show(); hbox2.pack_end(button, TRUE, FALSE, 0); button.connect( "clicked", G_CALLBACK( OnBtnPatchfit ), 0 ); - gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 ); + gtk_widget_set_size_request( button , 60, -1 ); } } } diff --git a/radiant/patchmanip.cpp b/radiant/patchmanip.cpp index 8f7c26a7..dc0772e4 100644 --- a/radiant/patchmanip.cpp +++ b/radiant/patchmanip.cpp @@ -862,7 +862,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, { auto label = ui::Label( "Width:" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1, + gtk_table_attach( table, label , 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); @@ -870,7 +870,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, { auto label = ui::Label( "Height:" ); label.show(); - gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2, + gtk_table_attach( table, label , 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); @@ -896,7 +896,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, D_ITEM( 31 ); // MAX_PATCH_SIZE is 32, so we should be able to do 31... #undef D_ITEM combo.show(); - gtk_table_attach( table, GTK_WIDGET( combo ), 1, 2, 0, 1, + gtk_table_attach( table, combo , 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -922,7 +922,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, D_ITEM( 31 ); // MAX_PATCH_SIZE is 32, so we should be able to do 31... #undef D_ITEM combo.show(); - gtk_table_attach( table, GTK_WIDGET( combo ), 1, 2, 1, 2, + gtk_table_attach( table, combo , 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -937,13 +937,13 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, auto button = create_dialog_button( "OK", G_CALLBACK( dialog_button_ok ), &dialog ); vbox.pack_start( button, FALSE, FALSE, 0 ); widget_make_default( button ); - gtk_widget_grab_focus( GTK_WIDGET( button ) ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_grab_focus( button ); + gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); } { auto button = create_dialog_button( "Cancel", G_CALLBACK( dialog_button_cancel ), &dialog ); vbox.pack_start( button, FALSE, FALSE, 0 ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); } } } @@ -999,35 +999,35 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){ { auto image = new_local_image( "cap_bevel.png" ); image.show(); - gtk_table_attach( table, GTK_WIDGET( image ), 0, 1, 0, 1, + gtk_table_attach( table, image , 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); } { auto image = new_local_image( "cap_endcap.png" ); image.show(); - gtk_table_attach( table, GTK_WIDGET( image ), 0, 1, 1, 2, + gtk_table_attach( table, image , 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); } { auto image = new_local_image( "cap_ibevel.png" ); image.show(); - gtk_table_attach( table, GTK_WIDGET( image ), 0, 1, 2, 3, + gtk_table_attach( table, image , 0, 1, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); } { auto image = new_local_image( "cap_iendcap.png" ); image.show(); - gtk_table_attach( table, GTK_WIDGET( image ), 0, 1, 3, 4, + gtk_table_attach( table, image , 0, 1, 3, 4, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); } { auto image = new_local_image( "cap_cylinder.png" ); image.show(); - gtk_table_attach( table, GTK_WIDGET( image ), 0, 1, 4, 5, + gtk_table_attach( table, image , 0, 1, 4, 5, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); } @@ -1093,12 +1093,12 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){ auto button = create_modal_dialog_button( "OK", ok_button ); vbox.pack_start( button, FALSE, FALSE, 0 ); widget_make_default( button ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_KEY_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); + gtk_widget_add_accelerator( button , "clicked", accel_group, GDK_KEY_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); } { auto button = create_modal_dialog_button( "Cancel", cancel_button ); vbox.pack_start( button, FALSE, FALSE, 0 ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_KEY_Escape, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); + gtk_widget_add_accelerator( button , "clicked", accel_group, GDK_KEY_Escape, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); } } } diff --git a/radiant/pluginmenu.cpp b/radiant/pluginmenu.cpp index cd05d714..c33be6a7 100644 --- a/radiant/pluginmenu.cpp +++ b/radiant/pluginmenu.cpp @@ -146,11 +146,11 @@ public: void PluginsMenu_clear(){ m_nNextPlugInID = 0; - GList* lst = g_list_find( gtk_container_get_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 ) ), g_plugins_menu_separator ); while ( lst->next ) { - g_plugins_menu.remove(ui::Widget(GTK_WIDGET(lst->next->data))); - lst = g_list_find( gtk_container_get_children( GTK_CONTAINER( g_plugins_menu ) ), GTK_WIDGET( g_plugins_menu_separator ) ); + g_plugins_menu.remove(ui::Widget::from(lst->next->data)); + lst = g_list_find( gtk_container_get_children( GTK_CONTAINER( g_plugins_menu ) ), g_plugins_menu_separator ); } } diff --git a/radiant/plugintoolbar.cpp b/radiant/plugintoolbar.cpp index 32b31c5a..6076616c 100644 --- a/radiant/plugintoolbar.cpp +++ b/radiant/plugintoolbar.cpp @@ -57,13 +57,13 @@ ui::Image new_plugin_image( const char* filename ){ void toolbar_insert( ui::Toolbar toolbar, const char* icon, const char* text, const char* tooltip, IToolbarButton::EType type, GCallback handler, gpointer data ){ if (type == IToolbarButton::eSpace) { - auto it = ui::Widget(GTK_WIDGET(gtk_separator_tool_item_new())); + auto it = ui::ToolItem(gtk_separator_tool_item_new()); it.show(); toolbar.add(it); return; } if (type == IToolbarButton::eButton) { - auto button = ui::ToolButton(GTK_TOOL_BUTTON(gtk_tool_button_new(GTK_WIDGET(new_plugin_image(icon)), text))); + auto button = ui::ToolButton(GTK_TOOL_BUTTON(gtk_tool_button_new(new_plugin_image(icon), text))); gtk_widget_set_tooltip_text(button, tooltip); gtk_widget_show_all(button); button.connect("clicked", G_CALLBACK(handler), data); @@ -72,7 +72,7 @@ void toolbar_insert( ui::Toolbar toolbar, const char* icon, const char* text, co } if (type == IToolbarButton::eToggleButton) { auto button = ui::ToolButton(GTK_TOOL_BUTTON(gtk_toggle_tool_button_new())); - gtk_tool_button_set_icon_widget(button, GTK_WIDGET(new_plugin_image(icon))); + gtk_tool_button_set_icon_widget(button, new_plugin_image(icon)); gtk_tool_button_set_label(button, text); gtk_widget_set_tooltip_text(button, tooltip); gtk_widget_show_all(button); diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index 9a3e826c..ed4daf52 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -326,7 +326,7 @@ ui::Window CGameDialog::BuildDialog(){ frame.add(vbox2); { - PreferencesPage preferencesPage( *this, ui::Widget(GTK_WIDGET( vbox2 )) ); + PreferencesPage preferencesPage( *this, ui::Widget(vbox2 ) ); Global_constructPreferences( preferencesPage ); CreateGlobalFrame( preferencesPage ); } @@ -482,7 +482,7 @@ CGameDialog g_GamesDialog; static void OnButtonClean( ui::Widget widget, gpointer data ){ // make sure this is what the user wants - if ( ui::Widget(GTK_WIDGET( g_Preferences.GetWidget() )).alert( "This will close Radiant and clean the corresponding registry entries.\n" + if ( ui::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", ui::alert_type::YESNO, ui::alert_icon::Asterisk ) == ui::alert_response::YES ) { PrefsDlg *dlg = (PrefsDlg*)data; diff --git a/radiant/select.cpp b/radiant/select.cpp index 33813fdb..26547427 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -946,13 +946,13 @@ void DoRotateDlg(){ auto adj = ui::Adjustment( 0, -359, 359, 1, 10, 0 ); auto spin = ui::SpinButton( adj, 1, 0 ); spin.show(); - gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 0, 1, + gtk_table_attach( table, spin , 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( spin ), 64, -1 ); + gtk_widget_set_size_request( spin , 64, -1 ); gtk_spin_button_set_wrap( spin, TRUE ); - gtk_widget_grab_focus( GTK_WIDGET( spin ) ); + gtk_widget_grab_focus( spin ); g_rotate_dialog.x = spin; } @@ -960,10 +960,10 @@ void DoRotateDlg(){ auto adj = ui::Adjustment( 0, -359, 359, 1, 10, 0 ); auto spin = ui::SpinButton( adj, 1, 0 ); spin.show(); - gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 1, 2, + gtk_table_attach( table, spin , 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( spin ), 64, -1 ); + gtk_widget_set_size_request( spin , 64, -1 ); gtk_spin_button_set_wrap( spin, TRUE ); g_rotate_dialog.y = spin; @@ -972,10 +972,10 @@ void DoRotateDlg(){ auto adj = ui::Adjustment( 0, -359, 359, 1, 10, 0 ); auto spin = ui::SpinButton( adj, 1, 0 ); spin.show(); - gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 2, 3, + gtk_table_attach( table, spin , 1, 2, 2, 3, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( spin ), 64, -1 ); + gtk_widget_set_size_request( spin , 64, -1 ); gtk_spin_button_set_wrap( spin, TRUE ); g_rotate_dialog.z = spin; @@ -988,12 +988,12 @@ void DoRotateDlg(){ auto button = create_dialog_button( "OK", G_CALLBACK( rotatedlg_ok ), &g_rotate_dialog ); vbox.pack_start( button, FALSE, FALSE, 0 ); widget_make_default( button ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); } { auto button = create_dialog_button( "Cancel", G_CALLBACK( rotatedlg_cancel ), &g_rotate_dialog ); vbox.pack_start( button, FALSE, FALSE, 0 ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); } { auto button = create_dialog_button( "Apply", G_CALLBACK( rotatedlg_apply ), &g_rotate_dialog ); @@ -1133,12 +1133,12 @@ void DoScaleDlg(){ auto button = create_dialog_button( "OK", G_CALLBACK( scaledlg_ok ), &g_scale_dialog ); vbox.pack_start( button, FALSE, FALSE, 0 ); widget_make_default( button ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); } { auto button = create_dialog_button( "Cancel", G_CALLBACK( scaledlg_cancel ), &g_scale_dialog ); vbox.pack_start( button, FALSE, FALSE, 0 ); - gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_add_accelerator( button , "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); } { auto button = create_dialog_button( "Apply", G_CALLBACK( scaledlg_apply ), &g_scale_dialog ); diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index ad0f7359..bef61cae 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -638,10 +638,10 @@ ui::Window SurfaceInspector::BuildDialog(){ m_hshiftIncrement.m_spin = spin; m_hshiftSpinner.connect( spin ); spin.show(); - gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 0, 1, + gtk_table_attach( GTK_TABLE( table ), spin , 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( spin ), 60, -1 ); + gtk_widget_set_size_request( spin , 60, -1 ); } { ui::Widget label = ui::Label( "Step" ); @@ -654,10 +654,10 @@ ui::Window SurfaceInspector::BuildDialog(){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 0, 1, + gtk_table_attach( GTK_TABLE( table ), entry , 3, 4, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 ); + gtk_widget_set_size_request( entry , 50, -1 ); m_hshiftIncrement.m_entry = entry; m_hshiftEntry.connect( entry ); } @@ -674,10 +674,10 @@ ui::Window SurfaceInspector::BuildDialog(){ m_vshiftIncrement.m_spin = spin; m_vshiftSpinner.connect( spin ); spin.show(); - gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 1, 2, + gtk_table_attach( GTK_TABLE( table ), spin , 1, 2, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( spin ), 60, -1 ); + gtk_widget_set_size_request( spin , 60, -1 ); } { ui::Widget label = ui::Label( "Step" ); @@ -690,10 +690,10 @@ ui::Window SurfaceInspector::BuildDialog(){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 1, 2, + gtk_table_attach( GTK_TABLE( table ), entry , 3, 4, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 ); + gtk_widget_set_size_request( entry , 50, -1 ); m_vshiftIncrement.m_entry = entry; m_vshiftEntry.connect( entry ); } @@ -710,10 +710,10 @@ ui::Window SurfaceInspector::BuildDialog(){ m_hscaleIncrement.m_spin = spin; m_hscaleSpinner.connect( spin ); spin.show(); - gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 2, 3, + gtk_table_attach( GTK_TABLE( table ), spin , 1, 2, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( spin ), 60, -1 ); + gtk_widget_set_size_request( spin , 60, -1 ); } { ui::Widget label = ui::Label( "Step" ); @@ -726,10 +726,10 @@ ui::Window SurfaceInspector::BuildDialog(){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 2, 3, + gtk_table_attach( GTK_TABLE( table ), entry , 3, 4, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 2, 3 ); - gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 ); + gtk_widget_set_size_request( entry , 50, -1 ); m_hscaleIncrement.m_entry = entry; m_hscaleEntry.connect( entry ); } @@ -746,10 +746,10 @@ ui::Window SurfaceInspector::BuildDialog(){ m_vscaleIncrement.m_spin = spin; m_vscaleSpinner.connect( spin ); spin.show(); - gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 3, 4, + gtk_table_attach( GTK_TABLE( table ), spin , 1, 2, 3, 4, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( spin ), 60, -1 ); + gtk_widget_set_size_request( spin , 60, -1 ); } { ui::Widget label = ui::Label( "Step" ); @@ -762,10 +762,10 @@ ui::Window SurfaceInspector::BuildDialog(){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 3, 4, + gtk_table_attach( GTK_TABLE( table ), entry , 3, 4, 3, 4, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 ); + gtk_widget_set_size_request( entry , 50, -1 ); m_vscaleIncrement.m_entry = entry; m_vscaleEntry.connect( entry ); } @@ -782,10 +782,10 @@ ui::Window SurfaceInspector::BuildDialog(){ m_rotateIncrement.m_spin = spin; m_rotateSpinner.connect( spin ); spin.show(); - gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 4, 5, + gtk_table_attach( GTK_TABLE( table ), spin , 1, 2, 4, 5, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( spin ), 60, -1 ); + gtk_widget_set_size_request( spin , 60, -1 ); gtk_spin_button_set_wrap( spin, TRUE ); } { @@ -799,10 +799,10 @@ ui::Window SurfaceInspector::BuildDialog(){ { auto entry = ui::Entry(ui::New); entry.show(); - gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 4, 5, + gtk_table_attach( GTK_TABLE( table ), entry , 3, 4, 4, 5, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 ); + gtk_widget_set_size_request( entry , 50, -1 ); m_rotateIncrement.m_entry = entry; m_rotateEntry.connect( entry ); } @@ -961,7 +961,7 @@ ui::Window SurfaceInspector::BuildDialog(){ { auto check = ui::CheckButton( getSurfaceFlagName( c * 8 + r ) ); check.show(); - gtk_table_attach( table, GTK_WIDGET( check ), c, c + 1, r, r + 1, + gtk_table_attach( table, check , c, c + 1, r, r + 1, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); *p++ = check; @@ -997,7 +997,7 @@ ui::Window SurfaceInspector::BuildDialog(){ { auto check = ui::CheckButton( getContentFlagName( c * 8 + r ) ); check.show(); - gtk_table_attach( table, GTK_WIDGET( check ), c, c + 1, r, r + 1, + gtk_table_attach( table, check , c, c + 1, r, r + 1, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( 0 ), 0, 0 ); *p++ = check; @@ -1007,7 +1007,7 @@ ui::Window SurfaceInspector::BuildDialog(){ } // not allowed to modify detail flag using Surface Inspector - gtk_widget_set_sensitive( GTK_WIDGET( m_contentFlags[BRUSH_DETAIL_FLAG] ), FALSE ); + gtk_widget_set_sensitive( ui::CheckButton(m_contentFlags[BRUSH_DETAIL_FLAG]), FALSE ); } } } @@ -1037,7 +1037,7 @@ ui::Window SurfaceInspector::BuildDialog(){ // Shamus: Textool goodies... ui::Widget frame = ui::Frame( "Textool" ); frame.show(); - vbox.pack_start( GTK_WIDGET( frame ), FALSE, FALSE, 0 ); + vbox.pack_start( frame , FALSE, FALSE, 0 ); { //Prolly should make this a member or global var, so the SI can draw on it... TexTool::g_textoolWin = glwidget_new( FALSE ); @@ -1059,7 +1059,7 @@ ui::Window SurfaceInspector::BuildDialog(){ { ui::Widget hbox = ui::HBox( FALSE, 5 ); hbox.show(); - vbox.pack_start( GTK_WIDGET( hbox ), FALSE, FALSE, 0 ); + vbox.pack_start( hbox , FALSE, FALSE, 0 ); // Checkboxes go here... (Flip X/Y) ui::Widget flipX = ui::CheckButton( "Flip X axis" ); ui::Widget flipY = ui::CheckButton( "Flip Y axis" ); diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index d37d68d9..5197d5e2 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -1694,7 +1694,7 @@ ui::MenuItem TextureBrowser_constructViewMenu( ui::Menu menu ){ if ( string_empty( g_pGameDescription->getKeyValue( "show_wads" ) ) ) { menu_separator( menu ); - g_TextureBrowser.m_shader_info_item = ui::Widget(GTK_WIDGET( create_menu_item_with_mnemonic( menu, "Shader Info", "ShaderInfo" ) )); + g_TextureBrowser.m_shader_info_item = ui::Widget(create_menu_item_with_mnemonic( menu, "Shader Info", "ShaderInfo" )); gtk_widget_set_sensitive( g_TextureBrowser.m_shader_info_item, FALSE ); } @@ -2035,7 +2035,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ TextureBrowser_createTreeViewTree(); - gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( g_TextureBrowser.m_scr_win_tree ), GTK_WIDGET( g_TextureBrowser.m_treeViewTree ) ); + gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( g_TextureBrowser.m_scr_win_tree ), g_TextureBrowser.m_treeViewTree ); g_TextureBrowser.m_treeViewTree.show(); } { // gl_widget scrollbar @@ -2096,7 +2096,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ) ); gtk_tree_selection_set_mode( selection, GTK_SELECTION_MULTIPLE ); - gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( g_TextureBrowser.m_scr_win_tags ), GTK_WIDGET( g_TextureBrowser.m_treeViewTags ) ); + gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( g_TextureBrowser.m_scr_win_tags ), g_TextureBrowser.m_treeViewTags ); g_TextureBrowser.m_treeViewTags.show(); } { // Texture/Tag notebook @@ -2145,7 +2145,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ g_TextureBrowser.m_assigned_tree.show(); scrolled_win.show(); - gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_WIDGET( g_TextureBrowser.m_assigned_tree ) ); + gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( scrolled_win ), g_TextureBrowser.m_assigned_tree ); gtk_table_attach( GTK_TABLE( frame_table ), scrolled_win, 0, 1, 1, 3, GTK_FILL, GTK_FILL, 0, 0 ); } @@ -2173,7 +2173,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ g_TextureBrowser.m_available_tree.show(); scrolled_win.show(); - gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_WIDGET( g_TextureBrowser.m_available_tree ) ); + gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( scrolled_win ), g_TextureBrowser.m_available_tree ); gtk_table_attach( GTK_TABLE( frame_table ), scrolled_win, 2, 3, 1, 3, GTK_FILL, GTK_FILL, 0, 0 ); } @@ -2320,7 +2320,7 @@ void TextureBrowser_renameTag(){ } else { - ui::Widget(GTK_WIDGET( g_TextureBrowser.m_parent )).alert( "Select a single tag for renaming." ); + ui::Widget(g_TextureBrowser.m_parent ).alert( "Select a single tag for renaming." ); } } @@ -2331,7 +2331,7 @@ 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 - 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 ); + auto result = ui::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 == ui::alert_response::YES ) { GtkTreeIter iterSelected; @@ -2360,7 +2360,7 @@ void TextureBrowser_deleteTag(){ } } else { - ui::Widget(GTK_WIDGET( g_TextureBrowser.m_parent )).alert( "Select a single tag for deletion." ); + ui::Widget(g_TextureBrowser.m_parent ).alert( "Select a single tag for deletion." ); } } @@ -2452,7 +2452,7 @@ void TextureBrowser_showAll(){ } void TextureBrowser_showUntagged(){ - 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 ); + auto result = ui::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 == ui::alert_response::YES ) { g_TextureBrowser.m_found_shaders.clear(); diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index 40f881d1..9203f964 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -551,7 +551,7 @@ void WXY_Print(){ unsigned char* img; const char* filename; - filename = ui::file_dialog( GTK_WIDGET( MainFrame_getWindow() ), FALSE, "Save Image", 0, FILTER_BMP ); + filename = ui::file_dialog( MainFrame_getWindow( ), FALSE, "Save Image", 0, FILTER_BMP ); if ( !filename ) { return; } @@ -1113,7 +1113,7 @@ void pushMenu( const CopiedString& name ){ m_stack.back().first.add(item); auto submenu = ui::Menu(ui::New); - gtk_menu_item_set_submenu( item, GTK_WIDGET( submenu ) ); + gtk_menu_item_set_submenu( item, submenu ); m_stack.push_back( MenuPair( submenu, name ) ); } -- 2.39.2