+ wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
+ event.SetInt( rb->GetSelection() );
+ event.SetString( rb->GetStringSelection() );
+ event.SetEventObject( rb );
+ rb->GetEventHandler()->ProcessEvent(event);
+}
+
+//-----------------------------------------------------------------------------
+// "key_press_event"
+//-----------------------------------------------------------------------------
+
+static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxRadioBox *rb )
+{
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (!rb->m_hasVMT) return FALSE;
+ if (g_blockEventsOnDrag) return FALSE;
+
+ if ((gdk_event->keyval != GDK_Up) &&
+ (gdk_event->keyval != GDK_Down) &&
+ (gdk_event->keyval != GDK_Left) &&
+ (gdk_event->keyval != GDK_Right))
+ {
+ return FALSE;
+ }
+
+ wxList::compatibility_iterator node = rb->m_boxes.Find( (wxObject*) widget );
+ if (!node)
+ {
+ return FALSE;
+ }
+
+ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
+
+ if ((gdk_event->keyval == GDK_Up) ||
+ (gdk_event->keyval == GDK_Left))
+ {
+ if (node == rb->m_boxes.GetFirst())
+ node = rb->m_boxes.GetLast();
+ else
+ node = node->GetPrevious();
+ }
+ else
+ {
+ if (node == rb->m_boxes.GetLast())
+ node = rb->m_boxes.GetFirst();
+ else
+ node = node->GetNext();
+ }
+
+ GtkWidget *button = (GtkWidget*) node->GetData();
+
+ gtk_widget_grab_focus( button );
+
+ return TRUE;
+}
+
+static gint gtk_radiobutton_focus_in( GtkWidget *widget,
+ GdkEvent *WXUNUSED(event),
+ wxRadioBox *win )
+{
+ if ( win->m_lostFocus )
+ {
+ // no, we didn't really lose it
+ win->m_lostFocus = FALSE;
+ }
+ else if ( !win->m_hasFocus )
+ {
+ win->m_hasFocus = TRUE;
+
+ wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
+ event.SetEventObject( win );
+
+ // never stop the signal emission, it seems to break the kbd handling
+ // inside the radiobox
+ (void)win->GetEventHandler()->ProcessEvent( event );
+ }
+
+ return FALSE;
+}
+
+static gint gtk_radiobutton_focus_out( GtkWidget *widget,
+ GdkEvent *WXUNUSED(event),
+ wxRadioBox *win )
+{
+ // wxASSERT_MSG( win->m_hasFocus, _T("got focus out without any focus in?") );
+ // Replace with a warning, else we dump core a lot!
+ // if (!win->m_hasFocus)
+ // wxLogWarning(_T("Radiobox got focus out without any focus in.") );
+
+ // we might have lost the focus, but may be not - it may have just gone to
+ // another button in the same radiobox, so we'll check for it in the next
+ // idle iteration (leave m_hasFocus == TRUE for now)
+ win->m_lostFocus = TRUE;
+
+ return FALSE;