GTK_COMBO_BOX -> GTK_COMBO_BOX_TEXT

This commit is contained in:
Garux 2020-05-21 19:18:51 +03:00
parent f14722d36f
commit ded059f817
5 changed files with 46 additions and 53 deletions

View File

@ -486,11 +486,11 @@ void Dialog::addCombo( GtkWidget* vbox, const char* name, StringArrayRange value
GtkWidget* alignment = gtk_alignment_new( 0.0, 0.5, 0.0, 0.0 ); GtkWidget* alignment = gtk_alignment_new( 0.0, 0.5, 0.0, 0.0 );
gtk_widget_show( alignment ); gtk_widget_show( alignment );
{ {
GtkWidget* combo = gtk_combo_box_new_text(); GtkWidget* combo = gtk_combo_box_text_new();
for ( StringArrayRange::Iterator i = values.first; i != values.last; ++i ) for ( StringArrayRange::Iterator i = values.first; i != values.last; ++i )
{ {
gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), *i ); gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( combo ), *i );
} }
AddIntComboData( *GTK_COMBO_BOX( combo ), importViewer, exportViewer ); AddIntComboData( *GTK_COMBO_BOX( combo ), importViewer, exportViewer );

View File

@ -773,17 +773,17 @@ ListAttribute( const char* key, const ListAttributeType& type ) :
m_combo( 0 ), m_combo( 0 ),
m_nonModal( ApplyCaller( *this ) ), m_nonModal( ApplyCaller( *this ) ),
m_type( type ){ m_type( type ){
GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() ); GtkWidget* combo = gtk_combo_box_text_new();
for ( ListAttributeType::const_iterator i = type.begin(); i != type.end(); ++i ) for ( ListAttributeType::const_iterator i = type.begin(); i != type.end(); ++i )
{ {
gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), ( *i ).first.c_str() ); gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( combo ), ( *i ).first.c_str() );
} }
gtk_widget_show( GTK_WIDGET( combo ) ); gtk_widget_show( combo );
m_nonModal.connect( combo ); m_nonModal.connect( GTK_COMBO_BOX( combo ) );
m_combo = combo; m_combo = GTK_COMBO_BOX( combo );
} }
void release(){ void release(){
delete this; delete this;

View File

@ -155,23 +155,18 @@ inline void path_copy_clean( char* destination, const char* source ){
struct GameCombo struct GameCombo
{ {
GtkComboBox* game_select; GtkComboBoxText* game_select;
GtkEntry* fsgame_entry; GtkEntry* fsgame_entry;
}; };
gboolean OnSelchangeComboWhatgame( GtkWidget *widget, GameCombo* combo ){ gboolean OnSelchangeComboWhatgame( GtkWidget *widget, GameCombo* combo ){
const char *gamename; if( gchar* gamename = gtk_combo_box_text_get_active_text( combo->game_select ) ){
{ gamecombo_t gamecombo = gamecombo_for_gamename( gamename );
GtkTreeIter iter;
gtk_combo_box_get_active_iter( combo->game_select, &iter ); gtk_entry_set_text( combo->fsgame_entry, gamecombo.fs_game );
gtk_tree_model_get( gtk_combo_box_get_model( combo->game_select ), &iter, 0, (gpointer*)&gamename, -1 ); gtk_widget_set_sensitive( GTK_WIDGET( combo->fsgame_entry ), gamecombo.sensitive );
g_free( gamename );
} }
gamecombo_t gamecombo = gamecombo_for_gamename( gamename );
gtk_entry_set_text( combo->fsgame_entry, gamecombo.fs_game );
gtk_widget_set_sensitive( GTK_WIDGET( combo->fsgame_entry ), gamecombo.sensitive );
return FALSE; return FALSE;
} }
@ -240,20 +235,20 @@ GtkWindow* ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
} }
{ {
dialog.game_combo.game_select = GTK_COMBO_BOX( gtk_combo_box_new_text() ); GtkComboBoxText* combo = dialog.game_combo.game_select = GTK_COMBO_BOX_TEXT( gtk_combo_box_text_new() );
gtk_combo_box_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().basegame ); gtk_combo_box_text_append_text( combo, globalGameComboConfiguration().basegame );
if ( globalGameComboConfiguration().known[0] != '\0' ) { if ( globalGameComboConfiguration().known[0] != '\0' ) {
gtk_combo_box_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().known ); gtk_combo_box_text_append_text( combo, globalGameComboConfiguration().known );
} }
gtk_combo_box_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().custom ); gtk_combo_box_text_append_text( combo, globalGameComboConfiguration().custom );
gtk_widget_show( GTK_WIDGET( dialog.game_combo.game_select ) ); gtk_widget_show( GTK_WIDGET( combo ) );
gtk_table_attach( table2, GTK_WIDGET( dialog.game_combo.game_select ), 1, 2, 0, 1, gtk_table_attach( table2, GTK_WIDGET( combo ), 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
g_signal_connect( G_OBJECT( dialog.game_combo.game_select ), "changed", G_CALLBACK( OnSelchangeComboWhatgame ), &dialog.game_combo ); g_signal_connect( G_OBJECT( combo ), "changed", G_CALLBACK( OnSelchangeComboWhatgame ), &dialog.game_combo );
} }
{ {
@ -282,16 +277,16 @@ GtkWindow* ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() ); GtkComboBoxText* combo = GTK_COMBO_BOX_TEXT( gtk_combo_box_text_new() );
gtk_combo_box_append_text( combo, globalMappingMode().sp_mapping_mode ); gtk_combo_box_text_append_text( combo, globalMappingMode().sp_mapping_mode );
gtk_combo_box_append_text( combo, globalMappingMode().mp_mapping_mode ); gtk_combo_box_text_append_text( combo, globalMappingMode().mp_mapping_mode );
gtk_widget_show( GTK_WIDGET( combo ) ); gtk_widget_show( GTK_WIDGET( combo ) );
gtk_table_attach( table2, GTK_WIDGET( combo ), 1, 2, 3, 4, gtk_table_attach( table2, GTK_WIDGET( combo ), 1, 2, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
dialog.gamemode_combo = combo; dialog.gamemode_combo = GTK_COMBO_BOX( combo );
} }
} }
} }
@ -301,7 +296,7 @@ GtkWindow* ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal
const char* dir = gamename_get(); const char* dir = gamename_get();
gamecombo_t gamecombo = gamecombo_for_dir( dir ); gamecombo_t gamecombo = gamecombo_for_dir( dir );
gtk_combo_box_set_active( dialog.game_combo.game_select, gamecombo.game ); gtk_combo_box_set_active( GTK_COMBO_BOX( dialog.game_combo.game_select ), gamecombo.game );
gtk_entry_set_text( dialog.game_combo.fsgame_entry, gamecombo.fs_game ); gtk_entry_set_text( dialog.game_combo.fsgame_entry, gamecombo.fs_game );
gtk_widget_set_sensitive( GTK_WIDGET( dialog.game_combo.fsgame_entry ), gamecombo.sensitive ); gtk_widget_set_sensitive( GTK_WIDGET( dialog.game_combo.fsgame_entry ), gamecombo.sensitive );

