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:
@@ -272,6 +272,14 @@ wxX11:
|
|||||||
- Make Enter key activate the default button (David Hart).
|
- Make Enter key activate the default button (David Hart).
|
||||||
|
|
||||||
|
|
||||||
|
2.8.8
|
||||||
|
-----
|
||||||
|
|
||||||
|
All (GUI):
|
||||||
|
|
||||||
|
- Added wxWindow::GetNextSibling() and GetPrevSibling()
|
||||||
|
|
||||||
|
|
||||||
2.8.7
|
2.8.7
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
@@ -1197,6 +1197,20 @@ name in the window constructor or via \helpref{wxWindow::SetName}{wxwindowsetnam
|
|||||||
\helpref{wxWindow::SetName}{wxwindowsetname}
|
\helpref{wxWindow::SetName}{wxwindowsetname}
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxWindow::GetNextSibling}\label{wxwindowgetnextsibling}
|
||||||
|
|
||||||
|
\constfunc{wxWindow *}{GetNextSibling}{\void}
|
||||||
|
|
||||||
|
Returns the next window after this one among the parent children or \NULL if
|
||||||
|
this window is the last child.
|
||||||
|
|
||||||
|
\newsince{2.8.8}
|
||||||
|
|
||||||
|
\wxheading{See also}
|
||||||
|
|
||||||
|
\helpref{GetPrevSibling}{wxwindowgetprevsibling}
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxWindow::GetParent}\label{wxwindowgetparent}
|
\membersection{wxWindow::GetParent}\label{wxwindowgetparent}
|
||||||
|
|
||||||
\constfunc{virtual wxWindow*}{GetParent}{\void}
|
\constfunc{virtual wxWindow*}{GetParent}{\void}
|
||||||
@@ -1270,6 +1284,20 @@ method:\par
|
|||||||
\helpref{GetScreenPosition}{wxwindowgetscreenposition}
|
\helpref{GetScreenPosition}{wxwindowgetscreenposition}
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxWindow::GetPrevSibling}\label{wxwindowgetprevsibling}
|
||||||
|
|
||||||
|
\constfunc{wxWindow *}{GetPrevSibling}{\void}
|
||||||
|
|
||||||
|
Returns the previous window before this one among the parent children or \NULL if
|
||||||
|
this window is the first child.
|
||||||
|
|
||||||
|
\newsince{2.8.8}
|
||||||
|
|
||||||
|
\wxheading{See also}
|
||||||
|
|
||||||
|
\helpref{GetNextSibling}{wxwindowgetnextsibling}
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxWindow::GetRect}\label{wxwindowgetrect}
|
\membersection{wxWindow::GetRect}\label{wxwindowgetrect}
|
||||||
|
|
||||||
\constfunc{virtual wxRect}{GetRect}{\void}
|
\constfunc{virtual wxRect}{GetRect}{\void}
|
||||||
|
@@ -631,9 +631,9 @@ public:
|
|||||||
// move this window just before/after the specified one in tab order
|
// move this window just before/after the specified one in tab order
|
||||||
// (the other window must be our sibling!)
|
// (the other window must be our sibling!)
|
||||||
void MoveBeforeInTabOrder(wxWindow *win)
|
void MoveBeforeInTabOrder(wxWindow *win)
|
||||||
{ DoMoveInTabOrder(win, MoveBefore); }
|
{ DoMoveInTabOrder(win, OrderBefore); }
|
||||||
void MoveAfterInTabOrder(wxWindow *win)
|
void MoveAfterInTabOrder(wxWindow *win)
|
||||||
{ DoMoveInTabOrder(win, MoveAfter); }
|
{ DoMoveInTabOrder(win, OrderAfter); }
|
||||||
|
|
||||||
|
|
||||||
// parent/children relations
|
// parent/children relations
|
||||||
@@ -646,6 +646,11 @@ public:
|
|||||||
// needed just for extended runtime
|
// needed just for extended runtime
|
||||||
const wxWindowList& GetWindowChildren() const { return GetChildren() ; }
|
const wxWindowList& GetWindowChildren() const { return GetChildren() ; }
|
||||||
|
|
||||||
|
// get the window before/after this one in the parents children list,
|
||||||
|
// returns NULL if this is the first/last window
|
||||||
|
wxWindow *GetPrevSibling() const { return DoGetSibling(OrderBefore); }
|
||||||
|
wxWindow *GetNextSibling() const { return DoGetSibling(OrderAfter); }
|
||||||
|
|
||||||
// get the parent or the parent of the parent
|
// get the parent or the parent of the parent
|
||||||
wxWindow *GetParent() const { return m_parent; }
|
wxWindow *GetParent() const { return m_parent; }
|
||||||
inline wxWindow *GetGrandParent() const;
|
inline wxWindow *GetGrandParent() const;
|
||||||
@@ -1257,13 +1262,17 @@ protected:
|
|||||||
virtual bool TryValidator(wxEvent& event);
|
virtual bool TryValidator(wxEvent& event);
|
||||||
virtual bool TryParent(wxEvent& event);
|
virtual bool TryParent(wxEvent& event);
|
||||||
|
|
||||||
// common part of MoveBefore/AfterInTabOrder()
|
enum WindowOrder
|
||||||
enum MoveKind
|
|
||||||
{
|
{
|
||||||
MoveBefore, // insert before the given window
|
OrderBefore, // insert before the given window
|
||||||
MoveAfter // insert after the given window
|
OrderAfter // insert after the given window
|
||||||
};
|
};
|
||||||
virtual void DoMoveInTabOrder(wxWindow *win, MoveKind move);
|
|
||||||
|
// common part of GetPrev/NextSibling()
|
||||||
|
wxWindow *DoGetSibling(WindowOrder order) const;
|
||||||
|
|
||||||
|
// common part of MoveBefore/AfterInTabOrder()
|
||||||
|
virtual void DoMoveInTabOrder(wxWindow *win, WindowOrder move);
|
||||||
|
|
||||||
// implementation of Navigate() and NavigateIn()
|
// implementation of Navigate() and NavigateIn()
|
||||||
virtual bool DoNavigateIn(int flags);
|
virtual bool DoNavigateIn(int flags);
|
||||||
|
@@ -2635,6 +2635,27 @@ bool wxWindowBase::TryParent(wxEvent& event)
|
|||||||
return wxEvtHandler::TryParent(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
|
// keyboard navigation
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -2654,7 +2675,7 @@ bool wxWindowBase::DoNavigateIn(int flags)
|
|||||||
#endif // wxHAS_NATIVE_TAB_TRAVERSAL/!wxHAS_NATIVE_TAB_TRAVERSAL
|
#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
|
// check that we're not a top level window
|
||||||
wxCHECK_RET( GetParent(),
|
wxCHECK_RET( GetParent(),
|
||||||
@@ -2674,7 +2695,7 @@ void wxWindowBase::DoMoveInTabOrder(wxWindow *win, MoveKind move)
|
|||||||
// can't just move the node around
|
// can't just move the node around
|
||||||
wxWindow *self = (wxWindow *)this;
|
wxWindow *self = (wxWindow *)this;
|
||||||
siblings.DeleteObject(self);
|
siblings.DeleteObject(self);
|
||||||
if ( move == MoveAfter )
|
if ( move == OrderAfter )
|
||||||
{
|
{
|
||||||
i = i->GetNext();
|
i = i->GetNext();
|
||||||
}
|
}
|
||||||
@@ -2683,7 +2704,7 @@ void wxWindowBase::DoMoveInTabOrder(wxWindow *win, MoveKind move)
|
|||||||
{
|
{
|
||||||
siblings.Insert(i, self);
|
siblings.Insert(i, self);
|
||||||
}
|
}
|
||||||
else // MoveAfter and win was the last sibling
|
else // OrderAfter and win was the last sibling
|
||||||
{
|
{
|
||||||
siblings.Append(self);
|
siblings.Append(self);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user