]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/gtkdlgs.cpp
Remove <gtk/gtk.h> from most of radiant/*
[xonotic/netradiant.git] / radiant / gtkdlgs.cpp
index daa0f31c5f1be2b3e3d7f65740df5dd8febe6e23..d46ea32baa583427f6266bb67da1c13e6ca9d1f8 100644 (file)
 #include "iselection.h"
 
 #include <gdk/gdkkeysyms.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkcombobox.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtktextview.h>
-#include <gtk/gtktextbuffer.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkliststore.h>
+#include <uilib/uilib.h>
 
 #include "os/path.h"
 #include "math/aabb.h"
@@ -167,11 +152,11 @@ inline void path_copy_clean( char* destination, const char* source ){
 
 struct GameCombo
 {
-       GtkComboBox* game_select;
+       ui::ComboBoxText game_select;
        GtkEntry* fsgame_entry;
 };
 
-gboolean OnSelchangeComboWhatgame( GtkWidget *widget, GameCombo* combo ){
+gboolean OnSelchangeComboWhatgame( ui::Widget widget, GameCombo* combo ){
        const char *gamename;
        {
                GtkTreeIter iter;
@@ -214,8 +199,8 @@ GameCombo game_combo;
 GtkComboBox* gamemode_combo;
 };
 
-GtkWindow* ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, ModalDialog& modal ){
-       GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Project Settings", G_CALLBACK( dialog_delete_callback ), &modal );
+ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, ModalDialog& modal ){
+       ui::Window window = MainFrame_getWindow().create_dialog_window("Project Settings", G_CALLBACK(dialog_delete_callback ), &modal );
 
        {
                GtkTable* table1 = create_dialog_table( 1, 2, 4, 4, 4 );
@@ -244,7 +229,7 @@ GtkWindow* ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal
                                gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( table2 ) );
 
                                {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Select mod" ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( "Select mod" ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table2, GTK_WIDGET( label ), 0, 1, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -252,13 +237,13 @@ GtkWindow* ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal
                                        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
                                }
                                {
-                                       dialog.game_combo.game_select = GTK_COMBO_BOX( gtk_combo_box_new_text() );
+                                       dialog.game_combo.game_select = ui::ComboBoxText();
 
-                                       gtk_combo_box_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().basegame );
+                                       gtk_combo_box_text_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().basegame );
                                        if ( globalGameComboConfiguration().known[0] != '\0' ) {
-                                               gtk_combo_box_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().known );
+                                               gtk_combo_box_text_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().known );
                                        }
-                                       gtk_combo_box_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().custom );
+                                       gtk_combo_box_text_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().custom );
 
                                        gtk_widget_show( GTK_WIDGET( dialog.game_combo.game_select ) );
                                        gtk_table_attach( table2, GTK_WIDGET( dialog.game_combo.game_select ), 1, 2, 0, 1,
@@ -269,7 +254,7 @@ GtkWindow* ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal
                                }
 
                                {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "fs_game" ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( "fs_game" ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table2, GTK_WIDGET( label ), 0, 1, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -277,7 +262,7 @@ GtkWindow* ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal
                                        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
                                }
                                {
-                                       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                       auto entry = ui::Entry();
                                        gtk_widget_show( GTK_WIDGET( entry ) );
                                        gtk_table_attach( table2, GTK_WIDGET( entry ), 1, 2, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -287,16 +272,16 @@ GtkWindow* ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal
                                }
 
                                if ( globalMappingMode().do_mapping_mode ) {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Mapping mode" ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( "Mapping mode" ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table2, GTK_WIDGET( label ), 0, 1, 3, 4,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                        gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
 
-                                       GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() );
-                                       gtk_combo_box_append_text( combo, globalMappingMode().sp_mapping_mode );
-                                       gtk_combo_box_append_text( combo, globalMappingMode().mp_mapping_mode );
+                                       auto combo = ui::ComboBoxText();
+                                       gtk_combo_box_text_append_text( combo, globalMappingMode().sp_mapping_mode );
+                                       gtk_combo_box_text_append_text( combo, globalMappingMode().mp_mapping_mode );
 
                                        gtk_widget_show( GTK_WIDGET( combo ) );
                                        gtk_table_attach( table2, GTK_WIDGET( combo ), 1, 2, 3, 4,
@@ -366,7 +351,7 @@ void DoProjectSettings(){
                ModalDialog modal;
                ProjectSettingsDialog dialog;
 
-               GtkWindow* window = ProjectSettingsDialog_construct( dialog, modal );
+               ui::Window window = ProjectSettingsDialog_construct( dialog, modal );
 
                if ( modal_dialog_show( window, modal ) == eIDOK ) {
                        ProjectSettingsDialog_ok( dialog );
@@ -383,21 +368,21 @@ void DoSides( int type, int axis ){
        ModalDialog dialog;
        GtkEntry* sides_entry;
 
-       GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Arbitrary sides", G_CALLBACK( dialog_delete_callback ), &dialog );
+       ui::Window window = MainFrame_getWindow().create_dialog_window("Arbitrary sides", G_CALLBACK(dialog_delete_callback ), &dialog );
 
-       GtkAccelGroup* accel = gtk_accel_group_new();
-       gtk_window_add_accel_group( window, accel );
+       auto accel = ui::AccelGroup();
+       window.add_accel_group( accel );
 
        {
                GtkHBox* hbox = create_dialog_hbox( 4, 4 );
                gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) );
                {
-                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Sides:" ) );
+                       GtkLabel* label = GTK_LABEL( ui::Label( "Sides:" ) );
                        gtk_widget_show( GTK_WIDGET( label ) );
                        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
                }
                {
-                       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                       auto entry = ui::Entry();
                        gtk_widget_show( GTK_WIDGET( entry ) );
                        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( entry ), FALSE, FALSE, 0 );
                        sides_entry = entry;
@@ -407,9 +392,9 @@ void DoSides( int type, int axis ){
                        GtkVBox* vbox = create_dialog_vbox( 4 );
                        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
                        {
-                               GtkButton* button = create_dialog_button( "OK", G_CALLBACK( dialog_button_ok ), &dialog );
+                               auto button = create_dialog_button( "OK", G_CALLBACK( dialog_button_ok ), &dialog );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
-                               widget_make_default( GTK_WIDGET( button ) );
+                               widget_make_default( button );
                                gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_Return, (GdkModifierType)0, (GtkAccelFlags)0 );
                        }
                        {
@@ -432,15 +417,21 @@ void DoSides( int type, int axis ){
 // =============================================================================
 // About dialog (no program is complete without one)
 
-void about_button_changelog( GtkWidget *widget, gpointer data ){
+void about_button_changelog( ui::Widget widget, gpointer data ){
        StringOutputStream log( 256 );
-       log << AppPath_get() << "changelog.txt";
+       log << "https://gitlab.com/xonotic/netradiant/commits/master";
        OpenURL( log.c_str() );
 }
 
-void about_button_credits( GtkWidget *widget, gpointer data ){
+void about_button_credits( ui::Widget widget, gpointer data ){
        StringOutputStream cred( 256 );
-       cred << AppPath_get() << "credits.html";
+       cred << "https://gitlab.com/xonotic/netradiant/graphs/master";
+       OpenURL( cred.c_str() );
+}
+
+void about_button_issues( GtkWidget *widget, gpointer data ){
+       StringOutputStream cred( 256 );
+       cred << "https://gitlab.com/xonotic/netradiant/issues";
        OpenURL( cred.c_str() );
 }
 
@@ -448,7 +439,7 @@ void DoAbout(){
        ModalDialog dialog;
        ModalDialogButton ok_button( dialog, eIDOK );
 
-       GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "About NetRadiant", dialog );
+       ui::Window window = MainFrame_getWindow().create_modal_dialog_window("About NetRadiant", dialog );
 
        {
                GtkVBox* vbox = create_dialog_vbox( 4, 4 );
@@ -473,16 +464,16 @@ void DoAbout(){
                        }
 
                        {
-                               GtkLabel* label = GTK_LABEL( gtk_label_new( "NetRadiant " RADIANT_VERSION "\n"
-                                                                                                                       __DATE__ "\n\n"
-                                                                                                                       RADIANT_ABOUTMSG "\n\n"
-                                                                                                                                                        "By alientrap.org\n\n"
-                                                                                                                                                        "This program is free software\n"
-                                                                                                                                                        "licensed under the GNU GPL.\n\n"
-                                                                                                                                                        "NetRadiant is unsupported, however\n"
-                                                                                                                                                        "you may report your problems at\n"
-                                                                                                                                                        "http://www.icculus.org/netradiant/"
-                                                                                                                       ) );
+                               char const *label_text = "NetRadiant " RADIANT_VERSION "\n"
+                                                                               __DATE__ "\n\n"
+                                        RADIANT_ABOUTMSG "\n\n"
+                                                                               "This program is free software\n"
+                                                                               "licensed under the GNU GPL.\n\n"
+                                                                               "NetRadiant is unsupported, however\n"
+                                                                               "you may report your problems at\n"
+                                                                               "https://gitlab.com/xonotic/netradiant/issues";
+
+                               GtkLabel* label = GTK_LABEL( ui::Label( label_text ) );
 
                                gtk_widget_show( GTK_WIDGET( label ) );
                                gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
@@ -502,7 +493,11 @@ void DoAbout(){
                                        gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
                                }
                                {
-                                       GtkButton* button = create_dialog_button( "Changelog", G_CALLBACK( about_button_changelog ), 0 );
+                                       GtkButton* button = create_dialog_button( "Changes", G_CALLBACK( about_button_changelog ), 0 );
+                                       gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
+                               }
+                               {
+                                       GtkButton* button = create_dialog_button( "Issues", G_CALLBACK( about_button_issues ), 0 );
                                        gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
                                }
                        }
@@ -514,7 +509,7 @@ void DoAbout(){
                                GtkTable* table = create_dialog_table( 3, 2, 4, 4, 4 );
                                gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( table ) );
                                {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Vendor:" ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( "Vendor:" ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -522,7 +517,7 @@ void DoAbout(){
                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                }
                                {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Version:" ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( "Version:" ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -530,7 +525,7 @@ void DoAbout(){
                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                }
                                {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Renderer:" ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( "Renderer:" ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 2, 3,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -538,7 +533,7 @@ void DoAbout(){
                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                }
                                {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( reinterpret_cast<const char*>( glGetString( GL_VENDOR ) ) ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( reinterpret_cast<const char*>( glGetString( GL_VENDOR ) ) ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -546,7 +541,7 @@ void DoAbout(){
                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                }
                                {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( reinterpret_cast<const char*>( glGetString( GL_VERSION ) ) ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( reinterpret_cast<const char*>( glGetString( GL_VERSION ) ) ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -554,7 +549,7 @@ void DoAbout(){
                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                }
                                {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( reinterpret_cast<const char*>( glGetString( GL_RENDERER ) ) ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( reinterpret_cast<const char*>( glGetString( GL_RENDERER ) ) ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 2, 3,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -569,7 +564,7 @@ void DoAbout(){
                                        GtkScrolledWindow* sc_extensions = create_scrolled_window( GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS, 4 );
                                        gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( sc_extensions ) );
                                        {
-                                               GtkWidget* text_extensions = gtk_text_view_new();
+                                               ui::Widget text_extensions = ui::TextView();
                                                gtk_text_view_set_editable( GTK_TEXT_VIEW( text_extensions ), FALSE );
                                                gtk_container_add( GTK_CONTAINER( sc_extensions ), text_extensions );
                                                GtkTextBuffer* buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( text_extensions ) );
@@ -601,10 +596,10 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
        GtkEntry* x;
        GtkEntry* y;
 
-       GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "Patch texture layout", dialog );
+       ui::Window window = MainFrame_getWindow().create_modal_dialog_window("Patch texture layout", dialog );
 
-       GtkAccelGroup* accel = gtk_accel_group_new();
-       gtk_window_add_accel_group( window, accel );
+       auto accel = ui::AccelGroup();
+       window.add_accel_group( accel );
 
        {
                GtkHBox* hbox = create_dialog_hbox( 4, 4 );
@@ -613,7 +608,7 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
                        GtkVBox* vbox = create_dialog_vbox( 4 );
                        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
                        {
-                               GtkLabel* label = GTK_LABEL( gtk_label_new( "Texture will be fit across the patch based\n"
+                               GtkLabel* label = GTK_LABEL( ui::Label( "Texture will be fit across the patch based\n"
                                                                                                                        "on the x and y values given. Values of 1x1\n"
                                                                                                                        "will \"fit\" the texture. 2x2 will repeat\n"
                                                                                                                        "it twice, etc." ) );
@@ -626,7 +621,7 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
                                gtk_widget_show( GTK_WIDGET( table ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
                                {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Texture x:" ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( "Texture x:" ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -634,7 +629,7 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                }
                                {
-                                       GtkLabel* label = GTK_LABEL( gtk_label_new( "Texture y:" ) );
+                                       GtkLabel* label = GTK_LABEL( ui::Label( "Texture y:" ) );
                                        gtk_widget_show( GTK_WIDGET( label ) );
                                        gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
@@ -642,7 +637,7 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                }
                                {
-                                       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                       auto entry = ui::Entry();
                                        gtk_widget_show( GTK_WIDGET( entry ) );
                                        gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -651,7 +646,7 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
                                        x = entry;
                                }
                                {
-                                       GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                       auto entry = ui::Entry();
                                        gtk_widget_show( GTK_WIDGET( entry ) );
                                        gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -665,9 +660,9 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
                        GtkVBox* vbox = create_dialog_vbox( 4 );
                        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), FALSE, FALSE, 0 );
                        {
-                               GtkButton* button = create_modal_dialog_button( "OK", ok_button );
+                               auto button = create_modal_dialog_button( "OK", ok_button );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
-                               widget_make_default( GTK_WIDGET( button ) );
+                               widget_make_default( button );
                                gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_Return, (GdkModifierType)0, (GtkAccelFlags)0 );
                        }
                        {
@@ -709,11 +704,11 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
 // Text Editor dialog
 
 // master window widget
-static GtkWidget *text_editor = 0;
-static GtkWidget *text_widget; // slave, text widget from the gtk editor
+static ui::Widget text_editor;
+static ui::Widget text_widget; // slave, text widget from the gtk editor
 
-static gint editor_delete( GtkWidget *widget, gpointer data ){
-       if ( gtk_MessageBox( widget, "Close the shader editor ?", "Radiant", eMB_YESNO, eMB_ICONQUESTION ) == eIDNO ) {
+static gint editor_delete( ui::Widget widget, gpointer data ){
+       if ( widget.alert( "Close the shader editor ?", "Radiant", ui::alert_type::YESNO, ui::alert_icon::Question ) == ui::alert_response::NO ) {
                return TRUE;
        }
 
@@ -722,12 +717,12 @@ static gint editor_delete( GtkWidget *widget, gpointer data ){
        return TRUE;
 }
 
-static void editor_save( GtkWidget *widget, gpointer data ){
+static void editor_save( ui::Widget widget, gpointer data ){
        FILE *f = fopen( (char*)g_object_get_data( G_OBJECT( data ), "filename" ), "w" );
        gpointer text = g_object_get_data( G_OBJECT( data ), "text" );
 
        if ( f == 0 ) {
-               gtk_MessageBox( GTK_WIDGET( data ), "Error saving file !" );
+               ui::Widget(GTK_WIDGET( data )).alert( "Error saving file !" );
                return;
        }
 
@@ -736,8 +731,8 @@ static void editor_save( GtkWidget *widget, gpointer data ){
        fclose( f );
 }
 
-static void editor_close( GtkWidget *widget, gpointer data ){
-       if ( gtk_MessageBox( text_editor, "Close the shader editor ?", "Radiant", eMB_YESNO, eMB_ICONQUESTION ) == eIDNO ) {
+static void editor_close( ui::Widget widget, gpointer data ){
+       if ( text_editor.alert( "Close the shader editor ?", "Radiant", ui::alert_type::YESNO, ui::alert_icon::Question ) == ui::alert_response::NO ) {
                return;
        }
 
@@ -745,49 +740,49 @@ static void editor_close( GtkWidget *widget, gpointer data ){
 }
 
 static void CreateGtkTextEditor(){
-       GtkWidget *dlg;
-       GtkWidget *vbox, *hbox, *button, *scr, *text;
+       ui::Widget dlg;
+       ui::Widget vbox, hbox, button, scr, text;
 
-       dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+       dlg = ui::Window( ui::window_type::TOP );
 
        g_signal_connect( G_OBJECT( dlg ), "delete_event",
                                          G_CALLBACK( editor_delete ), 0 );
        gtk_window_set_default_size( GTK_WINDOW( dlg ), 600, 300 );
 
-       vbox = gtk_vbox_new( FALSE, 5 );
+       vbox = ui::VBox( FALSE, 5 );
        gtk_widget_show( vbox );
        gtk_container_add( GTK_CONTAINER( dlg ), GTK_WIDGET( vbox ) );
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
 
-       scr = gtk_scrolled_window_new( 0, 0 );
+       scr = ui::ScrolledWindow();
        gtk_widget_show( scr );
        gtk_box_pack_start( GTK_BOX( vbox ), scr, TRUE, TRUE, 0 );
        gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
        gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
 
-       text = gtk_text_view_new();
+       text = ui::TextView();
        gtk_container_add( GTK_CONTAINER( scr ), text );
        gtk_widget_show( text );
-       g_object_set_data( G_OBJECT( dlg ), "text", text );
+       g_object_set_data( G_OBJECT( dlg ), "text", (gpointer) text );
        gtk_text_view_set_editable( GTK_TEXT_VIEW( text ), TRUE );
 
-       hbox = gtk_hbox_new( FALSE, 5 );
+       hbox = ui::HBox( FALSE, 5 );
        gtk_widget_show( hbox );
        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), FALSE, TRUE, 0 );
 
-       button = gtk_button_new_with_label( "Close" );
+       button = ui::Button( "Close" );
        gtk_widget_show( button );
        gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
        g_signal_connect( G_OBJECT( button ), "clicked",
                                          G_CALLBACK( editor_close ), dlg );
-       gtk_widget_set_usize( button, 60, -2 );
+       gtk_widget_set_size_request( button, 60, -1 );
 
-       button = gtk_button_new_with_label( "Save" );
+       button = ui::Button( "Save" );
        gtk_widget_show( button );
        gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
        g_signal_connect( G_OBJECT( button ), "clicked",
                                          G_CALLBACK( editor_save ), dlg );
-       gtk_widget_set_usize( button, 60, -2 );
+       gtk_widget_set_size_request( button, 60, -1 );
 
        text_editor = dlg;
        text_widget = text;
@@ -862,10 +857,10 @@ EMessageBoxReturn DoLightIntensityDlg( int *intensity ){
        ModalDialogButton ok_button( dialog, eIDOK );
        ModalDialogButton cancel_button( dialog, eIDCANCEL );
 
-       GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "Light intensity", dialog, -1, -1 );
+       ui::Window window = MainFrame_getWindow().create_modal_dialog_window("Light intensity", dialog, -1, -1 );
 
-       GtkAccelGroup *accel_group = gtk_accel_group_new();
-       gtk_window_add_accel_group( window, accel_group );
+       auto accel_group = ui::AccelGroup();
+       window.add_accel_group( accel_group );
 
        {
                GtkHBox* hbox = create_dialog_hbox( 4, 4 );
@@ -874,12 +869,12 @@ EMessageBoxReturn DoLightIntensityDlg( int *intensity ){
                        GtkVBox* vbox = create_dialog_vbox( 4 );
                        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
                        {
-                               GtkLabel* label = GTK_LABEL( gtk_label_new( "ESC for default, ENTER to validate" ) );
+                               GtkLabel* label = GTK_LABEL( ui::Label( "ESC for default, ENTER to validate" ) );
                                gtk_widget_show( GTK_WIDGET( label ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
                        }
                        {
-                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                               auto entry = ui::Entry();
                                gtk_widget_show( GTK_WIDGET( entry ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
 
@@ -893,9 +888,9 @@ EMessageBoxReturn DoLightIntensityDlg( int *intensity ){
                        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), FALSE, FALSE, 0 );
 
                        {
-                               GtkButton* button = create_modal_dialog_button( "OK", ok_button );
+                               auto button = create_modal_dialog_button( "OK", ok_button );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
-                               widget_make_default( GTK_WIDGET( button ) );
+                               widget_make_default( button );
                                gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE );
                        }
                        {
@@ -929,10 +924,10 @@ EMessageBoxReturn DoShaderTagDlg( CopiedString* tag, char* title ){
        ModalDialogButton ok_button( dialog, eIDOK );
        ModalDialogButton cancel_button( dialog, eIDCANCEL );
 
-       GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), title, dialog, -1, -1 );
+       ui::Window window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 );
 
-       GtkAccelGroup *accel_group = gtk_accel_group_new();
-       gtk_window_add_accel_group( window, accel_group );
+       auto accel_group = ui::AccelGroup();
+       window.add_accel_group( accel_group );
 
        {
                GtkHBox* hbox = create_dialog_hbox( 4, 4 );
@@ -942,12 +937,12 @@ EMessageBoxReturn DoShaderTagDlg( CopiedString* tag, char* title ){
                        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
                        {
                                //GtkLabel* label = GTK_LABEL(gtk_label_new("Enter one ore more tags separated by spaces"));
-                               GtkLabel* label = GTK_LABEL( gtk_label_new( "ESC to cancel, ENTER to validate" ) );
+                               GtkLabel* label = GTK_LABEL( ui::Label( "ESC to cancel, ENTER to validate" ) );
                                gtk_widget_show( GTK_WIDGET( label ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
                        }
                        {
-                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                               auto entry = ui::Entry();
                                gtk_widget_show( GTK_WIDGET( entry ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
 
@@ -961,9 +956,9 @@ EMessageBoxReturn DoShaderTagDlg( CopiedString* tag, char* title ){
                        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), FALSE, FALSE, 0 );
 
                        {
-                               GtkButton* button = create_modal_dialog_button( "OK", ok_button );
+                               auto button = create_modal_dialog_button( "OK", ok_button );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
-                               widget_make_default( GTK_WIDGET( button ) );
+                               widget_make_default( button );
                                gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE );
                        }
                        {
@@ -988,10 +983,10 @@ EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, char*
        ModalDialog dialog;
        ModalDialogButton ok_button( dialog, eIDOK );
 
-       GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), title, dialog, -1, -1 );
+       ui::Window window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 );
 
-       GtkAccelGroup *accel_group = gtk_accel_group_new();
-       gtk_window_add_accel_group( window, accel_group );
+       auto accel_group = ui::AccelGroup();
+       window.add_accel_group( accel_group );
 
        {
                GtkHBox* hbox = create_dialog_hbox( 4, 4 );
@@ -1000,29 +995,29 @@ EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, char*
                        GtkVBox* vbox = create_dialog_vbox( 4 );
                        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), FALSE, FALSE, 0 );
                        {
-                               GtkLabel* label = GTK_LABEL( gtk_label_new( "The selected shader" ) );
+                               GtkLabel* label = GTK_LABEL( ui::Label( "The selected shader" ) );
                                gtk_widget_show( GTK_WIDGET( label ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
                        }
                        {
-                               GtkLabel* label = GTK_LABEL( gtk_label_new( name ) );
+                               GtkLabel* label = GTK_LABEL( ui::Label( name ) );
                                gtk_widget_show( GTK_WIDGET( label ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
                        }
                        {
-                               GtkLabel* label = GTK_LABEL( gtk_label_new( "is located in file" ) );
+                               GtkLabel* label = GTK_LABEL( ui::Label( "is located in file" ) );
                                gtk_widget_show( GTK_WIDGET( label ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
                        }
                        {
-                               GtkLabel* label = GTK_LABEL( gtk_label_new( filename ) );
+                               GtkLabel* label = GTK_LABEL( ui::Label( filename ) );
                                gtk_widget_show( GTK_WIDGET( label ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
                        }
                        {
-                               GtkButton* button = create_modal_dialog_button( "OK", ok_button );
+                               auto button = create_modal_dialog_button( "OK", ok_button );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
-                               widget_make_default( GTK_WIDGET( button ) );
+                               widget_make_default( button );
                                gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE );
                        }
                }
@@ -1054,7 +1049,7 @@ void DoTextEditor( const char* filename, int cursorpos ){
 #ifdef WIN32
        if ( g_TextEditor_useWin32Editor ) {
                globalOutputStream() << "opening file '" << filename << "' (line " << cursorpos << " info ignored)\n";
-               ShellExecute( (HWND)GDK_WINDOW_HWND( GTK_WIDGET( MainFrame_getWindow() )->window ), "open", filename, 0, 0, SW_SHOW );
+               ShellExecute( (HWND)GDK_WINDOW_HWND( gtk_widget_get_window( MainFrame_getWindow() ) ), "open", filename, 0, 0, SW_SHOW );
                return;
        }
 #else