#include "wx/gtk/private.h"
#include <gdk/gdkkeysyms.h>
-#include "wx/gtk/win_gtk.h"
-
//-----------------------------------------------------------------------------
// wxGTKRadioButtonInfo
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
#include "wx/listimpl.cpp"
-WX_DEFINE_LIST( wxRadioBoxButtonsInfoList );
+WX_DEFINE_LIST( wxRadioBoxButtonsInfoList )
extern bool g_blockEventsOnDrag;
-extern wxWindowGTK *g_delayedFocus;
//-----------------------------------------------------------------------------
// "clicked"
extern "C" {
static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioBox *rb )
{
- if (g_isIdle) wxapp_install_idle_handler();
-
if (!rb->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
extern "C" {
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;
return FALSE;
}
- g_signal_stop_emission_by_name (widget, "key_press_event");
-
if ((gdk_event->keyval == GDK_Up) ||
(gdk_event->keyval == GDK_Left))
{
GtkAllocation * alloc,
wxRadioBox *win )
{
- unsigned int n = 0;
for ( wxRadioBoxButtonsInfoList::compatibility_iterator node = win->m_buttonsInfo.GetFirst();
node;
- node = node->GetNext(), n++ )
+ node = node->GetNext())
{
- if( widget == GTK_WIDGET(node->GetData()->button) )
+ if (widget == GTK_WIDGET(node->GetData()->button))
{
const wxPoint origin = win->GetPosition();
wxRect rect = wxRect( alloc->x - origin.x, alloc->y - origin.y,
void wxRadioBox::Init()
{
- m_needParent = true;
- m_acceptsFocus = true;
-
m_hasFocus =
m_lostFocus = false;
}
m_widget = GTKCreateFrame(title);
wxControl::SetLabel(title);
+ if ( HasFlag(wxNO_BORDER) )
+ {
+ // If we don't do this here, the wxNO_BORDER style is ignored in Show()
+ gtk_frame_set_shadow_type(GTK_FRAME(m_widget), GTK_SHADOW_NONE);
+ }
+
// majorDim may be 0 if all trailing parameters were omitted, so don't
// assert here but just use the correct value for it
radio_button_group = gtk_radio_button_get_group( GTK_RADIO_BUTTON(rbtn) );
label.Empty();
- for ( const wxChar *pc = choices[i]; *pc; pc++ )
+ for ( wxString::const_iterator pc = choices[i].begin();
+ pc != choices[i].end(); ++pc )
{
if ( *pc != wxT('&') )
label += *pc;
wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
while (node)
{
- g_signal_handlers_disconnect_by_func (node->GetData()->button,
- (gpointer) gtk_radiobutton_clicked_callback,
- this);
+ g_signal_handlers_block_by_func(node->GetData()->button,
+ (gpointer)gtk_radiobutton_clicked_callback, this);
node = node->GetNext();
}
wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
while (node)
{
- g_signal_connect (node->GetData()->button, "clicked",
- G_CALLBACK (gtk_radiobutton_clicked_callback), this);
+ g_signal_handlers_unblock_by_func(node->GetData()->button,
+ (gpointer)gtk_radiobutton_clicked_callback, this);
node = node->GetNext();
}
}
#if wxUSE_TOOLTIPS
-void wxRadioBox::ApplyToolTip(GtkTooltips * WXUNUSED(tips), const wxChar *tip)
+void wxRadioBox::ApplyToolTip(GtkTooltips * WXUNUSED(tips), const gchar *tip)
{
// set this tooltip for all radiobuttons which don't have their own tips
unsigned n = 0;
{
if ( !GetItemToolTip(n) )
{
- wxToolTip::Apply(GTK_WIDGET(node->GetData()->button),
- wxConvCurrent->cWX2MB(tip));
+ wxToolTip::Apply(GTK_WIDGET(node->GetData()->button), tip);
}
}
}
#endif // wxUSE_TOOLTIPS
-bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window )
+GdkWindow *wxRadioBox::GTKGetWindow(wxArrayGdkWindows& windows) const
{
- if (window == m_widget->window)
- return true;
+ windows.push_back(m_widget->window);
wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
while (node)
{
GtkWidget *button = GTK_WIDGET( node->GetData()->button );
- if (window == button->window)
- return true;
+ windows.push_back(button->window);
node = node->GetNext();
}
- return false;
+ return NULL;
}
void wxRadioBox::OnInternalIdle()
{
+ wxControl::OnInternalIdle();
+
if ( m_lostFocus )
{
m_hasFocus = false;
(void)GetEventHandler()->ProcessEvent( event );
}
-
- if (g_delayedFocus == this)
- {
- if (GTK_WIDGET_REALIZED(m_widget))
- {
- g_delayedFocus = NULL;
- SetFocus();
- }
- }
}
// static
for ( wxRadioBoxButtonsInfoList::compatibility_iterator
node = m_buttonsInfo.GetFirst(); node; node = node->GetNext(), n++ )
{
- if ( m_buttonsInfo[n]->rect.Inside(pt) )
+ if ( m_buttonsInfo[n]->rect.Contains(pt) )
return n;
}