added wxWindow::GetPrev/NextSibling()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50108 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-11-20 15:57:51 +00:00
parent e4346967a2
commit c944775f72
4 changed files with 76 additions and 10 deletions

View File

@@ -2635,6 +2635,27 @@ bool wxWindowBase::TryParent(wxEvent& event)
return wxEvtHandler::TryParent(event);
}
// ----------------------------------------------------------------------------
// window relationships
// ----------------------------------------------------------------------------
wxWindow *wxWindowBase::DoGetSibling(WindowOrder order) const
{
wxCHECK_MSG( GetParent(), NULL,
_T("GetPrev/NextSibling() don't work for TLWs!") );
wxWindowList& siblings = GetParent()->GetChildren();
wxWindowList::compatibility_iterator i = siblings.Find(this);
wxCHECK_MSG( i, NULL, _T("window not a child of its parent?") );
if ( order == OrderBefore )
i = i->GetPrevious();
else // OrderAfter
i = i->GetNext();
return i ? i->GetData() : NULL;
}
// ----------------------------------------------------------------------------
// keyboard navigation
// ----------------------------------------------------------------------------
@@ -2654,7 +2675,7 @@ bool wxWindowBase::DoNavigateIn(int flags)
#endif // wxHAS_NATIVE_TAB_TRAVERSAL/!wxHAS_NATIVE_TAB_TRAVERSAL
}
void wxWindowBase::DoMoveInTabOrder(wxWindow *win, MoveKind move)
void wxWindowBase::DoMoveInTabOrder(wxWindow *win, WindowOrder move)
{
// check that we're not a top level window
wxCHECK_RET( GetParent(),
@@ -2674,7 +2695,7 @@ void wxWindowBase::DoMoveInTabOrder(wxWindow *win, MoveKind move)
// can't just move the node around
wxWindow *self = (wxWindow *)this;
siblings.DeleteObject(self);
if ( move == MoveAfter )
if ( move == OrderAfter )
{
i = i->GetNext();
}
@@ -2683,7 +2704,7 @@ void wxWindowBase::DoMoveInTabOrder(wxWindow *win, MoveKind move)
{
siblings.Insert(i, self);
}
else // MoveAfter and win was the last sibling
else // OrderAfter and win was the last sibling
{
siblings.Append(self);
}