void wxCodeCompletionBox::DoScrollUp() { if(CanScrollUp()) { --m_index; DoDisplayTipWindow(); Refresh(); } }
void wxCodeCompletionBox::DoPgDown() { int newindex = m_index + (LINES_PER_PAGE - 1); if(newindex >= (int)m_entries.size()) { newindex = (int)m_entries.size() - 1; } // only refresh if there was an actual change if(m_index != newindex) { m_index = newindex; DoDisplayTipWindow(); Refresh(); } }
void wxCodeCompletionBox::DoPgUp() { int newindex = m_index - (LINES_PER_PAGE - 1); if(newindex < 0) { newindex = 0; } // only refresh if there was an actual change if(m_index != newindex) { m_index = newindex; DoDisplayTipWindow(); Refresh(); } }
void wxCodeCompletionBox::DoUpdateList() { bool refreshList = FilterResults(); int curpos = m_stc->GetCurrentPos(); if(m_entries.empty() || curpos < m_startPos || refreshList) { if((m_entries.empty() || refreshList) && (m_flags & kRefreshOnKeyType)) { // Trigger a new CC box wxCommandEvent event(wxEVT_MENU, XRCID("complete_word")); wxTheApp->GetTopWindow()->GetEventHandler()->AddPendingEvent(event); } DoDestroy(); } else { DoDisplayTipWindow(); Refresh(); } }
void wxCodeCompletionBox::ShowCompletionBox(wxStyledTextCtrl* ctrl, const wxCodeCompletionBoxEntry::Vec_t& entries) { m_index = 0; m_stc = ctrl; m_allEntries = entries; // Keep the start position if(m_startPos == wxNOT_FOUND) { m_startPos = m_stc->WordStartPosition(m_stc->GetCurrentPos(), true); } // Filter all duplicate entries from the list (based on simple string match) RemoveDuplicateEntries(); // Filter results based on user input FilterResults(); // If we got a single match - insert it if((m_entries.size() == 1) && (m_flags & kInsertSingleMatch)) { // single match InsertSelection(); DoDestroy(); return; } if(m_entries.empty()) { // no entries to display DoDestroy(); return; } DoShowCompletionBox(); if(m_stc) { // Set the focus back to the completion control m_stc->CallAfter(&wxStyledTextCtrl::SetFocus); } // Display the help window DoDisplayTipWindow(); }
void wxCodeCompletionBox::StcKeyDown(wxKeyEvent& event) { switch(event.GetKeyCode()) { case WXK_UP: DoScrollUp(); break; case WXK_DOWN: DoScrollDown(); break; case WXK_PAGEDOWN: { int newindex = m_index + (LINES_PER_PAGE - 1); if(newindex >= (int)m_entries.size()) { newindex = (int)m_entries.size() - 1; } // only refresh if there was an actual change if(m_index != newindex) { m_index = newindex; DoDisplayTipWindow(); Refresh(); } break; } case WXK_PAGEUP: { int newindex = m_index - (LINES_PER_PAGE - 1); if(newindex < 0) { newindex = 0; } // only refresh if there was an actual change if(m_index != newindex) { m_index = newindex; DoDisplayTipWindow(); Refresh(); } break; } case WXK_ESCAPE: case WXK_LEFT: case WXK_RIGHT: case WXK_HOME: case WXK_END: case WXK_DELETE: case WXK_NUMPAD_DELETE: case WXK_ALT: case WXK_WINDOWS_LEFT: case WXK_WINDOWS_RIGHT: case WXK_CONTROL: DoDestroy(); event.Skip(); break; case WXK_TAB: case WXK_RETURN: case WXK_NUMPAD_ENTER: // Insert the selection InsertSelection(); DoDestroy(); break; default: event.Skip(); break; } }