+ return wxEvtHandler::TryAfter(event);
+}
+
+// ----------------------------------------------------------------------------
+// window relationships
+// ----------------------------------------------------------------------------
+
+wxWindow *wxWindowBase::DoGetSibling(WindowOrder order) const
+{
+ wxCHECK_MSG( GetParent(), NULL,
+ wxT("GetPrev/NextSibling() don't work for TLWs!") );
+
+ wxWindowList& siblings = GetParent()->GetChildren();
+ wxWindowList::compatibility_iterator i = siblings.Find((wxWindow *)this);
+ wxCHECK_MSG( i, NULL, wxT("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
+// ----------------------------------------------------------------------------
+
+// Navigates in the specified direction inside this window
+bool wxWindowBase::DoNavigateIn(int flags)
+{
+#ifdef wxHAS_NATIVE_TAB_TRAVERSAL
+ // native code doesn't process our wxNavigationKeyEvents anyhow
+ wxUnusedVar(flags);
+ return false;
+#else // !wxHAS_NATIVE_TAB_TRAVERSAL
+ wxNavigationKeyEvent eventNav;
+ wxWindow *focused = FindFocus();
+ eventNav.SetCurrentFocus(focused);
+ eventNav.SetEventObject(focused);
+ eventNav.SetFlags(flags);
+ return GetEventHandler()->ProcessEvent(eventNav);
+#endif // wxHAS_NATIVE_TAB_TRAVERSAL/!wxHAS_NATIVE_TAB_TRAVERSAL
+}
+
+bool wxWindowBase::HandleAsNavigationKey(const wxKeyEvent& event)
+{
+ if ( event.GetKeyCode() != WXK_TAB )
+ return false;
+
+ int flags = wxNavigationKeyEvent::FromTab;
+
+ if ( event.ShiftDown() )
+ flags |= wxNavigationKeyEvent::IsBackward;
+ else
+ flags |= wxNavigationKeyEvent::IsForward;
+
+ if ( event.ControlDown() )
+ flags |= wxNavigationKeyEvent::WinChange;
+
+ Navigate(flags);
+ return true;
+}
+
+void wxWindowBase::DoMoveInTabOrder(wxWindow *win, WindowOrder move)
+{
+ // check that we're not a top level window
+ wxCHECK_RET( GetParent(),
+ wxT("MoveBefore/AfterInTabOrder() don't work for TLWs!") );
+
+ // detect the special case when we have nothing to do anyhow and when the
+ // code below wouldn't work
+ if ( win == this )
+ return;
+
+ // find the target window in the siblings list
+ wxWindowList& siblings = GetParent()->GetChildren();
+ wxWindowList::compatibility_iterator i = siblings.Find(win);
+ wxCHECK_RET( i, wxT("MoveBefore/AfterInTabOrder(): win is not a sibling") );
+
+ // unfortunately, when wxUSE_STL == 1 DetachNode() is not implemented so we
+ // can't just move the node around
+ wxWindow *self = (wxWindow *)this;
+ siblings.DeleteObject(self);
+ if ( move == OrderAfter )
+ {
+ i = i->GetNext();
+ }
+
+ if ( i )
+ {
+ siblings.Insert(i, self);
+ }
+ else // OrderAfter and win was the last sibling
+ {
+ siblings.Append(self);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// focus handling
+// ----------------------------------------------------------------------------
+
+/*static*/ wxWindow* wxWindowBase::FindFocus()
+{
+ wxWindowBase *win = DoFindFocus();
+ return win ? win->GetMainWindowOfCompositeControl() : NULL;
+}
+
+bool wxWindowBase::HasFocus() const
+{
+ wxWindowBase *win = DoFindFocus();
+ return win == this ||
+ win == wxConstCast(this, wxWindowBase)->GetMainWindowOfCompositeControl();
+}
+
+// ----------------------------------------------------------------------------
+// drag and drop
+// ----------------------------------------------------------------------------
+
+#if wxUSE_DRAG_AND_DROP && !defined(__WXMSW__)
+
+namespace
+{
+
+class DragAcceptFilesTarget : public wxFileDropTarget
+{
+public:
+ DragAcceptFilesTarget(wxWindowBase *win) : m_win(win) {}
+
+ virtual bool OnDropFiles(wxCoord x, wxCoord y,
+ const wxArrayString& filenames)
+ {
+ wxDropFilesEvent event(wxEVT_DROP_FILES,
+ filenames.size(),
+ wxCArrayString(filenames).Release());
+ event.SetEventObject(m_win);
+ event.m_pos.x = x;
+ event.m_pos.y = y;
+
+ return m_win->HandleWindowEvent(event);
+ }
+
+private:
+ wxWindowBase * const m_win;
+
+ wxDECLARE_NO_COPY_CLASS(DragAcceptFilesTarget);
+};
+
+
+} // anonymous namespace
+
+// Generic version of DragAcceptFiles(). It works by installing a simple
+// wxFileDropTarget-to-EVT_DROP_FILES adaptor and therefore cannot be used
+// together with explicit SetDropTarget() calls.
+void wxWindowBase::DragAcceptFiles(bool accept)
+{
+ if ( accept )
+ {
+ wxASSERT_MSG( !GetDropTarget(),
+ "cannot use DragAcceptFiles() and SetDropTarget() together" );
+ SetDropTarget(new DragAcceptFilesTarget(this));
+ }
+ else
+ {
+ SetDropTarget(NULL);
+ }