-
-
-
-
- // win is a control: tab can be propagated up
- if ( !ret &&
- ((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab)) &&
-// VZ: testing for wxTE_PROCESS_TAB shouldn't be done here - the control may
-// have this style, yet choose not to process this particular TAB in which
-// case TAB must still work as a navigational character
-// JS: enabling again to make consistent with other platforms
-// (with wxTE_PROCESS_TAB you have to call Navigate to get default
-// navigation behaviour)
-#if wxUSE_TEXTCTRL
- (! (win->HasFlag(wxTE_PROCESS_TAB) && win->IsKindOf(CLASSINFO(wxTextCtrl)) )) &&
-#endif
- win->GetParent() && (win->GetParent()->HasFlag( wxTAB_TRAVERSAL)) )
- {
- wxNavigationKeyEvent new_event;
- new_event.SetEventObject( win->GetParent() );
- // GDK reports GDK_ISO_Left_Tab for SHIFT-TAB
- new_event.SetDirection( (gdk_event->keyval == GDK_Tab) );
- // CTRL-TAB changes the (parent) window, i.e. switch notebook page
- new_event.SetWindowChange( (gdk_event->state & GDK_CONTROL_MASK) );
- new_event.SetCurrentFocus( win );
- ret = win->GetParent()->GetEventHandler()->ProcessEvent( new_event );
- }
-
- // generate wxID_CANCEL if <esc> has been pressed (typically in dialogs)
- if ( !ret &&
- (gdk_event->keyval == GDK_Escape) )
- {
- // however only do it if we have a Cancel button in the dialog,
- // otherwise the user code may get confused by the events from a
- // non-existing button and, worse, a wxButton might get button event
- // from another button which is not really expected
- wxWindow *winForCancel = win,
- *btnCancel = NULL;
- while ( winForCancel )
- {
- btnCancel = winForCancel->FindWindow(wxID_CANCEL);
- if ( btnCancel )
- {
- // found a cancel button
- break;
- }
-
- if ( winForCancel->IsTopLevel() )
- {
- // no need to look further
- break;
- }
-
- // maybe our parent has a cancel button?
- winForCancel = winForCancel->GetParent();
- }
-
- if ( btnCancel )
- {
- wxCommandEvent eventClick(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
- eventClick.SetEventObject(btnCancel);
- ret = btnCancel->GetEventHandler()->ProcessEvent(eventClick);
- }
- }
-
- if (ret)
- {
- g_signal_stop_emission_by_name (widget, "key_press_event");
- return TRUE;
- }
-
- return FALSE;