X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c98826242f849bc2ab888c33f547c59dcf8db2fa..c6a6bbbf637a5a580b7ab182483d27522f5e3189:/src/gtk/notebook.cpp diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index bf86abbf3b..14ce6bfac3 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -162,77 +162,6 @@ gtk_notebook_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win ) } } -//----------------------------------------------------------------------------- -// "key_press_event" -//----------------------------------------------------------------------------- - -extern "C" { -static gboolean -gtk_notebook_key_press_callback( GtkWidget *widget, - GdkEventKey *gdk_event, - wxNotebook *notebook ) -{ - // don't need to install idle handler, its done from "event" signal - - if (!notebook->m_hasVMT) return FALSE; - if (g_blockEventsOnDrag) return FALSE; - - /* win is a control: tab can be propagated up */ - if ((gdk_event->keyval == GDK_Left) || (gdk_event->keyval == GDK_Right)) - { - int page; - int nMax = notebook->GetPageCount(); - if ( nMax-- ) // decrement it to get the last valid index - { - int nSel = notebook->GetSelection(); - - // change selection wrapping if it becomes invalid - page = (gdk_event->keyval != GDK_Left) ? nSel == nMax ? 0 - : nSel + 1 - : nSel == 0 ? nMax - : nSel - 1; - } - else // notebook is empty, no next page - { - return FALSE; - } - - gtk_notebook_set_current_page( GTK_NOTEBOOK(widget), page ); - - return TRUE; - } - - /* win is a control: tab can be propagated up */ - if ((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab)) - { - int sel = notebook->GetSelection(); - if (sel == -1) - return TRUE; - wxGtkNotebookPage *nb_page = notebook->GetNotebookPage(sel); - wxCHECK_MSG( nb_page, FALSE, _T("invalid selection in wxNotebook") ); - - wxNavigationKeyEvent event; - event.SetEventObject( notebook ); - /* GDK reports GDK_ISO_Left_Tab for SHIFT-TAB */ - event.SetDirection( (gdk_event->keyval == GDK_Tab) ); - /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */ - event.SetWindowChange( (gdk_event->state & GDK_CONTROL_MASK) || - (gdk_event->keyval == GDK_Left) || (gdk_event->keyval == GDK_Right) ); - event.SetCurrentFocus( notebook ); - - wxNotebookPage *client = notebook->GetPage(sel); - if ( !client->GetEventHandler()->ProcessEvent( event ) ) - { - client->SetFocus(); - } - - return TRUE; - } - - return FALSE; -} -} - //----------------------------------------------------------------------------- // InsertChild callback for wxNotebook //----------------------------------------------------------------------------- @@ -296,7 +225,6 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name ) { m_needParent = true; - m_acceptsFocus = true; m_insertCallback = (wxInsertChildFunction)wxInsertChildInNotebook; if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT ) @@ -329,9 +257,6 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id, if (m_windowStyle & wxBK_BOTTOM) gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_BOTTOM ); - g_signal_connect (m_widget, "key_press_event", - G_CALLBACK (gtk_notebook_key_press_callback), this); - PostCreation(size); g_signal_connect (m_widget, "realize", @@ -402,7 +327,7 @@ int wxNotebook::DoSetSelection( size_t page, int flags ) if ( !(flags & SetSelection_SendEvent) ) { // reconnect to signals - + g_signal_connect (m_widget, "switch_page", G_CALLBACK (gtk_notebook_page_changing_callback), this); @@ -658,7 +583,7 @@ bool wxNotebook::InsertPage( size_t position, /* show the label */ gtk_widget_show( GTK_WIDGET(nb_page->m_label) ); - + if (select && (m_pagesData.GetCount() > 1)) { SetSelection( position );