X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8017ee9be3f4672cf17a4aac59909d5fe522381d..5ccb95f690bd7265b1b86718149a79bb97dcf4d8:/src/gtk/radiobox.cpp diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index cf1cb5c16e..e94ad71003 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: radiobox.cpp +// Name: src/gtk/radiobox.cpp // Purpose: // Author: Robert Roebling // Id: $Id$ @@ -7,10 +7,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "radiobox.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -45,6 +41,7 @@ extern wxWindowGTK *g_delayedFocus; // "clicked" //----------------------------------------------------------------------------- +extern "C" { static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioBox *rb ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -60,11 +57,13 @@ static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioBo event.SetEventObject( rb ); rb->GetEventHandler()->ProcessEvent(event); } +} //----------------------------------------------------------------------------- // "key_press_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxRadioBox *rb ) { if (g_isIdle) @@ -111,7 +110,9 @@ static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_ return TRUE; } +} +extern "C" { static gint gtk_radiobutton_focus_in( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxRadioBox *win ) @@ -135,7 +136,9 @@ static gint gtk_radiobutton_focus_in( GtkWidget *widget, return FALSE; } +} +extern "C" { static gint gtk_radiobutton_focus_out( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxRadioBox *win ) @@ -152,6 +155,7 @@ static gint gtk_radiobutton_focus_out( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // wxRadioBox @@ -214,15 +218,15 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, num_of_cols = num_per_major; num_of_rows = m_majorDim; } - + GtkRadioButton *m_radio = (GtkRadioButton*) NULL; GtkWidget *table = gtk_table_new( num_of_rows, num_of_cols, FALSE ); - gtk_table_set_col_spacings( GTK_TABLE(table), 2 ); - gtk_table_set_row_spacings( GTK_TABLE(table), 2 ); + gtk_table_set_col_spacings( GTK_TABLE(table), 1 ); + gtk_table_set_row_spacings( GTK_TABLE(table), 1 ); gtk_widget_show( table ); gtk_container_add( GTK_CONTAINER(m_widget), table ); - + wxString label; GSList *radio_button_group = (GSList *) NULL; for (int i = 0; i < n; i++) @@ -251,7 +255,8 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, int right = (i%num_of_cols) + 1; int top = i/num_of_cols; int bottom = (i/num_of_cols)+1; - gtk_table_attach_defaults( GTK_TABLE(table), GTK_WIDGET(m_radio), left, right, top, bottom ); + gtk_table_attach( GTK_TABLE(table), GTK_WIDGET(m_radio), left, right, top, bottom, + GTK_FILL, GTK_FILL, 1, 1 ); } else { @@ -259,7 +264,8 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, int right = (i/num_of_rows) + 1; int top = i%num_of_rows; int bottom = (i%num_of_rows)+1; - gtk_table_attach_defaults( GTK_TABLE(table), GTK_WIDGET(m_radio), left, right, top, bottom ); + gtk_table_attach( GTK_TABLE(table), GTK_WIDGET(m_radio), left, right, top, bottom, + GTK_FILL, GTK_FILL, 1, 1 ); } ConnectWidget( GTK_WIDGET(m_radio) ); @@ -322,7 +328,7 @@ bool wxRadioBox::Show( bool show ) return true; } -int wxRadioBox::FindString( const wxString &find ) const +int wxRadioBox::FindString( const wxString &find, bool bCase ) const { wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid radiobox") ); @@ -337,7 +343,7 @@ int wxRadioBox::FindString( const wxString &find ) const #else wxString str( label->label ); #endif - if (find == str) + if (find.IsSameAs( str, bCase )) return count; count++; @@ -652,24 +658,4 @@ wxRadioBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) return attr; } -#if WXWIN_COMPATIBILITY_2_2 - -int wxRadioBox::Number() const -{ - return GetCount(); -} - -wxString wxRadioBox::GetLabel(int n) const -{ - return GetString(n); -} - -void wxRadioBox::SetLabel( int item, const wxString& label ) -{ - SetString(item, label); -} - -#endif // WXWIN_COMPATIBILITY_2_2 - #endif // wxUSE_RADIOBOX -