void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event) { if (event.IsWindowChange()) AdvanceSelection( event.GetDirection() ); else event.Skip(); }
void ClearFilter() { if(m_filterSet) { m_filterSet = false; AdvanceSelection(0); } }
void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event) { if ( event.IsWindowChange() ) { // change pages AdvanceSelection( event.GetDirection() ); } else { // we get this event in 2 cases // // a) one of our pages might have generated it because the user TABbed // out from it in which case we should propagate the event upwards and // our parent will take care of setting the focus to prev/next sibling // // or // // b) the parent panel wants to give the focus to us so that we // forward it to our selected page. We can't deal with this in // OnSetFocus() because we don't know which direction the focus came // from in this case and so can't choose between setting the focus to // first or last panel child wxWindow *parent = GetParent(); // the cast is here to fix a GCC ICE if ( ((wxWindow*)event.GetEventObject()) == parent ) { // no, it doesn't come from child, case (b): forward to a page if ( m_selection != wxNOT_FOUND ) { // so that the page knows that the event comes from it's parent // and is being propagated downwards event.SetEventObject( this ); wxWindow *page = m_pages[m_selection]; if ( !page->HandleWindowEvent( event ) ) { page->SetFocus(); } //else: page manages focus inside it itself } else { // we have no pages - still have to give focus to _something_ SetFocus(); } } else { // it comes from our child, case (a), pass to the parent if ( parent ) { event.SetCurrentFocus( this ); parent->HandleWindowEvent( event ); } } } }
void OnMapsAdded(Vector<MapIndex*> maps) { for(auto m : maps) { m_maps.Add(m->id, m); } if(!m_currentSelection) AdvanceSelection(0); }
void cbAuiNotebook::OnNavigationKey(wxNavigationKeyEvent& event) #endif { // if we change window, we call our own AdvanceSelection if ( event.IsWindowChange() ) AdvanceSelection(event.GetDirection()); else // otherwise we call the event-handler from the parent-class { #if wxCHECK_VERSION(3, 0, 0) wxAuiNotebook::OnNavigationKeyNotebook(event); #else wxAuiNotebook::OnNavigationKey(event); #endif } }
void OnMapsCleared(Map<int32, MapIndex*> newList) { m_currentSelection.Release(); for(auto g : m_guiElements) { Remove(g.second.As<GUIElementBase>()); } m_guiElements.clear(); m_filterSet = false; m_mapFilter.clear(); m_maps.clear(); m_maps = newList; if(m_maps.size() > 0) { AdvanceSelection(0); } }
void wxFlatNotebook::OnNavigationKey(wxNavigationKeyEvent& event) { if ( event.IsWindowChange() ) { if( HasFlag(wxFNB_SMART_TABS) ) { if( !m_popupWin && GetPageCount() > 0) { m_popupWin = new wxTabNavigatorWindow( this ); m_popupWin->ShowModal(); m_popupWin->Destroy(); SetSelection((size_t)GetSelection()); m_popupWin = NULL; } else if( m_popupWin ) { // a dialog is already opened m_popupWin->OnNavigationKey( event ); return; } } else { // change pages AdvanceSelection(event.GetDirection()); } } else { // pass to the parent if ( GetParent() ) { event.SetCurrentFocus(this); #if wxCHECK_VERSION(2, 9, 0) GetParent()->GetEventHandler()->ProcessEvent(event); #else GetParent()->ProcessEvent(event); #endif } } }
void OnMapsRemoved(Vector<MapIndex*> maps) { for(auto m : maps) { m_maps.erase(m->id); auto it = m_guiElements.find(m); if(it != m_guiElements.end()) { // Clear selection if a removed item was selected if(m_currentSelection == it->second) m_currentSelection.Release(); // Remove this item from the canvas that displays the items Remove(it->second.As<GUIElementBase>()); m_guiElements.erase(it); } } if(!m_maps.Contains(m_currentlySelectedId)) { AdvanceSelection(1); } }
// Set display filter void SetFilter(Map<int32, MapIndex *> filter) { m_mapFilter = filter; m_filterSet = true; AdvanceSelection(0); }
void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event) { if ( event.IsWindowChange() ) { // change pages AdvanceSelection(event.GetDirection()); } else { // we get this event in 3 cases // // a) one of our pages might have generated it because the user TABbed // out from it in which case we should propagate the event upwards and // our parent will take care of setting the focus to prev/next sibling // // or // // b) the parent panel wants to give the focus to us so that we // forward it to our selected page. We can't deal with this in // OnSetFocus() because we don't know which direction the focus came // from in this case and so can't choose between setting the focus to // first or last panel child // // or // // c) we ourselves (see MSWTranslateMessage) generated the event // wxWindow * const parent = GetParent(); // the wxObject* casts are required to avoid MinGW GCC 2.95.3 ICE const bool isFromParent = event.GetEventObject() == (wxObject*) parent; const bool isFromSelf = event.GetEventObject() == (wxObject*) this; const bool isForward = event.GetDirection(); if ( isFromSelf && !isForward ) { // focus is currently on notebook tab and should leave // it backwards (Shift-TAB) event.SetCurrentFocus(this); parent->HandleWindowEvent(event); } else if ( isFromParent || isFromSelf ) { // no, it doesn't come from child, case (b) or (c): forward to a // page but only if entering notebook page (i.e. direction is // backwards (Shift-TAB) comething from out-of-notebook, or // direction is forward (TAB) from ourselves), if ( m_selection != wxNOT_FOUND && (!event.GetDirection() || isFromSelf) ) { // so that the page knows that the event comes from it's parent // and is being propagated downwards event.SetEventObject(this); wxWindow *page = m_pages[m_selection]; if ( !page->HandleWindowEvent(event) ) { page->SetFocus(); } //else: page manages focus inside it itself } else // otherwise set the focus to the notebook itself { SetFocus(); } } else { // it comes from our child, case (a), pass to the parent, but only // if the direction is forwards. Otherwise set the focus to the // notebook itself. The notebook is always the 'first' control of a // page. if ( !isForward ) { SetFocus(); } else if ( parent ) { event.SetCurrentFocus(this); parent->HandleWindowEvent(event); } } } }
void wxNotebook::OnNavigationKey ( wxNavigationKeyEvent& rEvent ) { if (rEvent.IsWindowChange()) { // // Change pages // AdvanceSelection(rEvent.GetDirection()); } else { // // We get this event in 2 cases // // a) one of our pages might have generated it because the user TABbed // out from it in which case we should propagate the event upwards and // our parent will take care of setting the focus to prev/next sibling // // or // // b) the parent panel wants to give the focus to us so that we // forward it to our selected page. We can't deal with this in // OnSetFocus() because we don't know which direction the focus came // from in this case and so can't choose between setting the focus to // first or last panel child // wxWindow* pParent = GetParent(); if (rEvent.GetEventObject() == pParent) { // // No, it doesn't come from child, case (b): forward to a page // if (m_nSelection != -1) { // // So that the page knows that the event comes from it's parent // and is being propagated downwards // rEvent.SetEventObject(this); wxWindow* pPage = m_pages[m_nSelection]; if (!pPage->GetEventHandler()->ProcessEvent(rEvent)) { pPage->SetFocus(); } //else: page manages focus inside it itself } else { // // We have no pages - still have to give focus to _something_ // SetFocus(); } } else { // // It comes from our child, case (a), pass to the parent // if (pParent) { rEvent.SetCurrentFocus(this); pParent->GetEventHandler()->ProcessEvent(rEvent); } } } } // end of wxNotebook::OnNavigationKey