+void wxListBox::OnInternalIdle()
+{
+ wxCursor cursor = m_cursor;
+ if (g_globalCursor.Ok()) cursor = g_globalCursor;
+
+ if (GTK_WIDGET(m_list)->window && cursor.Ok())
+ {
+ /* I now set the cursor the anew in every OnInternalIdle call
+ as setting the cursor in a parent window also effects the
+ windows above so that checking for the current cursor is
+ not possible. */
+
+ gdk_window_set_cursor( GTK_WIDGET(m_list)->window, cursor.GetCursor() );
+
+ GList *child = m_list->children;
+ while (child)
+ {
+ GtkBin *bin = GTK_BIN( child->data );
+ GtkWidget *label = GTK_WIDGET( bin->child );
+
+ if (!label->window)
+ break;
+ else
+ gdk_window_set_cursor( label->window, cursor.GetCursor() );
+
+ child = child->next;
+ }
+ }
+
+ UpdateWindowUI();
+}
+
+wxSize wxListBox::DoGetBestSize() const
+{
+ int lbWidth = 100; // some defaults
+ int lbHeight = 110;
+ int wLine;
+
+ // Find the widest line
+ for(int i = 0; i < GetCount(); i++) {
+ wxString str(GetString(i));
+ GetTextExtent(str, &wLine, NULL);
+ lbWidth = wxMax(lbWidth, wLine);
+ }
+
+ // Add room for the scrollbar
+ lbWidth += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
+
+ // And just a bit more
+ int cx, cy;
+ GetTextExtent("X", &cx, &cy);
+ lbWidth += 3 * cx;
+
+ // don't make the listbox too tall (limit height to around 10 items) but don't
+ // make it too small neither
+ lbHeight = (cy+4) * wxMin(wxMax(GetCount(), 3), 10);
+
+ return wxSize(lbWidth, lbHeight);
+}
+