From cb98a3e3c66ac5edbb21826a74aacae454e7306e Mon Sep 17 00:00:00 2001 From: TimePath Date: Wed, 17 Feb 2016 16:33:57 +1100 Subject: [PATCH] Wrap GtkComboBox --- libs/uilib/uilib.cpp | 3 +++ libs/uilib/uilib.h | 8 ++++++++ radiant/dialog.cpp | 2 +- radiant/entityinspector.cpp | 2 +- radiant/gtkdlgs.cpp | 4 ++-- radiant/patchdialog.cpp | 4 ++-- radiant/patchmanip.cpp | 4 ++-- 7 files changed, 19 insertions(+), 8 deletions(-) diff --git a/libs/uilib/uilib.cpp b/libs/uilib/uilib.cpp index 9989601b..763029b2 100644 --- a/libs/uilib/uilib.cpp +++ b/libs/uilib/uilib.cpp @@ -107,6 +107,9 @@ namespace ui { CellRendererText::CellRendererText() : CellRendererText(GTK_CELL_RENDERER_TEXT(gtk_cell_renderer_text_new())) { } + ComboBoxText::ComboBoxText() : ComboBoxText(GTK_COMBO_BOX(gtk_combo_box_new_text())) + { } + CheckButton::CheckButton(const char *label) : CheckButton(GTK_CHECK_BUTTON(gtk_check_button_new_with_label(label))) { } diff --git a/libs/uilib/uilib.h b/libs/uilib/uilib.h index 6f58a2e0..f9b996c6 100644 --- a/libs/uilib/uilib.h +++ b/libs/uilib/uilib.h @@ -9,6 +9,8 @@ using ui_alignment = struct _GtkAlignment; using ui_box = struct _GtkBox; using ui_button = struct _GtkButton; using ui_checkbutton = struct _GtkCheckButton; +using ui_combobox = struct _GtkComboBox; +using ui_comboboxtext = ui_combobox; using ui_cellrenderer = struct _GtkCellRenderer; using ui_cellrenderertext = struct _GtkCellRendererText; using ui_entry = struct _GtkEntry; @@ -154,6 +156,12 @@ namespace ui { CheckButton(const char *label); ); + WRAP(ComboBox, Widget, ui_combobox,); + + WRAP(ComboBoxText, ComboBox, ui_comboboxtext, + ComboBoxText(); + ); + WRAP(Entry, Widget, ui_entry, Entry(); Entry(std::size_t max_length); diff --git a/radiant/dialog.cpp b/radiant/dialog.cpp index 337f414f..38449790 100644 --- a/radiant/dialog.cpp +++ b/radiant/dialog.cpp @@ -481,7 +481,7 @@ void Dialog::addCombo( ui::Widget vbox, const char* name, StringArrayRange value ui::Widget alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 ); gtk_widget_show( alignment ); { - ui::Widget combo = ui::Widget(gtk_combo_box_new_text()); + ui::Widget combo = ui::ComboBoxText(); for ( StringArrayRange::Iterator i = values.first; i != values.last; ++i ) { diff --git a/radiant/entityinspector.cpp b/radiant/entityinspector.cpp index d31b86c3..8db78f1c 100644 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@ -679,7 +679,7 @@ ListAttribute( const char* key, const ListAttributeType& type ) : m_combo( 0 ), m_nonModal( ApplyCaller( *this ) ), m_type( type ){ - GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() ); + GtkComboBox* combo = ui::ComboBoxText(); for ( ListAttributeType::const_iterator i = type.begin(); i != type.end(); ++i ) { diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index 91cb00c4..e6fc9c24 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -253,7 +253,7 @@ ui::Window 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 ); if ( globalGameComboConfiguration().known[0] != '\0' ) { @@ -295,7 +295,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); - GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() ); + GtkComboBox* combo = ui::ComboBoxText(); gtk_combo_box_append_text( combo, globalMappingMode().sp_mapping_mode ); gtk_combo_box_append_text( combo, globalMappingMode().mp_mapping_mode ); diff --git a/radiant/patchdialog.cpp b/radiant/patchdialog.cpp index c0ba02c4..2975e08b 100644 --- a/radiant/patchdialog.cpp +++ b/radiant/patchdialog.cpp @@ -616,7 +616,7 @@ ui::Window PatchInspector::BuildDialog(){ (GtkAttachOptions)( 0 ), 0, 0 ); } { - GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() ); + GtkComboBox* combo = ui::ComboBoxText(); g_signal_connect( G_OBJECT( combo ), "changed", G_CALLBACK( OnSelchangeComboColRow ), this ); AddDialogData( *combo, m_nRow ); @@ -629,7 +629,7 @@ ui::Window PatchInspector::BuildDialog(){ } { - GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() ); + GtkComboBox* combo = ui::ComboBoxText(); g_signal_connect( G_OBJECT( combo ), "changed", G_CALLBACK( OnSelchangeComboColRow ), this ); AddDialogData( *combo, m_nCol ); diff --git a/radiant/patchmanip.cpp b/radiant/patchmanip.cpp index f4e9c17d..91f0acf5 100644 --- a/radiant/patchmanip.cpp +++ b/radiant/patchmanip.cpp @@ -880,7 +880,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, } { - GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() ); + GtkComboBox* combo = ui::ComboBoxText(); #define D_ITEM( x ) if ( x >= mincols && ( !maxcols || x <= maxcols ) ) gtk_combo_box_append_text( combo, # x ) D_ITEM( 3 ); D_ITEM( 5 ); @@ -906,7 +906,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, width = combo; } { - GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() ); + GtkComboBox* combo = ui::ComboBoxText(); #define D_ITEM( x ) if ( x >= minrows && ( !maxrows || x <= maxrows ) ) gtk_combo_box_append_text( combo, # x ) D_ITEM( 3 ); D_ITEM( 5 ); -- 2.39.2