#include "wx/intl.h"
#include "wx/checklst.h"
#include "wx/settings.h"
+#include "wx/gtk/private.h"
#if wxUSE_TOOLTIPS
#include "wx/tooltip.h"
// data
//-----------------------------------------------------------------------------
-extern bool g_blockEventsOnDrag;
-extern bool g_blockEventsOnScroll;
-extern wxCursor g_globalCursor;
+extern bool g_blockEventsOnDrag;
+extern bool g_blockEventsOnScroll;
+extern wxCursor g_globalCursor;
+extern wxWindowGTK *g_delayedFocus;
static bool g_hasDoubleClicked = FALSE;
gtk_idle_remove( data->m_tag );
- data->m_listbox->SetFirstItem( data->m_item );
+ // check that the items haven't been deleted from the listbox since we had
+ // installed this callback
+ wxListBox *lbox = data->m_listbox;
+ if ( data->m_item < lbox->GetCount() )
+ {
+ lbox->SetFirstItem( data->m_item );
+ }
delete data;
{
m_needParent = TRUE;
m_acceptsFocus = TRUE;
- m_isListBox = TRUE;
m_prevSelection = 0; // or -1 ??
m_blockEvent = FALSE;
}
#endif // wxUSE_CHECKLISTBOX
- list_item = gtk_list_item_new_with_label( label.mbc_str() );
+ list_item = gtk_list_item_new_with_label( wxGTK_CONV( label ) );
GList *gitem_list = g_list_alloc ();
gitem_list->data = list_item;
#endif // wxUSE_CHECKLISTBOX
str += string;
- gtk_label_set( label, str.mbc_str() );
+ gtk_label_set( label, wxGTK_CONV( str ) );
}
else
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
- wxString str = wxString(GET_REAL_LABEL(label->label),*wxConvCurrent);
+#ifdef __WXGTK20__
+ wxString str = wxGTK_CONV_BACK( gtk_label_get_text( label ) );
+#else
+ wxString str = wxString( label->label );
+#endif
return str;
}
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
- wxString str = wxString(GET_REAL_LABEL(label->label),*wxConvCurrent);
+#ifdef __WXGTK20__
+ wxString str = wxGTK_CONV_BACK( gtk_label_get_text( label ) );
+#else
+ wxString str = wxString( label->label );
+#endif
if (str == item)
return count;
}
}
+ if (g_delayedFocus == this)
+ {
+ if (GTK_WIDGET_REALIZED(m_widget))
+ {
+ gtk_widget_grab_focus( m_widget );
+ g_delayedFocus = NULL;
+ }
+ }
+
UpdateWindowUI();
}
return wxSize(lbWidth, lbHeight);
}
-#endif
+void wxListBox::FixUpMouseEvent(GtkWidget *widget, wxCoord& x, wxCoord& y)
+{
+ // the mouse event coords are relative to the listbox items, we need to
+ // translate them to the normal client coords
+ x += widget->allocation.x;
+ y += widget->allocation.y;
+}
+
+#endif // wxUSE_LISTBOX
+