Navigate corrections

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27815 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2004-06-15 21:55:18 +00:00
parent 03d51a2d40
commit eedc82f4e9
8 changed files with 27 additions and 15 deletions

View File

@ -1450,16 +1450,14 @@ implements the following methods:\par
\membersection{wxWindow::Navigate}\label{wxwindownavigate} \membersection{wxWindow::Navigate}\label{wxwindownavigate}
\func{bool}{Navigate}{\param{bool}{ direction = true}, \param{bool}{ windowChange = false}} \func{bool}{Navigate}{\param{int}{ flags = wxNavigationKeyEvent::IsForward}}
Does keyboard navigation from this window to another, by sending Does keyboard navigation from this window to another, by sending
a wxNavigationKeyEvent. a wxNavigationKeyEvent.
\wxheading{Parameters} \wxheading{Parameters}
\docparam{direction}{{\tt true} to navigate forwards, {\tt false} to navigate backwards.} \docparam{flags}{A combination of wxNavigationKeyEvent::IsForward and wxNavigationKeyEvent::WinChange.}
\docparam{windowChange}{{\tt true} if the navigation is a window change.}
\wxheading{Remarks} \wxheading{Remarks}

View File

@ -490,7 +490,7 @@ public:
virtual void SetTmpDefaultItem(wxWindow * WXUNUSED(win)) { } virtual void SetTmpDefaultItem(wxWindow * WXUNUSED(win)) { }
// Navigates in the specified direction by sending a wxNavigationKeyEvent // Navigates in the specified direction by sending a wxNavigationKeyEvent
virtual bool Navigate(bool direction = true, bool windowChange = false); virtual bool Navigate(int flags = wxNavigationKeyEvent::IsForward);
// parent/children relations // parent/children relations
// ------------------------- // -------------------------

View File

@ -2405,11 +2405,10 @@ bool wxWindowBase::TryParent(wxEvent& event)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Navigates in the specified direction. // Navigates in the specified direction.
bool wxWindowBase::Navigate(bool direction, bool windowChange) bool wxWindowBase::Navigate(int flags)
{ {
wxNavigationKeyEvent eventNav; wxNavigationKeyEvent eventNav;
eventNav.SetDirection(direction); eventNav.SetFlags(flags);
eventNav.SetWindowChange(windowChange);
eventNav.SetEventObject(this); eventNav.SetEventObject(this);
if ( GetParent()->GetEventHandler()->ProcessEvent(eventNav) ) if ( GetParent()->GetEventHandler()->ProcessEvent(eventNav) )
{ {

View File

@ -1197,8 +1197,8 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
// JS: enabling again to make consistent with other platforms // JS: enabling again to make consistent with other platforms
// (with wxTE_PROCESS_TAB you have to call Navigate to get default // (with wxTE_PROCESS_TAB you have to call Navigate to get default
// navigation behaviour) // navigation behaviour)
#if 1 #if wxUSE_TEXTCTRL
!win->HasFlag(wxTE_PROCESS_TAB) && (! (win->HasFlag(wxTE_PROCESS_TAB) && IsKindOf(CLASSINFO(wxTextCtrl)) )) &&
#endif #endif
win->GetParent() && (win->GetParent()->HasFlag( wxTAB_TRAVERSAL)) ) win->GetParent() && (win->GetParent()->HasFlag( wxTAB_TRAVERSAL)) )
{ {

View File

@ -1197,8 +1197,8 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
// JS: enabling again to make consistent with other platforms // JS: enabling again to make consistent with other platforms
// (with wxTE_PROCESS_TAB you have to call Navigate to get default // (with wxTE_PROCESS_TAB you have to call Navigate to get default
// navigation behaviour) // navigation behaviour)
#if 1 #if wxUSE_TEXTCTRL
!win->HasFlag(wxTE_PROCESS_TAB) && (! (win->HasFlag(wxTE_PROCESS_TAB) && IsKindOf(CLASSINFO(wxTextCtrl)) )) &&
#endif #endif
win->GetParent() && (win->GetParent()->HasFlag( wxTAB_TRAVERSAL)) ) win->GetParent() && (win->GetParent()->HasFlag( wxTAB_TRAVERSAL)) )
{ {

View File

@ -1987,7 +1987,12 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
case WXK_TAB: case WXK_TAB:
if ( !(m_windowStyle & wxTE_PROCESS_TAB)) if ( !(m_windowStyle & wxTE_PROCESS_TAB))
{ {
Navigate(!event.ShiftDown(), event.ControlDown()); int flags = 0;
if (!event.ShiftDown())
flags |= wxNavigationKeyEvent::IsForward ;
if (event.ControlDown())
flags |= wxNavigationKeyEvent::WinChange ;
Navigate(flags);
return; return;
} }
else else

View File

@ -1651,7 +1651,12 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
case WXK_TAB: case WXK_TAB:
if ( !(m_windowStyle & wxTE_PROCESS_TAB)) if ( !(m_windowStyle & wxTE_PROCESS_TAB))
{ {
Navigate(!event.ShiftDown(), event.ControlDown()); int flags = 0;
if (!event.ShiftDown())
flags |= wxNavigationKeyEvent::IsForward ;
if (event.ControlDown())
flags |= wxNavigationKeyEvent::WinChange ;
Navigate(flags);
return; return;
} }
else else

View File

@ -1707,7 +1707,12 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
{ {
if ( FindFocus() == this ) if ( FindFocus() == this )
{ {
if (Navigate(!event.ShiftDown(), event.ControlDown())) int flags = 0;
if (!event.ShiftDown())
flags |= wxNavigationKeyEvent::IsForward ;
if (event.ControlDown())
flags |= wxNavigationKeyEvent::WinChange ;
if (Navigate(flags))
return; return;
} }
} }