#include "wx/log.h"
#include "wx/event.h"
#include "wx/window.h"
-#endif //WX_PRECOMP
-
-#include "wx/containr.h"
-
-#ifdef __WXMAC__
#include "wx/scrolbar.h"
-#endif
-
-#ifdef __WXMSW__
#include "wx/radiobut.h"
-#endif
+ #include "wx/containr.h"
+#endif //WX_PRECOMP
// trace mask for focus messages
#define TRACE_FOCUS _T("focus")
}
// where are we going?
- bool forward = event.GetDirection();
+ const bool forward = event.GetDirection();
// the node of the children list from which we should start looking for the
// next acceptable child
// start from first or last depending on where we're going
node = forward ? children.GetFirst() : children.GetLast();
-
- // we want to cycle over all nodes
- start_node = wxWindowList::compatibility_iterator();
}
- else
+ else // going up
{
// try to find the child which has the focus currently
// ok, we found the focus - now is it our child?
start_node = children.Find( winFocus );
}
- else
- {
- start_node = wxWindowList::compatibility_iterator();
- }
if ( !start_node && m_winLastFocused )
{
}
// we want to cycle over all elements passing by NULL
- while ( node != start_node )
+ for ( ;; )
{
+ // don't go into infinite loop
+ if ( start_node && node && node == start_node )
+ break;
+
// Have we come to the last or first item on the panel?
if ( !node )
{
+ if ( !start_node )
+ {
+ // exit now as otherwise we'd loop forever
+ break;
+ }
+
if ( !goingDown )
{
- // Check if our (may be grand) parent is another panel: if this
+ // Check if our (maybe grand) parent is another panel: if this
// is the case, they will know what to do with this navigation
// key and so give them the chance to process it instead of
// looping inside this panel (normally, the focus will go to
return false;
}
-