]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Wrap GtkComboBox
authorTimePath <andrew.hardaker1995@gmail.com>
Wed, 17 Feb 2016 05:33:57 +0000 (16:33 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 17 Feb 2016 05:33:57 +0000 (16:33 +1100)
libs/uilib/uilib.cpp
libs/uilib/uilib.h
radiant/dialog.cpp
radiant/entityinspector.cpp
radiant/gtkdlgs.cpp
radiant/patchdialog.cpp
radiant/patchmanip.cpp

index 9989601ba1273dc796097002c36d6a0b03e98b39..763029b26abc19cca6d1358331e66d5678286882 100644 (file)
@@ -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)))
     { }
 
index 6f58a2e0ac3b98ec0e0dabe072b3ad39d31f17b8..f9b996c648409987cf10aac8bed62f541db08fe1 100644 (file)
@@ -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);
index 337f414f4e01a0ae567e2face27d268f8c3232ac..38449790eaec5a6ac10afd93c54f552c9b2c7216 100644 (file)
@@ -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 )
                {
index d31b86c38310946b905467fbd4263490f008e3ca..8db78f1c0973dbf9accbfba8cb53078b4f6a450f 100644 (file)
@@ -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 )
        {
index 91cb00c4f1363f096728c61fd392e2546e865f7f..e6fc9c2408c3d5fbdf478c7700fd84b702efd302 100644 (file)
@@ -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 );
 
index c0ba02c442f14c3c779a7246e84b58c61a170d68..2975e08b6420845e063008be25eb6de2610d1f01 100644 (file)
@@ -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 );
 
index f4e9c17d85e84e9f0a436a5da64443eb174deba9..91f0acf51a9dcdf7635e367d458edecc7b501cb3 100644 (file)
@@ -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 );