From fd4081aa33f41ccd3d373b3cac9e9172e69d888b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 26 Mar 2007 23:46:31 +0000 Subject: [PATCH] make Ctrl-PageUp/Down work for changing notebook pages even when there is a wxWindow (i.e. not a native wxControl) in the hierarchy; this comes at the price of not being able to use the same key combinations for horizontal scrolling of the windows which do not have wxHSCROLL style and this seems like an acceptable tradeoff git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45087 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/window.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 7a5501119c..481f1286f6 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2330,6 +2330,24 @@ bool wxWindowGTK::Create( wxWindow *parent, GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT_GET_CLASS(m_widget) ); scroll_class->scrollbar_spacing = 0; + // we create a GtkScrolledWindow for all windows, even those which don't + // use scrollbars, but there is a conflict with default bindings at GTK+ + // level between scrolled windows and notebooks both of which want to use + // Ctrl-PageUp/Down: scrolled windows for scrolling in the horizontal + // direction and notebooks for changing pages -- we decide that if we don't + // have wxHSCROLL style we can safely sacrifice horizontal scrolling if it + // means we can get working keyboard navigation in notebooks + if ( !HasFlag(wxHSCROLL) ) + { + GtkBindingSet * + bindings = gtk_binding_set_by_class(G_OBJECT_GET_CLASS(m_widget)); + if ( bindings ) + { + gtk_binding_entry_remove(bindings, GDK_Page_Up, GDK_CONTROL_MASK); + gtk_binding_entry_remove(bindings, GDK_Page_Down, GDK_CONTROL_MASK); + } + } + if (HasFlag(wxALWAYS_SHOW_SB)) { gtk_scrolled_window_set_policy( scrolledWindow, GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS );