+ wxCHECK_RET( m_list != NULL, wxT("invalid listbox") );
+
+ GtkWidget *list_item;
+
+ wxString label(item);
+#if wxUSE_CHECKLISTBOX
+ if (m_hasCheckBoxes)
+ {
+ label.Prepend(wxCHECKLBOX_STRING);
+ }
+#endif // wxUSE_CHECKLISTBOX
+
+ list_item = gtk_list_item_new_with_label( wxGTK_CONV( label ) );
+
+ GList *gitem_list = g_list_alloc ();
+ gitem_list->data = list_item;
+
+ if (pos == -1)
+ gtk_list_append_items( GTK_LIST (m_list), gitem_list );
+ else
+ gtk_list_insert_items( GTK_LIST (m_list), gitem_list, pos );
+
+ gtk_signal_connect_after( GTK_OBJECT(list_item), "select",
+ GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
+
+ if (HasFlag(wxLB_MULTIPLE) || HasFlag(wxLB_EXTENDED))
+ gtk_signal_connect_after( GTK_OBJECT(list_item), "deselect",
+ GTK_SIGNAL_FUNC(gtk_listitem_deselect_callback), (gpointer)this );
+
+ gtk_signal_connect( GTK_OBJECT(list_item),
+ "button_press_event",
+ (GtkSignalFunc)gtk_listbox_button_press_callback,
+ (gpointer) this );
+
+ gtk_signal_connect_after( GTK_OBJECT(list_item),
+ "button_release_event",
+ (GtkSignalFunc)gtk_listbox_button_release_callback,
+ (gpointer) this );
+
+ gtk_signal_connect( GTK_OBJECT(list_item),
+ "key_press_event",
+ (GtkSignalFunc)gtk_listbox_key_press_callback,
+ (gpointer)this );
+
+
+ gtk_signal_connect( GTK_OBJECT(list_item), "focus_in_event",
+ GTK_SIGNAL_FUNC(gtk_listitem_focus_in_callback), (gpointer)this );
+
+ gtk_signal_connect( GTK_OBJECT(list_item), "focus_out_event",
+ GTK_SIGNAL_FUNC(gtk_listitem_focus_out_callback), (gpointer)this );
+
+ ConnectWidget( list_item );
+
+ if (GTK_WIDGET_REALIZED(m_widget))
+ {
+ gtk_widget_show( list_item );
+
+ gtk_widget_realize( list_item );
+ gtk_widget_realize( GTK_BIN(list_item)->child );
+
+#if wxUSE_TOOLTIPS
+ if (m_tooltip) m_tooltip->Apply( this );
+#endif
+ }
+
+ // Apply current widget style to the new list_item
+ GtkRcStyle *style = CreateWidgetStyle();
+ if (style)
+ {
+ gtk_widget_modify_style( GTK_WIDGET( list_item ), style );
+ GtkBin *bin = GTK_BIN( list_item );
+ gtk_widget_modify_style( GTK_WIDGET( bin->child ), style );
+ gtk_rc_style_unref( style );
+ }
+}
+
+// ----------------------------------------------------------------------------
+// deleting items
+// ----------------------------------------------------------------------------
+
+void wxListBox::DoClear()
+{
+ wxCHECK_RET( m_list != NULL, wxT("invalid listbox") );
+
+ gtk_list_clear_items( m_list, 0, (int)GetCount() );
+
+ if ( GTK_LIST(m_list)->last_focus_child != NULL )
+ {
+ // This should be NULL, I think.
+ GTK_LIST(m_list)->last_focus_child = NULL;
+ }
+
+ m_clientList.Clear();
+
+ if ( m_strings )
+ m_strings->Clear();
+}
+
+void wxListBox::DoDeleteOneItem(unsigned int n)
+{
+ wxCHECK_RET( m_list != NULL, wxT("invalid listbox") );
+
+ GList *child = g_list_nth( m_list->children, n );
+
+ wxCHECK_RET( child, wxT("wrong listbox index") );
+
+ GList *list = g_list_append( NULL, child->data );
+ gtk_list_remove_items( m_list, list );
+ g_list_free( list );
+
+ wxList::compatibility_iterator node = m_clientList.Item( n );
+ if ( node )
+ {
+ m_clientList.Erase( node );
+ }
+
+ if ( m_strings )
+ m_strings->RemoveAt(n);
+}
+
+// ----------------------------------------------------------------------------
+// client data
+// ----------------------------------------------------------------------------
+
+void wxListBox::DoSetItemClientData(unsigned int n, void* clientData)
+{
+ wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") );
+
+ wxList::compatibility_iterator node = m_clientList.Item( n );
+ wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetItemClientData") );
+
+ node->SetData( (wxObject*) clientData );
+}
+
+void* wxListBox::DoGetItemClientData(unsigned int n) const
+{
+ wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid listbox control") );
+
+ wxList::compatibility_iterator node = m_clientList.Item( n );
+ wxCHECK_MSG( node, NULL, wxT("invalid index in wxListBox::DoGetItemClientData") );
+
+ return node->GetData();
+}
+
+// ----------------------------------------------------------------------------
+// string list access
+// ----------------------------------------------------------------------------
+
+wxString wxListBox::GetRealLabel(GList *item) const
+{
+ GtkBin *bin = GTK_BIN( item->data );