]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/preferences.cpp
GTK: wrap GTK_WIDGET
[xonotic/netradiant.git] / radiant / preferences.cpp
index 523408ebbe17de6a11b3b9479085097049c541a2..ed4daf52e2c531862f892c27d0d4acea66cbf915 100644 (file)
@@ -26,6 +26,7 @@
 //
 
 #include "preferences.h"
+#include "globaldefs.h"
 
 #include <gtk/gtk.h>
 #include "environment.h"
@@ -57,7 +58,7 @@ void Global_constructPreferences( PreferencesPage& page ){
 }
 
 void Interface_constructPreferences( PreferencesPage& page ){
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        page.appendCheckBox( "", "Default Text Editor", g_TextEditor_useWin32Editor );
 #else
        {
@@ -325,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 );
        }
@@ -481,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;
@@ -685,39 +686,39 @@ ui::Window PrefsDlg::BuildDialog(){
        ui::Window dialog = ui::Window(create_floating_window( "NetRadiant Preferences", m_parent ));
 
        {
-               ui::Widget mainvbox = ui::VBox( FALSE, 5 );
+               auto mainvbox = ui::VBox( FALSE, 5 );
                dialog.add(mainvbox);
                gtk_container_set_border_width( GTK_CONTAINER( mainvbox ), 5 );
                mainvbox.show();
 
                {
-                       ui::Widget hbox = ui::HBox( FALSE, 5 );
+                       auto hbox = ui::HBox( FALSE, 5 );
                        hbox.show();
-                       gtk_box_pack_end( GTK_BOX( mainvbox ), hbox, FALSE, TRUE, 0 );
+                       mainvbox.pack_end(hbox, FALSE, TRUE, 0);
 
                        {
-                               GtkButton* button = create_dialog_button( "OK", G_CALLBACK( dialog_button_ok ), &m_modal );
-                               gtk_box_pack_end( GTK_BOX( hbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
+                               auto button = create_dialog_button( "OK", G_CALLBACK( dialog_button_ok ), &m_modal );
+                               hbox.pack_end(button, FALSE, FALSE, 0);
                        }
                        {
-                               GtkButton* button = create_dialog_button( "Cancel", G_CALLBACK( dialog_button_cancel ), &m_modal );
-                               gtk_box_pack_end( GTK_BOX( hbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
+                               auto button = create_dialog_button( "Cancel", G_CALLBACK( dialog_button_cancel ), &m_modal );
+                               hbox.pack_end(button, FALSE, FALSE, 0);
                        }
                        {
-                               GtkButton* button = create_dialog_button( "Clean", G_CALLBACK( OnButtonClean ), this );
-                               gtk_box_pack_end( GTK_BOX( hbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
+                               auto button = create_dialog_button( "Clean", G_CALLBACK( OnButtonClean ), this );
+                               hbox.pack_end(button, FALSE, FALSE, 0);
                        }
                }
 
                {
-                       ui::Widget hbox = ui::HBox( FALSE, 5 );
-                       gtk_box_pack_start( GTK_BOX( mainvbox ), hbox, TRUE, TRUE, 0 );
+                       auto hbox = ui::HBox( FALSE, 5 );
+                       mainvbox.pack_start( hbox, TRUE, TRUE, 0 );
                        hbox.show();
 
                        {
                                auto sc_win = ui::ScrolledWindow(ui::New);
                                gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( sc_win ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
-                               gtk_box_pack_start( GTK_BOX( hbox ), sc_win, FALSE, FALSE, 0 );
+                               hbox.pack_start( sc_win, FALSE, FALSE, 0 );
                                sc_win.show();
                                gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( sc_win ), GTK_SHADOW_IN );
 
@@ -725,7 +726,7 @@ ui::Window PrefsDlg::BuildDialog(){
                                m_notebook = ui::Widget(gtk_notebook_new());
                                // hide the notebook tabs since its not supposed to look like a notebook
                                gtk_notebook_set_show_tabs( GTK_NOTEBOOK( m_notebook ), FALSE );
-                               gtk_box_pack_start( GTK_BOX( hbox ), m_notebook, TRUE, TRUE, 0 );
+                               hbox.pack_start( m_notebook, TRUE, TRUE, 0 );
                                m_notebook.show();
 
 
@@ -949,7 +950,7 @@ typedef FreeCaller1<const StringImportCallback&, GameMode_exportString> GameMode
 
 
 void RegisterPreferences( PreferenceSystem& preferences ){
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        preferences.registerPreference( "UseCustomShaderEditor", BoolImportStringCaller( g_TextEditor_useWin32Editor ), BoolExportStringCaller( g_TextEditor_useWin32Editor ) );
 #else
        preferences.registerPreference( "UseCustomShaderEditor", BoolImportStringCaller( g_TextEditor_useCustomEditor ), BoolExportStringCaller( g_TextEditor_useCustomEditor ) );