X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4a46cbe8c69e57a1837167097084867331ba4d7e..517cce713e1f345bbf656ef5f02ab2f18f278491:/src/gtk/listbox.cpp diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index 1452eae4ac..439946ad05 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -565,15 +565,8 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, } - gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(m_widget), - GTK_WIDGET(m_treeview) ); - - /* make list scroll when moving the focus down using cursor keys */ - gtk_container_set_focus_vadjustment( - GTK_CONTAINER(m_treeview), - gtk_scrolled_window_get_vadjustment( - GTK_SCROLLED_WINDOW(m_widget))); - + gtk_container_add (GTK_CONTAINER (m_widget), GTK_WIDGET(m_treeview) ); + gtk_widget_show( GTK_WIDGET(m_treeview) ); wxListBox::DoInsertItems(wxArrayString(n, choices), 0); // insert initial items @@ -622,14 +615,10 @@ void wxListBox::GtkInsertItems(const wxArrayString& items, int nCurCount = wxListBox::GetCount(); wxASSERT_MSG(pos <= nCurCount, wxT("Invalid index passed to wxListBox")); - GtkTreeIter* pIter; - if (pos == nCurCount) - { - pIter = NULL; // append - } - else + GtkTreeIter* pIter = NULL; // append by default + GtkTreeIter iter; + if (pos != nCurCount) { - GtkTreeIter iter; gboolean res = gtk_tree_model_iter_nth_child( GTK_TREE_MODEL(m_liststore), &iter, NULL, //NULL = parent = get first @@ -1052,35 +1041,14 @@ GtkWidget *wxListBox::GetConnectWidget() bool wxListBox::IsOwnGtkWindow( GdkWindow *window ) { - return (window == GetGtkBinWindow()); -} - -GdkWindow* wxListBox::GetGtkBinWindow() -{ - // GtkTreeView has 2 GdkWindows (just like GtkPizza and - // any other GtkWidget that can scroll). The one on top - // is usually called "->bin_window" and is the one we are - // looking for here. Since GtkTreeView hides this in the - // private data section, we assume that "->window" only has - // one child window, namely, the "->bin_window". - - GdkWindow *window = GTK_WIDGET(m_treeview)->window; - if (window == NULL) - return NULL; - - GList *children = gdk_window_peek_children( window ); - if (g_list_length(children) == 0) - return NULL; - - GdkWindow *bin_window = (GdkWindow*) g_list_nth_data( children, 0 ); - return bin_window; + return (window == gtk_tree_view_get_bin_window(m_treeview)); } void wxListBox::DoApplyWidgetStyle(GtkRcStyle *style) { if (m_hasBgCol && m_backgroundColour.Ok()) { - GdkWindow *window = GetGtkBinWindow(); + GdkWindow *window = gtk_tree_view_get_bin_window(m_treeview); if (window) { m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) ); @@ -1104,7 +1072,7 @@ void wxListBox::OnInternalIdle() as setting the cursor in a parent window also effects the windows above so that checking for the current cursor is not possible. */ - GdkWindow *window = GetGtkBinWindow(); + GdkWindow *window = gtk_tree_view_get_bin_window(m_treeview); gdk_window_set_cursor( window, cursor.GetCursor() ); }