added wxWindow::GetPrev/NextSibling() [backport of r50108 from trunk]

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@50111 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-11-20 16:12:12 +00:00
parent 20d78b39b2
commit cf22e46119
5 changed files with 88 additions and 10 deletions

View File

@@ -129,17 +129,17 @@ wxMac:
- Fixed 'Reopen' application behaviour (a window was not always shown when reopening the app).
2.8.6
2.8.8
-----
All:
- Fixed another bug in wxFileConfig when deleting entries (Axel Gembe)
- Added Portuguese translation (Antonio Cardoso Martins)
All (GUI):
- Added wxWindow::GetNextSibling() and GetPrevSibling()
2.8.7
-----
- Added an optimization to UI updates on idle, by only updating when the window
is shown.
- Multiple centre panes in wxAUI can now be resized.
@@ -164,6 +164,16 @@ wxMac:
- Fixed a crash in wxToolBar when adding tools with non-standard sizes.
2.8.6
-----
All:
- Fixed another bug in wxFileConfig when deleting entries (Axel Gembe)
- Added Portuguese translation (Antonio Cardoso Martins)
2.8.5
-----

View File

@@ -1120,6 +1120,20 @@ name in the window constructor or via \helpref{wxWindow::SetName}{wxwindowsetnam
\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}
\constfunc{virtual wxWindow*}{GetParent}{\void}
@@ -1166,6 +1180,20 @@ method:\par
\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}
\constfunc{virtual wxRect}{GetRect}{\void}

View File

@@ -573,6 +573,13 @@ public:
// needed just for extended runtime
const wxWindowList& GetWindowChildren() const { return GetChildren() ; }
#if wxABI_VERSION >= 20808
// 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(MoveBefore); }
wxWindow *GetNextSibling() const { return DoGetSibling(MoveAfter); }
#endif // wx 2.8.8+
// get the parent or the parent of the parent
wxWindow *GetParent() const { return m_parent; }
inline wxWindow *GetGrandParent() const;
@@ -1141,12 +1148,18 @@ protected:
virtual bool TryValidator(wxEvent& event);
virtual bool TryParent(wxEvent& event);
// common part of MoveBefore/AfterInTabOrder()
enum MoveKind
{
MoveBefore, // insert before the given window
MoveAfter // insert after the given window
};
#if wxABI_VERSION >= 20808
// common part of GetPrev/NextSibling()
wxWindow *DoGetSibling(MoveKind order) const;
#endif // wx 2.8.8+
// common part of MoveBefore/AfterInTabOrder()
virtual void DoMoveInTabOrder(wxWindow *win, MoveKind move);
#if wxUSE_CONSTRAINTS

View File

@@ -2617,6 +2617,27 @@ bool wxWindowBase::TryParent(wxEvent& event)
return wxEvtHandler::TryParent(event);
}
// ----------------------------------------------------------------------------
// window relationships
// ----------------------------------------------------------------------------
wxWindow *wxWindowBase::DoGetSibling(MoveKind 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 == MoveBefore )
i = i->GetPrevious();
else // MoveAfter
i = i->GetNext();
return i ? i->GetData() : NULL;
}
// ----------------------------------------------------------------------------
// keyboard navigation
// ----------------------------------------------------------------------------

View File

@@ -24,11 +24,17 @@
# and once released its version cannot be changed.
# public symbols added in 2.8.8 (please keep in alphabetical order):
@WX_VERSION_TAG@.8 {
global:
*wxWindowBase*Get*Sibling*;
};
# public symbols added in 2.8.7 (please keep in alphabetical order):
@WX_VERSION_TAG@.7 {
global:
*wxStaticBox*AcceptsFocus*;
*wxAuiPaneInfo*DockFixed*;
*wxStaticBox*AcceptsFocus*;
*wxAuiPaneInfo*DockFixed*;
};
# public symbols added in 2.8.5 (please keep in alphabetical order):