#include "wx/dialog.h"
#include "wx/frame.h"
-#include "gdk/gdk.h"
-#include "gtk/gtk.h"
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+
#include "wx/gtk/win_gtk.h"
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
-extern bool g_blockEventsOnDrag;
+extern bool g_blockEventsOnDrag;
//-----------------------------------------------------------------------------
// "clicked"
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;
+ }
+
+ wxNode *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.First())
+ node = rb->m_boxes.Last();
+ else
+ node = node->Previous();
+ }
+ else
+ {
+ if (node == rb->m_boxes.Last())
+ node = rb->m_boxes.First();
+ else
+ node = node->Next();
+ }
+
+ GtkWidget *button = (GtkWidget*) node->Data();
+
+ gtk_widget_grab_focus( button );
+
+ return TRUE;
+}
+
//-----------------------------------------------------------------------------
// wxRadioBox
//-----------------------------------------------------------------------------
m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, label.mbc_str() ) );
+ gtk_signal_connect( GTK_OBJECT(m_radio), "key_press_event",
+ GTK_SIGNAL_FUNC(gtk_radiobox_keypress_callback), (gpointer)this );
+
m_boxes.Append( (wxObject*) m_radio );
ConnectWidget( GTK_WIDGET(m_radio) );
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
- GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
+ GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
gtk_pizza_put( GTK_PIZZA(m_parent->m_wxwindow),
GTK_WIDGET(m_radio),
if (button->active)
{
gtk_widget_grab_focus( GTK_WIDGET(button) );
-
return;
}
node = node->Next();
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
- DisableEvents();
+ GtkDisableEvents();
gtk_toggle_button_set_state( button, 1 );
- EnableEvents();
+ GtkEnableEvents();
}
int wxRadioBox::GetSelection(void) const
wxFAIL_MSG(wxT("wxRadioBox::SetNumberOfRowsOrCols not implemented."));
}
-void wxRadioBox::DisableEvents()
+void wxRadioBox::GtkDisableEvents()
{
wxNode *node = m_boxes.First();
while (node)
}
}
-void wxRadioBox::EnableEvents()
+void wxRadioBox::GtkEnableEvents()
{
wxNode *node = m_boxes.First();
while (node)
}
}
+#if wxUSE_TOOLTIPS
+void wxRadioBox::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
+{
+ wxNode *node = m_boxes.First();
+ while (node)
+ {
+ GtkWidget *widget = GTK_WIDGET( node->Data() );
+ gtk_tooltips_set_tip( tips, widget, wxConvCurrent->cWX2MB(tip), (gchar*) NULL );
+ node = node->Next();
+ }
+}
+#endif // wxUSE_TOOLTIPS
+
bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window )
{
if (window == m_widget->window) return TRUE;