X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=blobdiff_plain;f=radiant%2Ftexwindow.cpp;h=d37d68d9466cc0aa37ac27e2a38f6ac23fc2d114;hp=1ab87084eea7fc6802c58b3f74ecced8384d1c85;hb=2951e448a7f008f2438be4bd5feba2e4f4400eef;hpb=ad14a7caf74c23e01b967550daef6585a08cccaa diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 1ab87084..d37d68d9 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -27,6 +27,8 @@ #include "texwindow.h" +#include + #include "debugging/debugging.h" #include "warnings.h" @@ -40,12 +42,7 @@ #include #include -#include -#include -#include -#include -#include -#include +#include #include "signal/signal.h" #include "math/vector.h" @@ -210,7 +207,7 @@ void value_changed( gdouble value ){ } } static void adjustment_value_changed( GtkAdjustment *adjustment, DeferredAdjustment* self ){ - self->value_changed( adjustment->value ); + self->value_changed( gtk_adjustment_get_value(adjustment) ); } }; @@ -259,24 +256,24 @@ int m_nTotalHeight; CopiedString shader; -GtkWindow* m_parent; -GtkWidget* m_gl_widget; -GtkWidget* m_texture_scroll; -GtkWidget* m_treeViewTree; -GtkWidget* m_treeViewTags; -GtkWidget* m_tag_frame; -GtkListStore* m_assigned_store; -GtkListStore* m_available_store; -GtkWidget* m_assigned_tree; -GtkWidget* m_available_tree; -GtkWidget* m_scr_win_tree; -GtkWidget* m_scr_win_tags; -GtkWidget* m_tag_notebook; -GtkWidget* m_search_button; -GtkWidget* m_shader_info_item; +ui::Window m_parent{ui::null}; +ui::GLArea m_gl_widget{ui::null}; +ui::Widget m_texture_scroll{ui::null}; +ui::Widget m_treeViewTree{ui::null}; +ui::Widget m_treeViewTags{ui::null}; +ui::Frame m_tag_frame{ui::null}; +ui::ListStore m_assigned_store{ui::null}; +ui::ListStore m_available_store{ui::null}; +ui::Widget m_assigned_tree{ui::null}; +ui::Widget m_available_tree{ui::null}; +ui::Widget m_scr_win_tree{ui::null}; +ui::Widget m_scr_win_tags{ui::null}; +ui::Widget m_tag_notebook{ui::null}; +ui::Button m_search_button{ui::null}; +ui::Widget m_shader_info_item{ui::null}; std::set m_all_tags; -GtkListStore* m_all_tags_list; +ui::ListStore m_all_tags_list{ui::null}; std::vector m_copied_tags; std::set m_found_shaders; @@ -352,11 +349,11 @@ int getTextureHeight( qtexture_t* tex ){ TextureBrowser() : m_texture_scroll( 0 ), m_hideunused_item( TextureBrowserHideUnusedExport() ), + m_hidenotex_item( TextureBrowserFilterFallbackExport() ), m_showshaders_item( TextureBrowserShowShadersExport() ), m_showshaderlistonly_item( TextureBrowserShowShaderlistOnlyExport() ), m_fixedsize_item( TextureBrowserFixedSizeExport() ), m_filternotex_item( TextureBrowserFilterMissingExport() ), - m_hidenotex_item( TextureBrowserFilterFallbackExport() ), m_enablealpha_item( TextureBrowserEnableAlphaExport() ), m_heightChanged( true ), m_originInvalid( true ), @@ -677,7 +674,7 @@ void TextureBrowser_activeShadersChanged( TextureBrowser& textureBrowser ){ void TextureBrowser_importShowScrollbar( TextureBrowser& textureBrowser, bool value ){ textureBrowser.m_showTextureScrollbar = value; if ( textureBrowser.m_texture_scroll != 0 ) { - widget_set_visible( textureBrowser.m_texture_scroll, textureBrowser.m_showTextureScrollbar ); + textureBrowser.m_texture_scroll.visible(textureBrowser.m_showTextureScrollbar); TextureBrowser_updateScroll( textureBrowser ); } } @@ -741,7 +738,7 @@ void visit( const char* name ){ void TextureBrowser_SetHideUnused( TextureBrowser& textureBrowser, bool hideUnused ); -GtkWidget* g_page_textures; +ui::Widget g_page_textures{ui::null}; void TextureBrowser_toggleShow(){ GroupDialog_showPage( g_page_textures ); @@ -1258,7 +1255,7 @@ void Texture_Draw( TextureBrowser& textureBrowser ){ } void TextureBrowser_queueDraw( TextureBrowser& textureBrowser ){ - if ( textureBrowser.m_gl_widget != 0 ) { + if ( textureBrowser.m_gl_widget ) { gtk_widget_queue_draw( textureBrowser.m_gl_widget ); } } @@ -1299,23 +1296,22 @@ enum N_COLUMNS }; -void BuildStoreAssignedTags( GtkListStore* store, const char* shader, TextureBrowser* textureBrowser ){ +void BuildStoreAssignedTags( ui::ListStore store, const char* shader, TextureBrowser* textureBrowser ){ GtkTreeIter iter; - gtk_list_store_clear( store ); + store.clear(); std::vector assigned_tags; TagBuilder.GetShaderTags( shader, assigned_tags ); for ( size_t i = 0; i < assigned_tags.size(); i++ ) { - gtk_list_store_append( store, &iter ); - gtk_list_store_set( store, &iter, TAG_COLUMN, assigned_tags[i].c_str(), -1 ); + store.append(TAG_COLUMN, assigned_tags[i].c_str()); } } -void BuildStoreAvailableTags( GtkListStore* storeAvailable, - GtkListStore* storeAssigned, +void BuildStoreAvailableTags( ui::ListStore storeAvailable, + ui::ListStore storeAssigned, const std::set& allTags, TextureBrowser* textureBrowser ){ GtkTreeIter iterAssigned; @@ -1323,15 +1319,14 @@ void BuildStoreAvailableTags( GtkListStore* storeAvailable, std::set::const_iterator iterAll; gchar* tag_assigned; - gtk_list_store_clear( storeAvailable ); + storeAvailable.clear(); bool row = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( storeAssigned ), &iterAssigned ) != 0; if ( !row ) { // does the shader have tags assigned? for ( iterAll = allTags.begin(); iterAll != allTags.end(); ++iterAll ) { - gtk_list_store_append( storeAvailable, &iterAvailable ); - gtk_list_store_set( storeAvailable, &iterAvailable, TAG_COLUMN, ( *iterAll ).c_str(), -1 ); + storeAvailable.append(TAG_COLUMN, (*iterAll).c_str()); } } else @@ -1343,8 +1338,7 @@ void BuildStoreAvailableTags( GtkListStore* storeAvailable, for ( iterAll = allTags.begin(); iterAll != allTags.end(); ++iterAll ) { if ( strcmp( (char*)tag_assigned, ( *iterAll ).c_str() ) != 0 ) { - gtk_list_store_append( storeAvailable, &iterAvailable ); - gtk_list_store_set( storeAvailable, &iterAvailable, TAG_COLUMN, ( *iterAll ).c_str(), -1 ); + storeAvailable.append(TAG_COLUMN, (*iterAll).c_str()); } else { @@ -1359,7 +1353,7 @@ void BuildStoreAvailableTags( GtkListStore* storeAvailable, } } -gboolean TextureBrowser_button_press( GtkWidget* widget, GdkEventButton* event, TextureBrowser* textureBrowser ){ +gboolean TextureBrowser_button_press( ui::Widget widget, GdkEventButton* event, TextureBrowser* textureBrowser ){ if ( event->type == GDK_BUTTON_PRESS ) { if ( event->button == 3 ) { if ( GlobalTextureBrowser().m_tags ) { @@ -1369,9 +1363,9 @@ gboolean TextureBrowser_button_press( GtkWidget* widget, GdkEventButton* event, BuildStoreAssignedTags( textureBrowser->m_assigned_store, textureBrowser->shader.c_str(), textureBrowser ); BuildStoreAvailableTags( textureBrowser->m_available_store, textureBrowser->m_assigned_store, textureBrowser->m_all_tags, textureBrowser ); textureBrowser->m_heightChanged = true; - gtk_widget_show( textureBrowser->m_tag_frame ); + textureBrowser->m_tag_frame.show(); - process_gui(); + ui::process(); TextureBrowser_Focus( *textureBrowser, textureBrowser->shader.c_str() ); } @@ -1385,14 +1379,14 @@ gboolean TextureBrowser_button_press( GtkWidget* widget, GdkEventButton* event, if ( GlobalTextureBrowser().m_tags ) { textureBrowser->m_rmbSelected = false; - gtk_widget_hide( textureBrowser->m_tag_frame ); + textureBrowser->m_tag_frame.hide(); } } } return FALSE; } -gboolean TextureBrowser_button_release( GtkWidget* widget, GdkEventButton* event, TextureBrowser* textureBrowser ){ +gboolean TextureBrowser_button_release( ui::Widget widget, GdkEventButton* event, TextureBrowser* textureBrowser ){ if ( event->type == GDK_BUTTON_RELEASE ) { if ( event->button == 3 ) { if ( !GlobalTextureBrowser().m_tags ) { @@ -1403,11 +1397,11 @@ gboolean TextureBrowser_button_release( GtkWidget* widget, GdkEventButton* event return FALSE; } -gboolean TextureBrowser_motion( GtkWidget *widget, GdkEventMotion *event, TextureBrowser* textureBrowser ){ +gboolean TextureBrowser_motion( ui::Widget widget, GdkEventMotion *event, TextureBrowser* textureBrowser ){ return FALSE; } -gboolean TextureBrowser_scroll( GtkWidget* widget, GdkEventScroll* event, TextureBrowser* textureBrowser ){ +gboolean TextureBrowser_scroll( ui::Widget widget, GdkEventScroll* event, TextureBrowser* textureBrowser ){ if ( event->direction == GDK_SCROLL_UP ) { TextureBrowser_MouseWheel( *textureBrowser, true ); } @@ -1423,7 +1417,7 @@ void TextureBrowser_scrollChanged( void* data, gdouble value ){ } static void TextureBrowser_verticalScroll( GtkAdjustment *adjustment, TextureBrowser* textureBrowser ){ - textureBrowser->m_scrollAdjustment.value_changed( adjustment->value ); + textureBrowser->m_scrollAdjustment.value_changed( gtk_adjustment_get_value(adjustment) ); } void TextureBrowser_updateScroll( TextureBrowser& textureBrowser ){ @@ -1434,18 +1428,18 @@ void TextureBrowser_updateScroll( TextureBrowser& textureBrowser ){ GtkAdjustment *vadjustment = gtk_range_get_adjustment( GTK_RANGE( textureBrowser.m_texture_scroll ) ); - vadjustment->value = -TextureBrowser_getOriginY( textureBrowser ); - vadjustment->page_size = textureBrowser.height; - vadjustment->page_increment = textureBrowser.height / 2; - vadjustment->step_increment = 20; - vadjustment->lower = 0; - vadjustment->upper = totalHeight; + gtk_adjustment_set_value(vadjustment, -TextureBrowser_getOriginY( textureBrowser )); + gtk_adjustment_set_page_size(vadjustment, textureBrowser.height); + gtk_adjustment_set_page_increment(vadjustment, textureBrowser.height / 2); + gtk_adjustment_set_step_increment(vadjustment, 20); + gtk_adjustment_set_lower(vadjustment, 0); + gtk_adjustment_set_upper(vadjustment, totalHeight); g_signal_emit_by_name( G_OBJECT( vadjustment ), "changed" ); } } -gboolean TextureBrowser_size_allocate( GtkWidget* widget, GtkAllocation* allocation, TextureBrowser* textureBrowser ){ +gboolean TextureBrowser_size_allocate( ui::Widget widget, GtkAllocation* allocation, TextureBrowser* textureBrowser ){ textureBrowser->width = allocation->width; textureBrowser->height = allocation->height; TextureBrowser_heightChanged( *textureBrowser ); @@ -1454,7 +1448,7 @@ gboolean TextureBrowser_size_allocate( GtkWidget* widget, GtkAllocation* allocat return FALSE; } -gboolean TextureBrowser_expose( GtkWidget* widget, GdkEventExpose* event, TextureBrowser* textureBrowser ){ +gboolean TextureBrowser_expose( ui::Widget widget, GdkEventExpose* event, TextureBrowser* textureBrowser ){ if ( glwidget_make_current( textureBrowser->m_gl_widget ) != FALSE ) { GlobalOpenGL_debugAssertNoErrors(); TextureBrowser_evaluateHeight( *textureBrowser ); @@ -1590,14 +1584,13 @@ void TreeView_onRowActivated( GtkTreeView* treeview, GtkTreePath* path, GtkTreeV } void TextureBrowser_createTreeViewTree(){ - GtkCellRenderer* renderer; - g_TextureBrowser.m_treeViewTree = GTK_WIDGET( gtk_tree_view_new() ); + g_TextureBrowser.m_treeViewTree = ui::TreeView(ui::New); gtk_tree_view_set_enable_search( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), FALSE ); gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), FALSE ); - g_signal_connect( g_TextureBrowser.m_treeViewTree, "row-activated", (GCallback) TreeView_onRowActivated, NULL ); + g_TextureBrowser.m_treeViewTree.connect( "row-activated", (GCallback) TreeView_onRowActivated, NULL ); - renderer = gtk_cell_renderer_text_new(); + auto renderer = ui::CellRendererText(ui::New); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), -1, "", renderer, "text", 0, NULL ); TextureBrowser_constructTreeStore(); @@ -1607,19 +1600,19 @@ void TextureBrowser_addTag(); void TextureBrowser_renameTag(); void TextureBrowser_deleteTag(); -void TextureBrowser_createContextMenu( GtkWidget *treeview, GdkEventButton *event ){ - GtkWidget* menu = gtk_menu_new(); +void TextureBrowser_createContextMenu( ui::Widget treeview, GdkEventButton *event ){ + ui::Widget menu = ui::Menu(ui::New); - GtkWidget* menuitem = gtk_menu_item_new_with_label( "Add tag" ); - g_signal_connect( menuitem, "activate", (GCallback)TextureBrowser_addTag, treeview ); + ui::Widget menuitem = ui::MenuItem( "Add tag" ); + menuitem.connect( "activate", (GCallback)TextureBrowser_addTag, treeview ); gtk_menu_shell_append( GTK_MENU_SHELL( menu ), menuitem ); - menuitem = gtk_menu_item_new_with_label( "Rename tag" ); - g_signal_connect( menuitem, "activate", (GCallback)TextureBrowser_renameTag, treeview ); + menuitem = ui::MenuItem( "Rename tag" ); + menuitem.connect( "activate", (GCallback)TextureBrowser_renameTag, treeview ); gtk_menu_shell_append( GTK_MENU_SHELL( menu ), menuitem ); - menuitem = gtk_menu_item_new_with_label( "Delete tag" ); - g_signal_connect( menuitem, "activate", (GCallback)TextureBrowser_deleteTag, treeview ); + menuitem = ui::MenuItem( "Delete tag" ); + menuitem.connect( "activate", (GCallback)TextureBrowser_deleteTag, treeview ); gtk_menu_shell_append( GTK_MENU_SHELL( menu ), menuitem ); gtk_widget_show_all( menu ); @@ -1629,7 +1622,7 @@ void TextureBrowser_createContextMenu( GtkWidget *treeview, GdkEventButton *even gdk_event_get_time( (GdkEvent*)event ) ); } -gboolean TreeViewTags_onButtonPressed( GtkWidget *treeview, GdkEventButton *event ){ +gboolean TreeViewTags_onButtonPressed( ui::Widget treeview, GdkEventButton *event ){ if ( event->type == GDK_BUTTON_PRESS && event->button == 3 ) { GtkTreePath *path; GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( treeview ) ); @@ -1647,22 +1640,21 @@ gboolean TreeViewTags_onButtonPressed( GtkWidget *treeview, GdkEventButton *even } void TextureBrowser_createTreeViewTags(){ - GtkCellRenderer* renderer; - g_TextureBrowser.m_treeViewTags = GTK_WIDGET( gtk_tree_view_new() ); + g_TextureBrowser.m_treeViewTags = ui::TreeView(ui::New); gtk_tree_view_set_enable_search( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), FALSE ); - g_signal_connect( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), "button-press-event", (GCallback)TreeViewTags_onButtonPressed, NULL ); + g_TextureBrowser.m_treeViewTags.connect( "button-press-event", (GCallback)TreeViewTags_onButtonPressed, NULL ); gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), FALSE ); - renderer = gtk_cell_renderer_text_new(); + auto renderer = ui::CellRendererText(ui::New); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), -1, "", renderer, "text", 0, NULL ); TextureBrowser_constructTreeStoreTags(); } -GtkMenuItem* TextureBrowser_constructViewMenu( GtkMenu* menu ){ - GtkMenuItem* textures_menu_item = new_sub_menu_item_with_mnemonic( "_View" ); +ui::MenuItem TextureBrowser_constructViewMenu( ui::Menu menu ){ + ui::MenuItem textures_menu_item = ui::MenuItem(new_sub_menu_item_with_mnemonic( "_View" )); if ( g_Layout_enableDetachableMenus.m_value ) { menu_tearoff( menu ); @@ -1702,7 +1694,7 @@ GtkMenuItem* TextureBrowser_constructViewMenu( GtkMenu* menu ){ if ( string_empty( g_pGameDescription->getKeyValue( "show_wads" ) ) ) { menu_separator( menu ); - g_TextureBrowser.m_shader_info_item = GTK_WIDGET( create_menu_item_with_mnemonic( menu, "Shader Info", "ShaderInfo" ) ); + g_TextureBrowser.m_shader_info_item = ui::Widget(GTK_WIDGET( create_menu_item_with_mnemonic( menu, "Shader Info", "ShaderInfo" ) )); gtk_widget_set_sensitive( g_TextureBrowser.m_shader_info_item, FALSE ); } @@ -1710,8 +1702,8 @@ GtkMenuItem* TextureBrowser_constructViewMenu( GtkMenu* menu ){ return textures_menu_item; } -GtkMenuItem* TextureBrowser_constructToolsMenu( GtkMenu* menu ){ - GtkMenuItem* textures_menu_item = new_sub_menu_item_with_mnemonic( "_Tools" ); +ui::MenuItem TextureBrowser_constructToolsMenu( ui::Menu menu ){ + ui::MenuItem textures_menu_item = ui::MenuItem(new_sub_menu_item_with_mnemonic( "_Tools" )); if ( g_Layout_enableDetachableMenus.m_value ) { menu_tearoff( menu ); @@ -1723,8 +1715,8 @@ GtkMenuItem* TextureBrowser_constructToolsMenu( GtkMenu* menu ){ return textures_menu_item; } -GtkMenuItem* TextureBrowser_constructTagsMenu( GtkMenu* menu ){ - GtkMenuItem* textures_menu_item = new_sub_menu_item_with_mnemonic( "T_ags" ); +ui::MenuItem TextureBrowser_constructTagsMenu( ui::Menu menu ){ + ui::MenuItem textures_menu_item = ui::MenuItem(new_sub_menu_item_with_mnemonic( "T_ags" )); if ( g_Layout_enableDetachableMenus.m_value ) { menu_tearoff( menu ); @@ -1786,8 +1778,7 @@ void TextureBrowser_assignTags(){ TagBuilder.AddShaderTag( g_TextureBrowser.shader.c_str(), (char*)tag_assigned, TAG ); gtk_list_store_remove( g_TextureBrowser.m_available_store, &iter ); - gtk_list_store_append( g_TextureBrowser.m_assigned_store, &iter ); - gtk_list_store_set( g_TextureBrowser.m_assigned_store, &iter, TAG_COLUMN, (char*)tag_assigned, -1 ); + g_TextureBrowser.m_assigned_store.append(TAG_COLUMN, tag_assigned); } } } @@ -1837,15 +1828,13 @@ void TextureBrowser_removeTags(){ } void TextureBrowser_buildTagList(){ - GtkTreeIter treeIter; - gtk_list_store_clear( g_TextureBrowser.m_all_tags_list ); + g_TextureBrowser.m_all_tags_list.clear(); std::set::iterator iter; for ( iter = g_TextureBrowser.m_all_tags.begin(); iter != g_TextureBrowser.m_all_tags.end(); ++iter ) { - gtk_list_store_append( g_TextureBrowser.m_all_tags_list, &treeIter ); - gtk_list_store_set( g_TextureBrowser.m_all_tags_list, &treeIter, TAG_COLUMN, ( *iter ).c_str(), -1 ); + g_TextureBrowser.m_all_tags_list.append(TAG_COLUMN, (*iter).c_str()); } } @@ -1926,31 +1915,29 @@ void TextureBrowser_toggleSearchButton(){ gtk_widget_show_all( g_TextureBrowser.m_search_button ); } else { - gtk_widget_hide_all( g_TextureBrowser.m_search_button ); + g_TextureBrowser.m_search_button.hide(); } } void TextureBrowser_constructTagNotebook(){ - g_TextureBrowser.m_tag_notebook = gtk_notebook_new(); - GtkWidget* labelTags = gtk_label_new( "Tags" ); - GtkWidget* labelTextures = gtk_label_new( "Textures" ); + g_TextureBrowser.m_tag_notebook = ui::Widget(gtk_notebook_new()); + ui::Widget labelTags = ui::Label( "Tags" ); + ui::Widget labelTextures = ui::Label( "Textures" ); gtk_notebook_append_page( GTK_NOTEBOOK( g_TextureBrowser.m_tag_notebook ), g_TextureBrowser.m_scr_win_tree, labelTextures ); gtk_notebook_append_page( GTK_NOTEBOOK( g_TextureBrowser.m_tag_notebook ), g_TextureBrowser.m_scr_win_tags, labelTags ); - g_signal_connect( G_OBJECT( g_TextureBrowser.m_tag_notebook ), "switch-page", G_CALLBACK( TextureBrowser_toggleSearchButton ), NULL ); + g_TextureBrowser.m_tag_notebook.connect( "switch-page", G_CALLBACK( TextureBrowser_toggleSearchButton ), NULL ); gtk_widget_show_all( g_TextureBrowser.m_tag_notebook ); } void TextureBrowser_constructSearchButton(){ - GtkTooltips* tooltips = gtk_tooltips_new(); - - GtkWidget* image = gtk_image_new_from_stock( GTK_STOCK_FIND, GTK_ICON_SIZE_SMALL_TOOLBAR ); - g_TextureBrowser.m_search_button = gtk_button_new(); - g_signal_connect( G_OBJECT( g_TextureBrowser.m_search_button ), "clicked", G_CALLBACK( TextureBrowser_searchTags ), NULL ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), g_TextureBrowser.m_search_button, "Search with selected tags", "Search with selected tags" ); - gtk_container_add( GTK_CONTAINER( g_TextureBrowser.m_search_button ), image ); + ui::Widget image = ui::Widget(gtk_image_new_from_stock( GTK_STOCK_FIND, GTK_ICON_SIZE_SMALL_TOOLBAR )); + g_TextureBrowser.m_search_button = ui::Button(ui::New); + g_TextureBrowser.m_search_button.connect( "clicked", G_CALLBACK( TextureBrowser_searchTags ), NULL ); + gtk_widget_set_tooltip_text(g_TextureBrowser.m_search_button, "Search with selected tags"); + g_TextureBrowser.m_search_button.add(image); } void TextureBrowser_checkTagFile(){ @@ -1996,12 +1983,12 @@ void TextureBrowser_SetNotex(){ name << GlobalRadiant().getAppPath() << "bitmaps/" NOTEX_BASENAME ".png"; g_notex = name.c_str(); - name = NULL; + name = StringOutputStream(256); name << GlobalRadiant().getAppPath() << "bitmaps/" SHADERNOTEX_BASENAME " .png"; g_shadernotex = name.c_str(); } -GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){ +ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ // The gl_widget and the tag assignment frame should be packed into a GtkVPaned with the slider // position stored in local.pref. gtk_paned_get_position() and gtk_paned_set_position() don't // seem to work in gtk 2.4 and the arrow buttons don't handle GTK_FILL, so here's another thing @@ -2014,77 +2001,77 @@ GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){ g_TextureBrowser.m_parent = toplevel; - GtkWidget* table = gtk_table_new( 3, 3, FALSE ); - GtkWidget* frame_table = NULL; - GtkWidget* vbox = gtk_vbox_new( FALSE, 0 ); + ui::Widget table = ui::Table( 3, 3, FALSE ); + ui::Widget frame_table{ui::null}; + auto vbox = ui::VBox(FALSE, 0); gtk_table_attach( GTK_TABLE( table ), vbox, 0, 1, 1, 3, GTK_FILL, GTK_FILL, 0, 0 ); - gtk_widget_show( vbox ); + vbox.show(); - GtkWidget* menu_bar; + ui::Widget menu_bar{ui::null}; { // menu bar - menu_bar = gtk_menu_bar_new(); - GtkWidget* menu_view = gtk_menu_new(); - GtkWidget* view_item = (GtkWidget*)TextureBrowser_constructViewMenu( GTK_MENU( menu_view ) ); + menu_bar = ui::Widget(gtk_menu_bar_new()); + auto menu_view = ui::Menu(ui::New); + auto view_item = TextureBrowser_constructViewMenu( menu_view ); gtk_menu_item_set_submenu( GTK_MENU_ITEM( view_item ), menu_view ); - gtk_menu_bar_append( GTK_MENU_BAR( menu_bar ), view_item ); + gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), view_item ); - GtkWidget* menu_tools = gtk_menu_new(); - GtkWidget* tools_item = (GtkWidget*)TextureBrowser_constructToolsMenu( GTK_MENU( menu_tools ) ); + auto menu_tools = ui::Menu(ui::New); + auto tools_item = TextureBrowser_constructToolsMenu( menu_tools ); gtk_menu_item_set_submenu( GTK_MENU_ITEM( tools_item ), menu_tools ); - gtk_menu_bar_append( GTK_MENU_BAR( menu_bar ), tools_item ); + gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), tools_item ); gtk_table_attach( GTK_TABLE( table ), menu_bar, 0, 3, 0, 1, GTK_FILL, GTK_SHRINK, 0, 0 ); - gtk_widget_show( menu_bar ); + menu_bar.show(); } { // Texture TreeView - g_TextureBrowser.m_scr_win_tree = gtk_scrolled_window_new( NULL, NULL ); + g_TextureBrowser.m_scr_win_tree = ui::ScrolledWindow(ui::New); gtk_container_set_border_width( GTK_CONTAINER( g_TextureBrowser.m_scr_win_tree ), 0 ); // vertical only scrolling for treeview gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( g_TextureBrowser.m_scr_win_tree ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS ); - gtk_widget_show( g_TextureBrowser.m_scr_win_tree ); + g_TextureBrowser.m_scr_win_tree.show(); TextureBrowser_createTreeViewTree(); gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( g_TextureBrowser.m_scr_win_tree ), GTK_WIDGET( g_TextureBrowser.m_treeViewTree ) ); - gtk_widget_show( GTK_WIDGET( g_TextureBrowser.m_treeViewTree ) ); + g_TextureBrowser.m_treeViewTree.show(); } { // gl_widget scrollbar - GtkWidget* w = gtk_vscrollbar_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,0,1,1,0 ) ) ); + ui::Widget w = ui::Widget(gtk_vscrollbar_new( ui::Adjustment( 0,0,0,1,1,0 ) )); gtk_table_attach( GTK_TABLE( table ), w, 2, 3, 1, 2, GTK_SHRINK, GTK_FILL, 0, 0 ); - gtk_widget_show( w ); + w.show(); g_TextureBrowser.m_texture_scroll = w; - GtkAdjustment *vadjustment = gtk_range_get_adjustment( GTK_RANGE( g_TextureBrowser.m_texture_scroll ) ); - g_signal_connect( G_OBJECT( vadjustment ), "value_changed", G_CALLBACK( TextureBrowser_verticalScroll ), &g_TextureBrowser ); + auto vadjustment = ui::Adjustment(gtk_range_get_adjustment( GTK_RANGE( g_TextureBrowser.m_texture_scroll ) )); + vadjustment.connect( "value_changed", G_CALLBACK( TextureBrowser_verticalScroll ), &g_TextureBrowser ); - widget_set_visible( g_TextureBrowser.m_texture_scroll, g_TextureBrowser.m_showTextureScrollbar ); + g_TextureBrowser.m_texture_scroll.visible(g_TextureBrowser.m_showTextureScrollbar); } { // gl_widget g_TextureBrowser.m_gl_widget = glwidget_new( FALSE ); - gtk_widget_ref( g_TextureBrowser.m_gl_widget ); + g_object_ref( g_TextureBrowser.m_gl_widget._handle ); gtk_widget_set_events( g_TextureBrowser.m_gl_widget, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK ); - GTK_WIDGET_SET_FLAGS( g_TextureBrowser.m_gl_widget, GTK_CAN_FOCUS ); + gtk_widget_set_can_focus( g_TextureBrowser.m_gl_widget, true ); gtk_table_attach_defaults( GTK_TABLE( table ), g_TextureBrowser.m_gl_widget, 1, 2, 1, 2 ); - gtk_widget_show( g_TextureBrowser.m_gl_widget ); + g_TextureBrowser.m_gl_widget.show(); - g_TextureBrowser.m_sizeHandler = g_signal_connect( G_OBJECT( g_TextureBrowser.m_gl_widget ), "size_allocate", G_CALLBACK( TextureBrowser_size_allocate ), &g_TextureBrowser ); - g_TextureBrowser.m_exposeHandler = g_signal_connect( G_OBJECT( g_TextureBrowser.m_gl_widget ), "expose_event", G_CALLBACK( TextureBrowser_expose ), &g_TextureBrowser ); + g_TextureBrowser.m_sizeHandler = g_TextureBrowser.m_gl_widget.connect( "size_allocate", G_CALLBACK( TextureBrowser_size_allocate ), &g_TextureBrowser ); + g_TextureBrowser.m_exposeHandler = g_TextureBrowser.m_gl_widget.on_render( G_CALLBACK( TextureBrowser_expose ), &g_TextureBrowser ); - g_signal_connect( G_OBJECT( g_TextureBrowser.m_gl_widget ), "button_press_event", G_CALLBACK( TextureBrowser_button_press ), &g_TextureBrowser ); - g_signal_connect( G_OBJECT( g_TextureBrowser.m_gl_widget ), "button_release_event", G_CALLBACK( TextureBrowser_button_release ), &g_TextureBrowser ); - g_signal_connect( G_OBJECT( g_TextureBrowser.m_gl_widget ), "motion_notify_event", G_CALLBACK( TextureBrowser_motion ), &g_TextureBrowser ); - g_signal_connect( G_OBJECT( g_TextureBrowser.m_gl_widget ), "scroll_event", G_CALLBACK( TextureBrowser_scroll ), &g_TextureBrowser ); + g_TextureBrowser.m_gl_widget.connect( "button_press_event", G_CALLBACK( TextureBrowser_button_press ), &g_TextureBrowser ); + g_TextureBrowser.m_gl_widget.connect( "button_release_event", G_CALLBACK( TextureBrowser_button_release ), &g_TextureBrowser ); + g_TextureBrowser.m_gl_widget.connect( "motion_notify_event", G_CALLBACK( TextureBrowser_motion ), &g_TextureBrowser ); + g_TextureBrowser.m_gl_widget.connect( "scroll_event", G_CALLBACK( TextureBrowser_scroll ), &g_TextureBrowser ); } // tag stuff if ( g_TextureBrowser.m_tags ) { { // fill tag GtkListStore - g_TextureBrowser.m_all_tags_list = gtk_list_store_new( N_COLUMNS, G_TYPE_STRING ); + g_TextureBrowser.m_all_tags_list = ui::ListStore(gtk_list_store_new( N_COLUMNS, G_TYPE_STRING )); GtkTreeSortable* sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_all_tags_list ); gtk_tree_sortable_set_sort_column_id( sortable, TAG_COLUMN, GTK_SORT_ASCENDING ); @@ -2092,13 +2079,13 @@ GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){ TextureBrowser_buildTagList(); } { // tag menu bar - GtkWidget* menu_tags = gtk_menu_new(); - GtkWidget* tags_item = (GtkWidget*)TextureBrowser_constructTagsMenu( GTK_MENU( menu_tags ) ); + auto menu_tags = ui::Menu(ui::New); + auto tags_item = TextureBrowser_constructTagsMenu( menu_tags ); gtk_menu_item_set_submenu( GTK_MENU_ITEM( tags_item ), menu_tags ); - gtk_menu_bar_append( GTK_MENU_BAR( menu_bar ), tags_item ); + gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), tags_item ); } { // Tag TreeView - g_TextureBrowser.m_scr_win_tags = gtk_scrolled_window_new( NULL, NULL ); + g_TextureBrowser.m_scr_win_tags = ui::ScrolledWindow(ui::New); gtk_container_set_border_width( GTK_CONTAINER( g_TextureBrowser.m_scr_win_tags ), 0 ); // vertical only scrolling for treeview @@ -2110,93 +2097,93 @@ GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){ 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_widget_show( GTK_WIDGET( g_TextureBrowser.m_treeViewTags ) ); + g_TextureBrowser.m_treeViewTags.show(); } { // Texture/Tag notebook TextureBrowser_constructTagNotebook(); - gtk_box_pack_start( GTK_BOX( vbox ), g_TextureBrowser.m_tag_notebook, TRUE, TRUE, 0 ); + vbox.pack_start( g_TextureBrowser.m_tag_notebook, TRUE, TRUE, 0 ); } { // Tag search button TextureBrowser_constructSearchButton(); - gtk_box_pack_end( GTK_BOX( vbox ), g_TextureBrowser.m_search_button, FALSE, FALSE, 0 ); + vbox.pack_end(g_TextureBrowser.m_search_button, FALSE, FALSE, 0); } { // Tag frame - frame_table = gtk_table_new( 3, 3, FALSE ); + frame_table = ui::Table( 3, 3, FALSE ); - g_TextureBrowser.m_tag_frame = gtk_frame_new( "Tag assignment" ); + g_TextureBrowser.m_tag_frame = ui::Frame( "Tag assignment" ); gtk_frame_set_label_align( GTK_FRAME( g_TextureBrowser.m_tag_frame ), 0.5, 0.5 ); gtk_frame_set_shadow_type( GTK_FRAME( g_TextureBrowser.m_tag_frame ), GTK_SHADOW_NONE ); gtk_table_attach( GTK_TABLE( table ), g_TextureBrowser.m_tag_frame, 1, 3, 2, 3, GTK_FILL, GTK_SHRINK, 0, 0 ); - gtk_widget_show( frame_table ); + frame_table.show(); - gtk_container_add( GTK_CONTAINER( g_TextureBrowser.m_tag_frame ), frame_table ); + g_TextureBrowser.m_tag_frame.add(frame_table); } { // assigned tag list - GtkWidget* scrolled_win = gtk_scrolled_window_new( NULL, NULL ); + ui::Widget scrolled_win = ui::ScrolledWindow(ui::New); gtk_container_set_border_width( GTK_CONTAINER( scrolled_win ), 0 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS ); - g_TextureBrowser.m_assigned_store = gtk_list_store_new( N_COLUMNS, G_TYPE_STRING ); + g_TextureBrowser.m_assigned_store = ui::ListStore(gtk_list_store_new( N_COLUMNS, G_TYPE_STRING )); GtkTreeSortable* sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_assigned_store ); gtk_tree_sortable_set_sort_column_id( sortable, TAG_COLUMN, GTK_SORT_ASCENDING ); - GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); + auto renderer = ui::CellRendererText(ui::New); - g_TextureBrowser.m_assigned_tree = gtk_tree_view_new_with_model( GTK_TREE_MODEL( g_TextureBrowser.m_assigned_store ) ); - g_object_unref( G_OBJECT( g_TextureBrowser.m_assigned_store ) ); - g_signal_connect( g_TextureBrowser.m_assigned_tree, "row-activated", (GCallback) TextureBrowser_removeTags, NULL ); + g_TextureBrowser.m_assigned_tree = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( g_TextureBrowser.m_assigned_store ) )); + g_TextureBrowser.m_assigned_store.unref(); + g_TextureBrowser.m_assigned_tree.connect( "row-activated", (GCallback) TextureBrowser_removeTags, NULL ); gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_assigned_tree ), FALSE ); GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( g_TextureBrowser.m_assigned_tree ) ); gtk_tree_selection_set_mode( selection, GTK_SELECTION_MULTIPLE ); - GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", TAG_COLUMN, NULL ); + GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", TAG_COLUMN}} ); gtk_tree_view_append_column( GTK_TREE_VIEW( g_TextureBrowser.m_assigned_tree ), column ); - gtk_widget_show( g_TextureBrowser.m_assigned_tree ); + g_TextureBrowser.m_assigned_tree.show(); - gtk_widget_show( scrolled_win ); + scrolled_win.show(); gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_WIDGET( g_TextureBrowser.m_assigned_tree ) ); gtk_table_attach( GTK_TABLE( frame_table ), scrolled_win, 0, 1, 1, 3, GTK_FILL, GTK_FILL, 0, 0 ); } { // available tag list - GtkWidget* scrolled_win = gtk_scrolled_window_new( NULL, NULL ); + ui::Widget scrolled_win = ui::ScrolledWindow(ui::New); gtk_container_set_border_width( GTK_CONTAINER( scrolled_win ), 0 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS ); - g_TextureBrowser.m_available_store = gtk_list_store_new( N_COLUMNS, G_TYPE_STRING ); + g_TextureBrowser.m_available_store = ui::ListStore(gtk_list_store_new( N_COLUMNS, G_TYPE_STRING )); GtkTreeSortable* sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_available_store ); gtk_tree_sortable_set_sort_column_id( sortable, TAG_COLUMN, GTK_SORT_ASCENDING ); - GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); + auto renderer = ui::CellRendererText(ui::New); - g_TextureBrowser.m_available_tree = gtk_tree_view_new_with_model( GTK_TREE_MODEL( g_TextureBrowser.m_available_store ) ); - g_object_unref( G_OBJECT( g_TextureBrowser.m_available_store ) ); - g_signal_connect( g_TextureBrowser.m_available_tree, "row-activated", (GCallback) TextureBrowser_assignTags, NULL ); + g_TextureBrowser.m_available_tree = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( g_TextureBrowser.m_available_store ) )); + g_TextureBrowser.m_available_store.unref(); + g_TextureBrowser.m_available_tree.connect( "row-activated", (GCallback) TextureBrowser_assignTags, NULL ); gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_available_tree ), FALSE ); GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( g_TextureBrowser.m_available_tree ) ); gtk_tree_selection_set_mode( selection, GTK_SELECTION_MULTIPLE ); - GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", TAG_COLUMN, NULL ); + GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", TAG_COLUMN}} ); gtk_tree_view_append_column( GTK_TREE_VIEW( g_TextureBrowser.m_available_tree ), column ); - gtk_widget_show( g_TextureBrowser.m_available_tree ); + g_TextureBrowser.m_available_tree.show(); - gtk_widget_show( scrolled_win ); + scrolled_win.show(); gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_WIDGET( g_TextureBrowser.m_available_tree ) ); gtk_table_attach( GTK_TABLE( frame_table ), scrolled_win, 2, 3, 1, 3, GTK_FILL, GTK_FILL, 0, 0 ); } { // tag arrow buttons - GtkWidget* m_btn_left = gtk_button_new(); - GtkWidget* m_btn_right = gtk_button_new(); - GtkWidget* m_arrow_left = gtk_arrow_new( GTK_ARROW_LEFT, GTK_SHADOW_OUT ); - GtkWidget* m_arrow_right = gtk_arrow_new( GTK_ARROW_RIGHT, GTK_SHADOW_OUT ); - gtk_container_add( GTK_CONTAINER( m_btn_left ), m_arrow_left ); - gtk_container_add( GTK_CONTAINER( m_btn_right ), m_arrow_right ); + auto m_btn_left = ui::Button(ui::New); + auto m_btn_right = ui::Button(ui::New); + auto m_arrow_left = ui::Widget(gtk_arrow_new( GTK_ARROW_LEFT, GTK_SHADOW_OUT )); + auto m_arrow_right = ui::Widget(gtk_arrow_new( GTK_ARROW_RIGHT, GTK_SHADOW_OUT )); + m_btn_left.add(m_arrow_left); + m_btn_right.add(m_arrow_right); // workaround. the size of the tag frame depends of the requested size of the arrow buttons. gtk_widget_set_size_request( m_arrow_left, -1, 68 ); @@ -2205,27 +2192,27 @@ GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){ gtk_table_attach( GTK_TABLE( frame_table ), m_btn_left, 1, 2, 1, 2, GTK_SHRINK, GTK_EXPAND, 0, 0 ); gtk_table_attach( GTK_TABLE( frame_table ), m_btn_right, 1, 2, 2, 3, GTK_SHRINK, GTK_EXPAND, 0, 0 ); - g_signal_connect( G_OBJECT( m_btn_left ), "clicked", G_CALLBACK( TextureBrowser_assignTags ), NULL ); - g_signal_connect( G_OBJECT( m_btn_right ), "clicked", G_CALLBACK( TextureBrowser_removeTags ), NULL ); + m_btn_left.connect( "clicked", G_CALLBACK( TextureBrowser_assignTags ), NULL ); + m_btn_right.connect( "clicked", G_CALLBACK( TextureBrowser_removeTags ), NULL ); - gtk_widget_show( m_btn_left ); - gtk_widget_show( m_btn_right ); - gtk_widget_show( m_arrow_left ); - gtk_widget_show( m_arrow_right ); + m_btn_left.show(); + m_btn_right.show(); + m_arrow_left.show(); + m_arrow_right.show(); } { // tag fram labels - GtkWidget* m_lbl_assigned = gtk_label_new( "Assigned" ); - GtkWidget* m_lbl_unassigned = gtk_label_new( "Available" ); + ui::Widget m_lbl_assigned = ui::Label( "Assigned" ); + ui::Widget m_lbl_unassigned = ui::Label( "Available" ); gtk_table_attach( GTK_TABLE( frame_table ), m_lbl_assigned, 0, 1, 0, 1, GTK_EXPAND, GTK_SHRINK, 0, 0 ); gtk_table_attach( GTK_TABLE( frame_table ), m_lbl_unassigned, 2, 3, 0, 1, GTK_EXPAND, GTK_SHRINK, 0, 0 ); - gtk_widget_show( m_lbl_assigned ); - gtk_widget_show( m_lbl_unassigned ); + m_lbl_assigned.show(); + m_lbl_unassigned.show(); } } else { // no tag support, show the texture tree only - gtk_box_pack_start( GTK_BOX( vbox ), g_TextureBrowser.m_scr_win_tree, TRUE, TRUE, 0 ); + vbox.pack_start( g_TextureBrowser.m_scr_win_tree, TRUE, TRUE, 0 ); } // TODO do we need this? @@ -2240,7 +2227,7 @@ void TextureBrowser_destroyWindow(){ g_signal_handler_disconnect( G_OBJECT( g_TextureBrowser.m_gl_widget ), g_TextureBrowser.m_sizeHandler ); g_signal_handler_disconnect( G_OBJECT( g_TextureBrowser.m_gl_widget ), g_TextureBrowser.m_exposeHandler ); - gtk_widget_unref( g_TextureBrowser.m_gl_widget ); + g_TextureBrowser.m_gl_widget.unref(); } const Vector3& TextureBrowser_getBackgroundColour( TextureBrowser& textureBrowser ){ @@ -2275,7 +2262,7 @@ void TextureBrowser_addTag(){ EMessageBoxReturn result = DoShaderTagDlg( &tag, "Add shader tag" ); if ( result == eIDOK && !tag.empty() ) { - GtkTreeIter iter, iter2; + GtkTreeIter iter; g_TextureBrowser.m_all_tags.insert( tag.c_str() ); gtk_list_store_append( g_TextureBrowser.m_available_store, &iter ); gtk_list_store_set( g_TextureBrowser.m_available_store, &iter, TAG_COLUMN, tag.c_str(), -1 ); @@ -2284,8 +2271,7 @@ void TextureBrowser_addTag(){ GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( g_TextureBrowser.m_available_tree ) ); gtk_tree_selection_select_iter( selection, &iter ); - gtk_list_store_append( g_TextureBrowser.m_all_tags_list, &iter2 ); - gtk_list_store_set( g_TextureBrowser.m_all_tags_list, &iter2, TAG_COLUMN, tag.c_str(), -1 ); + g_TextureBrowser.m_all_tags_list.append(TAG_COLUMN, tag.c_str()); } } @@ -2334,7 +2320,7 @@ void TextureBrowser_renameTag(){ } else { - gtk_MessageBox( GTK_WIDGET( g_TextureBrowser.m_parent ), "Select a single tag for renaming." ); + ui::Widget(GTK_WIDGET( g_TextureBrowser.m_parent )).alert( "Select a single tag for renaming." ); } } @@ -2345,9 +2331,9 @@ void TextureBrowser_deleteTag(){ gtk_tree_selection_selected_foreach( selection, GtkTreeSelectionForeachFunc( TextureBrowser_selectionHelper ), &selected ); if ( g_slist_length( selected ) == 1 ) { // we only delete a single tag - EMessageBoxReturn result = gtk_MessageBox( GTK_WIDGET( g_TextureBrowser.m_parent ), "Are you sure you want to delete the selected tag?", "Delete Tag", eMB_YESNO, eMB_ICONQUESTION ); + auto result = ui::Widget(GTK_WIDGET( g_TextureBrowser.m_parent )).alert( "Are you sure you want to delete the selected tag?", "Delete Tag", ui::alert_type::YESNO, ui::alert_icon::Question ); - if ( result == eIDYES ) { + if ( result == ui::alert_response::YES ) { GtkTreeIter iterSelected; gchar *rowTag; @@ -2374,7 +2360,7 @@ void TextureBrowser_deleteTag(){ } } else { - gtk_MessageBox( GTK_WIDGET( g_TextureBrowser.m_parent ), "Select a single tag for deletion." ); + ui::Widget(GTK_WIDGET( g_TextureBrowser.m_parent )).alert( "Select a single tag for deletion." ); } } @@ -2426,7 +2412,7 @@ void TextureBrowser_RefreshShaders(){ ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Shaders" ); GlobalShaderSystem().refresh(); UpdateAllWindows(); - GtkTreeSelection* selection = gtk_tree_view_get_selection((GtkTreeView*)GlobalTextureBrowser().m_treeViewTree); + GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(GlobalTextureBrowser().m_treeViewTree)); GtkTreeModel* model = NULL; GtkTreeIter iter; if ( gtk_tree_selection_get_selected (selection, &model, &iter) ) @@ -2466,9 +2452,9 @@ void TextureBrowser_showAll(){ } void TextureBrowser_showUntagged(){ - EMessageBoxReturn result = gtk_MessageBox( GTK_WIDGET( g_TextureBrowser.m_parent ), "WARNING! This function might need a lot of memory and time. Are you sure you want to use it?", "Show Untagged", eMB_YESNO, eMB_ICONWARNING ); + auto result = ui::Widget(GTK_WIDGET( g_TextureBrowser.m_parent )).alert( "WARNING! This function might need a lot of memory and time. Are you sure you want to use it?", "Show Untagged", ui::alert_type::YESNO, ui::alert_icon::Warning ); - if ( result == eIDYES ) { + if ( result == ui::alert_response::YES ) { g_TextureBrowser.m_found_shaders.clear(); TagBuilder.GetUntagged( g_TextureBrowser.m_found_shaders ); std::set::iterator iter;