View File

@ -227,8 +227,8 @@ float m_fZ;
float m_fVShift; */ float m_fVShift; */
int m_nCol; int m_nCol;
int m_nRow; int m_nRow;
GtkComboBox *m_pRowCombo; GtkComboBoxText *m_pRowCombo;
GtkComboBox *m_pColCombo; GtkComboBoxText *m_pColCombo;
std::size_t m_countRows; std::size_t m_countRows;
std::size_t m_countCols; std::size_t m_countCols;
@ -604,29 +604,27 @@ GtkWindow* PatchInspector::BuildDialog(){
(GtkAttachOptions)( 0 ), 0, 0 ); (GtkAttachOptions)( 0 ), 0, 0 );
} }
{ {
GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() ); GtkComboBoxText* combo = m_pRowCombo = GTK_COMBO_BOX_TEXT( gtk_combo_box_text_new() );
g_signal_connect( G_OBJECT( combo ), "changed", G_CALLBACK( OnSelchangeComboColRow ), this ); g_signal_connect( G_OBJECT( combo ), "changed", G_CALLBACK( OnSelchangeComboColRow ), this );
AddDialogData( *combo, m_nRow ); AddDialogData( *GTK_COMBO_BOX( combo ), m_nRow );
gtk_widget_show( GTK_WIDGET( combo ) ); gtk_widget_show( GTK_WIDGET( combo ) );
gtk_table_attach( table, GTK_WIDGET( combo ), 0, 1, 1, 2, gtk_table_attach( table, GTK_WIDGET( combo ), 0, 1, 1, 2,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 ); (GtkAttachOptions)( 0 ), 0, 0 );
gtk_widget_set_size_request( GTK_WIDGET( combo ), 60, -1 ); gtk_widget_set_size_request( GTK_WIDGET( combo ), 60, -1 );
m_pRowCombo = combo;
} }
{ {
GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() ); GtkComboBoxText* combo = m_pColCombo = GTK_COMBO_BOX_TEXT( gtk_combo_box_text_new() );
g_signal_connect( G_OBJECT( combo ), "changed", G_CALLBACK( OnSelchangeComboColRow ), this ); g_signal_connect( G_OBJECT( combo ), "changed", G_CALLBACK( OnSelchangeComboColRow ), this );
AddDialogData( *combo, m_nCol ); AddDialogData( *GTK_COMBO_BOX( combo ), m_nCol );
gtk_widget_show( GTK_WIDGET( combo ) ); gtk_widget_show( GTK_WIDGET( combo ) );
gtk_table_attach( table, GTK_WIDGET( combo ), 1, 2, 1, 2, gtk_table_attach( table, GTK_WIDGET( combo ), 1, 2, 1, 2,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 ); (GtkAttachOptions)( 0 ), 0, 0 );
gtk_widget_set_size_request( GTK_WIDGET( combo ), 60, -1 ); gtk_widget_set_size_request( GTK_WIDGET( combo ), 60, -1 );
m_pColCombo = combo;
} }
} }
GtkTable* table = GTK_TABLE( gtk_table_new( 5, 2, FALSE ) ); GtkTable* table = GTK_TABLE( gtk_table_new( 5, 2, FALSE ) );
@ -1059,11 +1057,11 @@ void PatchInspector::GetPatchInfo(){
m_bListenChanged = false; m_bListenChanged = false;
{ {
gtk_combo_box_set_active( m_pRowCombo, 0 ); gtk_combo_box_set_active( GTK_COMBO_BOX( m_pRowCombo ), 0 );
for ( std::size_t i = 0; i < m_countRows; ++i ) for ( std::size_t i = 0; i < m_countRows; ++i )
{ {
gtk_combo_box_remove_text( m_pRowCombo, gint( m_countRows - i - 1 ) ); gtk_combo_box_text_remove( m_pRowCombo, gint( m_countRows - i - 1 ) );
} }
m_countRows = m_Patch->getHeight(); m_countRows = m_Patch->getHeight();
@ -1071,18 +1069,18 @@ void PatchInspector::GetPatchInfo(){
{ {
char buffer[16]; char buffer[16];
sprintf( buffer, "%u", Unsigned( i ) ); sprintf( buffer, "%u", Unsigned( i ) );
gtk_combo_box_append_text( m_pRowCombo, buffer ); gtk_combo_box_text_append_text( m_pRowCombo, buffer );
} }
gtk_combo_box_set_active( m_pRowCombo, 0 ); gtk_combo_box_set_active( GTK_COMBO_BOX( m_pRowCombo ), 0 );
} }
{ {
gtk_combo_box_set_active( m_pColCombo, 0 ); gtk_combo_box_set_active( GTK_COMBO_BOX( m_pColCombo ), 0 );
for ( std::size_t i = 0; i < m_countCols; ++i ) for ( std::size_t i = 0; i < m_countCols; ++i )
{ {
gtk_combo_box_remove_text( m_pColCombo, gint( m_countCols - i - 1 ) ); gtk_combo_box_text_remove( m_pColCombo, gint( m_countCols - i - 1 ) );
} }
m_countCols = m_Patch->getWidth(); m_countCols = m_Patch->getWidth();
@ -1090,10 +1088,10 @@ void PatchInspector::GetPatchInfo(){
{ {
char buffer[16]; char buffer[16];
sprintf( buffer, "%u", Unsigned( i ) ); sprintf( buffer, "%u", Unsigned( i ) );
gtk_combo_box_append_text( m_pColCombo, buffer ); gtk_combo_box_text_append_text( m_pColCombo, buffer );
} }
gtk_combo_box_set_active( m_pColCombo, 0 ); gtk_combo_box_set_active( GTK_COMBO_BOX( m_pColCombo ), 0 );
} }
m_bListenChanged = true; m_bListenChanged = true;

View File

@ -1011,8 +1011,8 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows,
} }
{ {
GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() ); GtkComboBoxText* combo = GTK_COMBO_BOX_TEXT( gtk_combo_box_text_new() );
#define D_ITEM( x ) if ( x >= mincols && ( !maxcols || x <= maxcols ) ) gtk_combo_box_append_text( combo, # x ) #define D_ITEM( x ) if ( x >= mincols && ( !maxcols || x <= maxcols ) ) gtk_combo_box_text_append_text( combo, # x )
D_ITEM( 3 ); D_ITEM( 3 );
D_ITEM( 5 ); D_ITEM( 5 );
D_ITEM( 7 ); D_ITEM( 7 );
@ -1034,11 +1034,11 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
width = combo; width = GTK_COMBO_BOX( combo );
} }
{ {
GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() ); GtkComboBoxText* combo = GTK_COMBO_BOX_TEXT( gtk_combo_box_text_new() );
#define D_ITEM( x ) if ( x >= minrows && ( !maxrows || x <= maxrows ) ) gtk_combo_box_append_text( combo, # x ) #define D_ITEM( x ) if ( x >= minrows && ( !maxrows || x <= maxrows ) ) gtk_combo_box_text_append_text( combo, # x )
D_ITEM( 3 ); D_ITEM( 3 );
D_ITEM( 5 ); D_ITEM( 5 );
D_ITEM( 7 ); D_ITEM( 7 );
@ -1060,7 +1060,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
height = combo; height = GTK_COMBO_BOX( combo );
} }
if( prefab != ePlane ){ if( prefab != ePlane ){