X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/83624f79609f0d5e240c1f7d77d044bfff9702fc..49d5d881d4cfacbf5a7b902612ac01a348f6809f:/src/gtk/notebook.cpp diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index db83d59ac4..96be1af67e 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -127,6 +127,10 @@ gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxNo if (g_blockEventsOnDrag) return FALSE; if (!notebook->HasVMT()) return FALSE; + + /* this code makes jumping down from the handles of the notebooks + to the actual items in the visible notebook page possible with + the down-arrow key */ if (gdk_event->keyval != GDK_Down) return FALSE; @@ -184,6 +188,10 @@ static void wxInsertChildInNotebook( wxNotebook* parent, wxWindow* child ) IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxControl) +BEGIN_EVENT_TABLE(wxNotebook, wxControl) + EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey) +END_EVENT_TABLE() + void wxNotebook::Init() { m_imageList = (wxImageList *) NULL; @@ -381,7 +389,7 @@ void wxNotebook::AdvanceSelection( bool bForward ) if (bForward) SetSelection( sel == max ? 0 : sel + 1 ); else - SetSelection( sel == 0 ? max : sel - 1 ); + SetSelection( sel == 0 ? max-1 : sel - 1 ); } void wxNotebook::SetImageList( wxImageList* imageList ) @@ -429,7 +437,7 @@ bool wxNotebook::SetPageImage( int page, int image ) if (image == -1 && nb_page->m_image == -1) return TRUE; /* Case 1): Nothing to do. */ - GtkWidget *pixmapwid = NULL; + GtkWidget *pixmapwid = (GtkWidget*) NULL; if (nb_page->m_image != -1) { @@ -624,6 +632,14 @@ bool wxNotebook::AddPage(wxWindow* win, const wxString& text, return TRUE; } +void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event) +{ + if (event.IsWindowChange()) + AdvanceSelection( event.GetDirection() ); + else + event.Skip(); +} + wxWindow *wxNotebook::GetPage( int page ) const { wxCHECK_MSG( m_widget != NULL, (wxWindow*) NULL, "invalid notebook" );