From: TimePath Date: Sat, 22 Jul 2017 06:40:31 +0000 (+1000) Subject: Remove from gtkutil/dialog.h X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e075e775ce2359d9ac8e0fe6c44d03a7d7ecae9d;p=xonotic%2Fnetradiant.git Remove from gtkutil/dialog.h --- diff --git a/libs/gtkutil/dialog.cpp b/libs/gtkutil/dialog.cpp index a6ff998d..54d275cb 100644 --- a/libs/gtkutil/dialog.cpp +++ b/libs/gtkutil/dialog.cpp @@ -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; } diff --git a/libs/gtkutil/dialog.h b/libs/gtkutil/dialog.h index b5f235c2..7907e76b 100644 --- a/libs/gtkutil/dialog.h +++ b/libs/gtkutil/dialog.h @@ -25,7 +25,6 @@ #include "generic/callback.h" #include "generic/arrayrange.h" #include "qerplugin.h" -#include 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 ); diff --git a/libs/uilib/uilib.h b/libs/uilib/uilib.h index 6ebb6420..b9588dee 100644 --- a/libs/uilib/uilib.h +++ b/libs/uilib/uilib.h @@ -102,6 +102,14 @@ namespace ui { POPUP }; + enum class Shadow { + NONE, + IN, + OUT, + ETCHED_IN, + ETCHED_OUT + }; + namespace details { enum class Convert { diff --git a/radiant/dialog.cpp b/radiant/dialog.cpp index b5d7052c..c576ba46 100644 --- a/radiant/dialog.cpp +++ b/radiant/dialog.cpp @@ -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( 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); } diff --git a/radiant/dialog.h b/radiant/dialog.h index d202f83a..c2bd20a8 100644 --- a/radiant/dialog.h +++ b/radiant/dialog.h @@ -24,6 +24,7 @@ #include #include +#include #include "gtkutil/dialog.h" #include "generic/callback.h" diff --git a/radiant/findtexturedialog.cpp b/radiant/findtexturedialog.cpp index 201f2c67..e4319c1e 100644 --- a/radiant/findtexturedialog.cpp +++ b/radiant/findtexturedialog.cpp @@ -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(); diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index 3b446f93..caf74cb8 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -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" ); diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 7c9fc3c8..eb3fdff4 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -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); diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index d1ae9e15..46ed23ff 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -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); diff --git a/radiant/preferences.h b/radiant/preferences.h index 8ece483f..0102784f 100644 --- a/radiant/preferences.h +++ b/radiant/preferences.h @@ -33,6 +33,7 @@ #include "dialog.h" #include #include +#include void Widget_connectToggleDependency( ui::Widget self, ui::Widget toggleButton ); diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index 8209a16a..f4e621cb 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -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 ),