void wxTabNavigatorWindow::PopulateListControl(wxFlatNotebook *book) { int selection = book->GetSelection(); //int count = book->GetPageCount(); std::map<int, bool> temp; m_listBox->Append( book->GetPageText(static_cast<int>(selection)) ); m_indexMap[0] = selection; temp[selection] = true; const wxArrayInt &arr = book->GetBrowseHistory(); for(size_t i=0; i<arr.GetCount(); i++) { if(temp.find(arr.Item(i)) == temp.end()){ m_listBox->Append( book->GetPageText(static_cast<int>(arr.Item(i))) ); m_indexMap[(int)m_listBox->GetCount()-1] = arr.Item(i); temp[arr.Item(i)] = true; } } // Select the next entry after the current selection m_listBox->SetSelection( 0 ); wxNavigationKeyEvent dummy; dummy.SetDirection(true); OnNavigationKey(dummy); }
void wxTabNavigatorWindow::PopulateListControl(wxFlatNotebook *book) { int selection = book->GetSelection(); int count = book->GetPageCount(); m_listBox->Append( book->GetPageText(static_cast<int>(selection)) ); m_indexMap[0] = selection; int itemIdx(1); int prevSel = book->GetPreviousSelection(); if( prevSel != wxNOT_FOUND ) { // Insert the previous selection as second entry m_listBox->Append( book->GetPageText(static_cast<int>(prevSel)) ); m_indexMap[1] = prevSel; itemIdx++; } for(int c=0; c<count; c++) { // Skip selected page if( c == selection ) continue; // Skip previous selected page as well if( c == prevSel ) continue; m_listBox->Append( book->GetPageText(static_cast<int>(c)) ); m_indexMap[itemIdx] = c; itemIdx++; } // Select the next entry after the current selection m_listBox->SetSelection( 0 ); wxNavigationKeyEvent dummy; dummy.SetDirection(true); OnNavigationKey(dummy); }
// ---------------------------------------------------------------------------- int BrowseSelector::PopulateListControl(EditorBase* /*pEditor*/) // ---------------------------------------------------------------------------- { wxString editorFilename; // memorize current selection int selection = m_pBrowseTracker->GetCurrentEditorIndex(); int maxCount = MaxEntries; int maxWidth = 0; int itemIdx = 0; for(int c=0; c < maxCount; c++) { editorFilename = m_pBrowseTracker->GetPageFilename(c) ; if (not editorFilename.IsEmpty()) { maxWidth = wxMax(maxWidth, (int)editorFilename.Length()); m_listBox->Append( editorFilename ); m_indexMap[itemIdx] = c; if ( selection == c ) selection = itemIdx; itemIdx++; } }//for //for(int c=0; c < maxCount; c++) // LOGIT( _T("[%d][%d][%s]"), c, m_indexMap[c], m_pBrowseTracker->GetEditorFilename(m_indexMap[c]).GetData() ); // Select the entry before/after current entry //FIXME: the key should reflect the menu cmdkeys m_listBox->SetSelection( selection ); wxKeyEvent dummy; dummy.m_keyCode = WXK_LEFT; if (m_bDirection) dummy.m_keyCode = WXK_RIGHT; OnNavigationKey(dummy); return maxWidth; }