]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Remove <gtk/gtk.h> from gtkutil/dialog.h
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 22 Jul 2017 06:40:31 +0000 (16:40 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 31 Jul 2017 12:35:47 +0000 (22:35 +1000)
libs/gtkutil/dialog.cpp
libs/gtkutil/dialog.h
libs/uilib/uilib.h
radiant/dialog.cpp
radiant/dialog.h
radiant/findtexturedialog.cpp
radiant/gtkdlgs.cpp
radiant/mainframe.cpp
radiant/preferences.cpp
radiant/preferences.h
radiant/surfacedialog.cpp

index a6ff998d6227b48c1d7c5d94e4159e55ddd06068..54d275cbc9a82c1740d12884be88a5b7e8cd2bf5 100644 (file)
@@ -40,10 +40,10 @@ ui::HBox create_dialog_hbox( int spacing, int border ){
        return hbox;
 }
 
-ui::Frame create_dialog_frame( const char* label, GtkShadowType shadow ){
+ui::Frame create_dialog_frame( const char* label, ui::Shadow shadow ){
        auto frame = ui::Frame( label );
        frame.show();
-       gtk_frame_set_shadow_type( frame, shadow );
+       gtk_frame_set_shadow_type( frame, (GtkShadowType) shadow );
        return frame;
 }
 
index b5f235c2aa07efb7888b1cdfdd7dd4d0b9124dfd..7907e76b375c1996085d65f196fe2fca4a192bb3 100644 (file)
@@ -25,7 +25,6 @@
 #include "generic/callback.h"
 #include "generic/arrayrange.h"
 #include "qerplugin.h"
-#include <gtk/gtk.h>
 
 typedef int gint;
 typedef gint gboolean;
@@ -60,7 +59,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 );
 ui::VBox create_dialog_vbox( int spacing, int border = 0 );
 ui::HBox create_dialog_hbox( int spacing, int border = 0 );
-ui::Frame create_dialog_frame( const char* label, GtkShadowType shadow = GTK_SHADOW_ETCHED_IN );
+ui::Frame create_dialog_frame( const char* label, ui::Shadow shadow = ui::Shadow::ETCHED_IN );
 
 ui::Button create_modal_dialog_button( const char* label, ModalDialogButton& button );
 ui::Window create_modal_dialog_window( ui::Window parent, const char* title, ModalDialog& dialog, int default_w = -1, int default_h = -1 );
index 6ebb6420deda599407c771f2d83bb282d5274bdc..b9588dee282aff0169971b837efc59e15770be0f 100644 (file)
@@ -102,6 +102,14 @@ namespace ui {
         POPUP
     };
 
+    enum class Shadow {
+        NONE,
+        IN,
+        OUT,
+        ETCHED_IN,
+        ETCHED_OUT
+    };
+
     namespace details {
 
         enum class Convert {
index b5d7052cbf8b580e7b2e95fff6d38f1c20be185f..c576ba4659c19dd335adc58e17a27d2a882b6a4e 100644 (file)
@@ -55,10 +55,10 @@ ui::Entry DialogEntry_new(){
 class DialogEntryRow
 {
 public:
-DialogEntryRow( ui::Widget row, GtkEntry* entry ) : m_row( row ), m_entry( entry ){
+DialogEntryRow( ui::Widget row, ui::Entry entry ) : m_row( row ), m_entry( entry ){
 }
 ui::Widget m_row;
-GtkEntry* m_entry;
+ui::Entry m_entry;
 };
 
 DialogEntryRow DialogEntryRow_new( const char* name ){
@@ -91,7 +91,7 @@ public:
 DialogSpinnerRow( ui::Widget row, GtkSpinButton* spin ) : m_row( row ), m_spin( spin ){
 }
 ui::Widget m_row;
-GtkSpinButton* m_spin;
+ui::SpinButton m_spin;
 };
 
 DialogSpinnerRow DialogSpinnerRow_new( const char* name, double value, double lower, double upper, int fraction ){
@@ -468,7 +468,7 @@ void Dialog::addCombo( ui::Widget vbox, const char* name, StringArrayRange value
        auto alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 );
        alignment.show();
        {
-               ui::Widget combo = ui::ComboBoxText();
+               auto combo = ui::ComboBoxText();
 
                for ( StringArrayRange::Iterator i = values.first; i != values.last; ++i )
                {
@@ -553,7 +553,7 @@ void Dialog::addRadioIcons( ui::Widget vbox, const char* name, StringArrayRange
        gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
 
        GSList* group = 0;
-       ui::Widget radio;
+       ui::RadioButton radio{ui::null};
        for ( StringArrayRange::Iterator icon = icons.first; icon != icons.last; ++icon )
        {
                guint pos = static_cast<guint>( icon - icons.first );
@@ -563,7 +563,7 @@ void Dialog::addRadioIcons( ui::Widget vbox, const char* name, StringArrayRange
                                                  (GtkAttachOptions) ( 0 ),
                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
 
-               radio = ui::Widget(gtk_radio_button_new( group ));
+               radio = ui::RadioButton(GTK_RADIO_BUTTON(gtk_radio_button_new( group )));
                radio.show();
                gtk_table_attach( GTK_TABLE( table ), radio, pos, pos + 1, 1, 2,
                                                  (GtkAttachOptions) ( 0 ),
@@ -583,21 +583,21 @@ void Dialog::addRadioIcons( ui::Widget vbox, const char* name, int& data, String
 
 ui::Widget Dialog::addIntEntry( ui::Widget vbox, const char* name, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
        DialogEntryRow row( DialogEntryRow_new( name ) );
-       AddIntEntryData( *row.m_entry, importViewer, exportViewer );
+       AddIntEntryData( *GTK_ENTRY(row.m_entry), importViewer, exportViewer );
        DialogVBox_packRow( ui::VBox(GTK_VBOX( vbox )), row.m_row );
        return row.m_row;
 }
 
 ui::Widget Dialog::addSizeEntry( ui::Widget vbox, const char* name, const SizeImportCallback& importViewer, const SizeExportCallback& exportViewer ){
        DialogEntryRow row( DialogEntryRow_new( name ) );
-       AddSizeEntryData( *row.m_entry, importViewer, exportViewer );
+       AddSizeEntryData( *GTK_ENTRY(row.m_entry), importViewer, exportViewer );
        DialogVBox_packRow( ui::VBox(GTK_VBOX( vbox )), row.m_row );
        return row.m_row;
 }
 
 ui::Widget Dialog::addFloatEntry( ui::Widget vbox, const char* name, const FloatImportCallback& importViewer, const FloatExportCallback& exportViewer ){
        DialogEntryRow row( DialogEntryRow_new( name ) );
-       AddFloatEntryData( *row.m_entry, importViewer, exportViewer );
+       AddFloatEntryData( *GTK_ENTRY(row.m_entry), importViewer, exportViewer );
        DialogVBox_packRow( ui::VBox(GTK_VBOX( vbox )), row.m_row );
        return row.m_row;
 }
@@ -606,7 +606,7 @@ ui::Widget Dialog::addPathEntry( ui::Widget vbox, const char* name, bool browse_
        PathEntry pathEntry = PathEntry_new();
        g_signal_connect( G_OBJECT( pathEntry.m_button ), "clicked", G_CALLBACK( browse_directory ? button_clicked_entry_browse_directory : button_clicked_entry_browse_file ), pathEntry.m_entry );
 
-       AddTextEntryData( *GTK_ENTRY( pathEntry.m_entry ), importViewer, exportViewer );
+       AddTextEntryData( *GTK_ENTRY(pathEntry.m_entry), importViewer, exportViewer );
 
        auto row = DialogRow_new( name, ui::Widget(GTK_WIDGET( pathEntry.m_frame )) );
        DialogVBox_packRow( ui::VBox(GTK_VBOX( vbox )), row );
@@ -620,7 +620,7 @@ ui::Widget Dialog::addPathEntry( ui::Widget vbox, const char* name, CopiedString
 
 ui::SpinButton Dialog::addSpinner( ui::Widget vbox, const char* name, double value, double lower, double upper, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
        DialogSpinnerRow row( DialogSpinnerRow_new( name, value, lower, upper, 1 ) );
-       AddIntSpinnerData( *row.m_spin, importViewer, exportViewer );
+       AddIntSpinnerData( *GTK_SPIN_BUTTON(row.m_spin), importViewer, exportViewer );
        DialogVBox_packRow( ui::VBox(GTK_VBOX( vbox )), row.m_row );
        return ui::SpinButton(row.m_spin);
 }
@@ -631,7 +631,7 @@ ui::SpinButton Dialog::addSpinner( ui::Widget vbox, const char* name, int& data,
 
 ui::SpinButton Dialog::addSpinner( ui::Widget vbox, const char* name, double value, double lower, double upper, const FloatImportCallback& importViewer, const FloatExportCallback& exportViewer ){
        DialogSpinnerRow row( DialogSpinnerRow_new( name, value, lower, upper, 10 ) );
-       AddFloatSpinnerData( *row.m_spin, importViewer, exportViewer );
+       AddFloatSpinnerData( *GTK_SPIN_BUTTON(row.m_spin), importViewer, exportViewer );
        DialogVBox_packRow( ui::VBox(GTK_VBOX( vbox )), row.m_row );
        return ui::SpinButton(row.m_spin);
 }
index d202f83ace294301d3f8b374d67d9b1e9f9fa3aa..c2bd20a881123897c93b48233561da956d39b977 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <list>
 #include <uilib/uilib.h>
+#include <gtk/gtk.h>
 
 #include "gtkutil/dialog.h"
 #include "generic/callback.h"
index 201f2c67b477f9bea28705038b6d277db0880504..e4319c1e0d01cde0c25f1c81fa09783af2f0078b 100644 (file)
@@ -127,7 +127,7 @@ FindTextureDialog::~FindTextureDialog(){
 
 ui::Window FindTextureDialog::BuildDialog(){
        ui::Widget vbox, hbox, table, label;
-       ui::Widget button, check;
+       ui::Widget button;
        ui::Entry entry{nullptr};
 
        auto dlg = ui::Window(create_floating_window( "Find / Replace Texture(s)", m_parent ));
@@ -168,7 +168,7 @@ ui::Window FindTextureDialog::BuildDialog(){
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        g_signal_connect( G_OBJECT( entry ), "focus_in_event",
                                          G_CALLBACK( find_focus_in ), 0 );
-       AddDialogData( *GTK_ENTRY( entry ), m_strFind );
+       AddDialogData( *GTK_ENTRY(entry), m_strFind );
        GlobalTextureEntryCompletion::instance().connect( entry );
 
        entry = ui::Entry();
@@ -178,13 +178,13 @@ ui::Window FindTextureDialog::BuildDialog(){
                                          (GtkAttachOptions) ( 0 ), 0, 0 );
        g_signal_connect( G_OBJECT( entry ), "focus_in_event",
                                          G_CALLBACK( replace_focus_in ), 0 );
-       AddDialogData( *GTK_ENTRY( entry ), m_strReplace );
+       AddDialogData( *GTK_ENTRY(entry), m_strReplace );
        GlobalTextureEntryCompletion::instance().connect( entry );
 
-       check = ui::CheckButton( "Within selected brushes only" );
+       auto check = ui::CheckButton( "Within selected brushes only" );
        check.show();
        gtk_box_pack_start( GTK_BOX( vbox ), check, TRUE, TRUE, 0 );
-       AddDialogData( *GTK_TOGGLE_BUTTON( check ), m_bSelectedOnly );
+       AddDialogData( *GTK_TOGGLE_BUTTON(check), m_bSelectedOnly );
 
        vbox = ui::VBox( FALSE, 5 );
        vbox.show();
index 3b446f93f2c9935bf70a35de51265d2de26ab15c..caf74cb83cc4f160a722dae3b1f0ee169c832ccb 100644 (file)
@@ -453,7 +453,7 @@ void DoAbout(){
                                GtkVBox* vbox2 = create_dialog_vbox( 4 );
                                gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox2 ), TRUE, FALSE, 0 );
                                {
-                                       auto frame = create_dialog_frame( 0, GTK_SHADOW_IN );
+                                       auto frame = create_dialog_frame( 0, ui::Shadow::IN );
                                        gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( frame ), FALSE, FALSE, 0 );
                                        {
                                                auto image = new_local_image( "logo.png" );
index 7c9fc3c867476caf651e209cf66ae85f024f3736..eb3fdff44f5ab33e6092cab370e725c91031339c 100644 (file)
@@ -433,7 +433,7 @@ class PathsDialog : public Dialog
 {
 public:
 ui::Window BuildDialog(){
-       auto frame = create_dialog_frame( "Path settings", GTK_SHADOW_ETCHED_IN );
+       auto frame = create_dialog_frame( "Path settings", ui::Shadow::ETCHED_IN );
 
        auto vbox2 = create_dialog_vbox( 0, 4 );
        frame.add(vbox2);
index d1ae9e15956e3cf2c46f6243def1fe15deca3345..46ed23ffb1f4b004850ef41735e713f5cf3d91ee 100644 (file)
@@ -317,7 +317,7 @@ void CGameDialog::CreateGlobalFrame( PreferencesPage& page ){
 }
 
 ui::Window CGameDialog::BuildDialog(){
-       auto frame = create_dialog_frame( "Game settings", GTK_SHADOW_ETCHED_IN );
+       auto frame = create_dialog_frame( "Game settings", ui::Shadow::ETCHED_IN );
 
        auto vbox2 = create_dialog_vbox( 0, 4 );
        frame.add(vbox2);
index 8ece483fa0ca375d45a1dc7726ae7b361dbad2e1..0102784f68a248a23fbbbf54856bf1c04329d7a8 100644 (file)
@@ -33,6 +33,7 @@
 #include "dialog.h"
 #include <list>
 #include <map>
+#include <glib.h>
 
 void Widget_connectToggleDependency( ui::Widget self, ui::Widget toggleButton );
 
index 8209a16a944f62f152b8f31a728881fb5d42efa0..f4e621cbc7652c3b118353d2984a985e7a793234 100644 (file)
@@ -915,7 +915,7 @@ ui::Window SurfaceInspector::BuildDialog(){
                                        gtk_widget_set_size_request( button, 60, -1 );
                                }
                                {
-                                       ui::Widget spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
+                                       auto spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
                                        spin.show();
                                        gtk_table_attach( GTK_TABLE( table ), spin, 2, 3, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -924,7 +924,7 @@ ui::Window SurfaceInspector::BuildDialog(){
                                        AddDialogData( *GTK_SPIN_BUTTON( spin ), m_fitHorizontal );
                                }
                                {
-                                       ui::Widget spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
+                                       auto spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
                                        spin.show();
                                        gtk_table_attach( GTK_TABLE( table ), spin, 3, 4, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),