X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3eb78d7ebb6f0dcf9222c379189068266d93c463..b58197f24a87e0dc81ba0bdd4fc1370470a5ae2f:/src/gtk/notebook.cpp?ds=sidebyside diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index ca46259e27..ea57e8c433 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -17,6 +17,10 @@ #include "wx/imaglist.h" #include "wx/intl.h" #include "wx/log.h" + +#include "gdk/gdk.h" +#include "gtk/gtk.h" +#include "wx/gtk/win_gtk.h" #include "gdk/gdkkeysyms.h" //----------------------------------------------------------------------------- @@ -123,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; @@ -180,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; @@ -377,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 ) @@ -425,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) { @@ -497,6 +509,11 @@ void wxNotebook::SetPadding( const wxSize &WXUNUSED(padding) ) wxFAIL_MSG( "wxNotebook::SetPadding not implemented" ); } +void wxNotebook::SetTabSize(const wxSize& sz) +{ + wxFAIL_MSG( "wxNotebook::SetTabSize not implemented" ); +} + bool wxNotebook::DeleteAllPages() { wxCHECK_MSG( m_widget != NULL, FALSE, "invalid notebook" ); @@ -620,6 +637,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" );