BOOL CItemList::OnLButtonDown(UINT flags, LPPOINT point, LPRECT prect ) { DWORD i = GetItem( point, prect ); // Select items SelectItem( i, TRUE, TRUE, ( GetKeyState( VK_CONTROL ) & 0x8000 ), ( GetKeyState( VK_SHIFT ) & 0x8000 ) != 0 ); // Set scroll information if ( i < m_dwPtr && m_pIndex[ i ] != NULL && ( m_pIndex[ i ]->flags & LIF_GROUP ) != 0 ) { // Validate max scroll line DWORD slm = GetScrollLineMax( prect ); DWORD cl = GetCurLine(); if ( cl > slm ) SetCurLine( slm ); } // end if // Punt if item clicked if ( i != MAXDWORD )return TRUE; // Are we clicking a header resize area? m_phii = GetHeader().GetHeaderResizeColumn( prect, point, m_lHScroll ); if ( m_phii != NULL ) { m_phiiwidth = m_phii->width; } // end if // Save click location m_lbuttondown.x = point->x; m_lbuttondown.y = point->y; return FALSE; }
//===================>>> vedTextEditor::TextMouseDown <<<==================== void vedTextEditor::TextMouseDown(int row, int col, int button) { static int clicks = 0; int btn = (GetFileType() == gccError || GetFileType() == bccError) ? 1 : button; long oldLine = GetCurLine(); // remember current position int oldCol = getColPos(); vTextEditor::TextMouseDown(row, col, btn); // translate to left if (button == 1 && oldLine == GetCurLine() && oldCol == getColPos()) // double click... { ++clicks; if (clicks > 3) clicks = 1; setSelection(clicks); } else { clicks = 0; } }
void ctlSQLBox::OnAutoComplete(wxCommandEvent &rev) { if (GetReadOnly()) return; if (m_database == NULL) return; if (m_autocompDisabled) return; wxString what = GetCurLine().Left(GetCurrentPos() - PositionFromLine(GetCurrentLine()));; int spaceidx = what.Find(' ', true); char *tab_ret; if (spaceidx == -1) tab_ret = tab_complete(what.mb_str(wxConvUTF8), 0, what.Len() + 1, m_database); else tab_ret = tab_complete(what.mb_str(wxConvUTF8), spaceidx + 1, what.Len() + 1, m_database); if (tab_ret == NULL || tab_ret[0] == '\0') return; /* No autocomplete available for this string */ wxString wxRet = wxString(tab_ret, wxConvUTF8); free(tab_ret); // Switch to the generic list control. Native doesn't play well with // autocomplete on Mac. #ifdef __WXMAC__ wxSystemOptions::SetOption(wxT("mac.listctrl.always_use_generic"), true); #endif if (spaceidx == -1) AutoCompShow(what.Len(), wxRet); else AutoCompShow(what.Len() - spaceidx - 1, wxRet); // Now switch back #ifdef __WXMAC__ wxSystemOptions::SetOption(wxT("mac.listctrl.always_use_generic"), false); #endif }
void wxSTEditorShell::OnKeyDown(wxKeyEvent &event) { event.Skip(false); CheckReadOnly(true); switch (event.GetKeyCode()) { case WXK_UP : case WXK_NUMPAD_UP : { // you can scroll up through multiline entry int current_line = GetCurrentLine(); int prompt_line = GetPromptLine(); if ((current_line < prompt_line) || (current_line > prompt_line)) break; // up/down arrows go through the history buffer wxString promptText = GetPromptText(); SetPromptText(GetNextHistoryLine(event.GetKeyCode() == WXK_DOWN, promptText)); return; } case WXK_DOWN : case WXK_NUMPAD_DOWN : { // you can scroll down through multiline entry int total_lines = GetLineCount(); total_lines = wxMax(0, total_lines - 1); int current_line = GetCurrentLine(); if (current_line < total_lines) break; // up/down arrows go through the history buffer if ((int)GetHistoryIndex() < (int)GetHistoryCount()-1) { wxString promptText = GetPromptText(); SetPromptText(GetNextHistoryLine(event.GetKeyCode() == WXK_DOWN, promptText)); } return; } case WXK_LEFT : case WXK_NUMPAD_LEFT : { int current_line = GetCurrentLine(); int prompt_line = GetPromptLine(); if (current_line >= prompt_line) { int caret_pos = 0; GetCurLine(&caret_pos); if (caret_pos < 1) return; } break; } case WXK_PRIOR : case WXK_NUMPAD_PRIOR : //case WXK_NUMPAD_PAGEUP : case WXK_NEXT : case WXK_NUMPAD_NEXT : //case WXK_NUMPAD_PAGEDOWN : case WXK_END : case WXK_NUMPAD_END : case WXK_HOME : case WXK_NUMPAD_HOME : case WXK_RIGHT : case WXK_NUMPAD_RIGHT : case WXK_SHIFT : case WXK_CONTROL : case WXK_ALT : { // default processing for these keys event.Skip(); return; } case WXK_RETURN : case WXK_NUMPAD_ENTER : { // put cursor at end if not already on the last line if (!CaretOnPromptLine(STE_CARET_MOVE_NONE)) { GotoPos(GetLength()); return; } int current_line = GetCurrentLine(); int prompt_line = GetPromptLine(); // allow multiline entry for shift+enter if ((current_line >= prompt_line) && event.ShiftDown()) { event.Skip(); return; } wxString promptText = GetPromptText(); // goto the end of the line and store the line for the history LineEnd(); if (!promptText.IsEmpty()) AddHistoryLine(promptText, true); // just send the event, the receiver can do what they like SendEvent(wxEVT_STESHELL_ENTER, 0, GetState(), promptText); return; } case WXK_BACK : { // go to the end of the last line if not on last line if (!CaretOnPromptLine(STE_CARET_MOVE_NONE)) { GotoPos(GetLength()); return; } // don't let them backspace into previous line int caret_pos = 0; GetCurLine(&caret_pos); if (caret_pos < 1) return; break; } default : // move cursor to end if not already there { CaretOnPromptLine(STE_CARET_MOVE_ENDTEXT); break; } } event.Skip(); }