PreCreation( parent, id, pos, size, style, name );
+#if wxUSE_VALIDATORS
SetValidator( validator );
+#endif
m_widget = gtk_scrolled_window_new( (GtkAdjustment*) NULL, (GtkAdjustment*) NULL );
if (style & wxLB_ALWAYS_SB)
{
wxCHECK_RET( m_list != NULL, _T("invalid listbox") );
+ DisableEvents();
+
gtk_list_unselect_item( m_list, n );
+
+ EnableEvents();
}
int wxListBox::FindString( const wxString &item ) const
{
wxCHECK_RET( m_list != NULL, _T("invalid listbox") );
+ DisableEvents();
+
if (select)
gtk_list_select_item( m_list, n );
else
gtk_list_unselect_item( m_list, n );
+
+ EnableEvents();
}
void wxListBox::SetString( int n, const wxString &string )
GList *child = m_list->children;
while (child)
{
- gtk_tooltips_set_tip( tips, GTK_WIDGET( child->data ), wxConvLocal.cWX2MB(tip), (gchar*) NULL );
+ gtk_tooltips_set_tip( tips, GTK_WIDGET( child->data ), wxConvCurrent->cWX2MB(tip), (gchar*) NULL );
child = child->next;
}
}
}
#endif
+void wxListBox::DisableEvents()
+{
+ GList *child = m_list->children;
+ while (child)
+ {
+ gtk_signal_disconnect_by_func( GTK_OBJECT(child->data),
+ GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
+
+ if (HasFlag(wxLB_MULTIPLE))
+ gtk_signal_disconnect_by_func( GTK_OBJECT(child->data),
+ GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
+
+ child = child->next;
+ }
+}
+
+void wxListBox::EnableEvents()
+{
+ GList *child = m_list->children;
+ while (child)
+ {
+ gtk_signal_connect( GTK_OBJECT(child->data), "select",
+ GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
+
+ if (HasFlag(wxLB_MULTIPLE))
+ gtk_signal_connect( GTK_OBJECT(child->data), "deselect",
+ GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
+
+ child = child->next;
+ }
+}
+
GtkWidget *wxListBox::GetConnectWidget()
{
return GTK_WIDGET(m_list);