18 const auto keyCode = evt.GetKeyCode();
19 if((keyCode == WXK_DOWN || keyCode == WXK_UP) &&
23 self->SetFocusFromKbd();
31 const auto keyCode = evt.GetKeyCode();
32 if(keyCode == WXK_TAB)
33 self->NavigateIn(wxNavigationKeyEvent::FromTab | (evt.ShiftDown() ? wxNavigationKeyEvent::IsBackward : wxNavigationKeyEvent::IsForward));
34 else if(keyCode == WXK_DOWN)
35 self->Navigate(wxNavigationKeyEvent::IsForward);
36 else if(keyCode == WXK_UP)
37 self->Navigate(wxNavigationKeyEvent::IsBackward);
43 wxNavigationKeyEvent& evt,
bool inTabOrder)
45 if(evt.GetEventObject() == self->GetParent() && (!evt.IsFromTab() || inTabOrder))
46 self->SetFocusFromKbd();
47 else if(evt.GetEventObject() == self && evt.GetCurrentFocus() == self && evt.IsFromTab())
50 wxPropagationDisabler disableProp(evt);
51 const auto isForward = evt.GetDirection();
52 const auto& children = self->GetChildren();
53 auto node = isForward ? children.GetFirst() : children.GetLast();
56 auto child = node->GetData();
57 if(child->CanAcceptFocusFromKeyboard())
59 if(!child->GetEventHandler()->ProcessEvent(evt))
61 child->SetFocusFromKbd();
66 node = isForward ? node->GetNext() : node->GetPrevious();
77 auto next = self->GetNextSibling();
78 if(next !=
nullptr && next->AcceptsFocus())
82 auto prev = self->GetPrevSibling();
83 if(prev !=
nullptr && prev->AcceptsFocus())
void ListNavigationEnabled_HandleNavigationKeyEvent(wxWindow *self, wxNavigationKeyEvent &evt, bool inTabOrder)
void ListNavigationEnabled_HandleDestroy(wxWindow *self)
void ListNavigationEnabled_HandleKeyDown(wxWindow *self, wxKeyEvent &evt)
void ListNavigationEnabled_HandleCharHook(wxWindow *self, wxKeyEvent &evt)
std::unique_ptr< WindowPlacement > FindFocus()
Find the window that is accepting keyboard input, if any.