本文整理汇总了C++中wxStyledTextEvent::GetKey方法的典型用法代码示例。如果您正苦于以下问题:C++ wxStyledTextEvent::GetKey方法的具体用法?C++ wxStyledTextEvent::GetKey怎么用?C++ wxStyledTextEvent::GetKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxStyledTextEvent
的用法示例。
在下文中一共展示了wxStyledTextEvent::GetKey方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onCharAdded
/* TextEditor::onCharAdded
* Called when a character is added to the text
*******************************************************************/
void TextEditor::onCharAdded(wxStyledTextEvent& e)
{
// Update line numbers margin width
string numlines = S_FMT("0%d", GetNumberOfLines());
SetMarginWidth(0, TextWidth(wxSTC_STYLE_LINENUMBER, numlines));
// Auto indent
int currentLine = GetCurrentLine();
if (txed_auto_indent && e.GetKey() == '\n')
{
// Get indentation amount
int lineInd = 0;
if (currentLine > 0)
lineInd = GetLineIndentation(currentLine - 1);
// Do auto-indent if needed
if (lineInd != 0)
{
SetLineIndentation(currentLine, lineInd);
// Skip to end of tabs
while (1)
{
int chr = GetCharAt(GetCurrentPos());
if (chr == '\t' || chr == ' ')
GotoPos(GetCurrentPos()+1);
else
break;
}
}
}
// The following require a language to work
if (language)
{
// Call tip
if (e.GetKey() == '(' && txed_calltips_parenthesis)
{
openCalltip(GetCurrentPos());
}
// End call tip
if (e.GetKey() == ')')
{
CallTipCancel();
}
// Comma, possibly update calltip
if (e.GetKey() == ',' && txed_calltips_parenthesis)
{
//openCalltip(GetCurrentPos());
//if (CallTipActive())
updateCalltip();
}
}
// Continue
e.Skip();
}
示例2: OnCharacterAdded
void FileEditorWnd::OnCharacterAdded(wxStyledTextEvent& event)
{
char chr = (char)event.GetKey();
int currentLine = m_textCtrl->GetCurrentLine();
if (chr== '\n')
{
int lineInd = 0;
if (currentLine>0)
lineInd = m_textCtrl->GetLineIndentation(currentLine-1);
if (lineInd==0)
return;
m_textCtrl->SetLineIndentation(currentLine, lineInd);
m_textCtrl->LineEnd();
return;
}
char previousChr = m_textCtrl->GetCharAt(m_textCtrl->GetCurrentPos() - 2 );
if (chr == '.' || (chr == '>' && previousChr == '-'))
showAutoComplete();
else if (chr == '(')
showCallTip(true);
else if (chr == ')')
{
if (m_textCtrl->CallTipActive())
m_textCtrl->CallTipCancel();
}
else if (m_textCtrl->CallTipActive())
showCallTip(false);
}
示例3: OnCharAdded
void CodeEdit::OnCharAdded(wxStyledTextEvent& event)
{
// Indent the line to the same indentation as the previous line.
// Adapted from http://STCntilla.sourceforge.net/STCntillaUsage.html
char ch = event.GetKey();
if (ch == '\r' || ch == '\n')
{
int line = GetCurrentLine();
int lineLength = LineLength(line);
if (line > 0 && lineLength <= 2)
{
wxString buffer = GetLine(line - 1);
for (unsigned int i = 0; i < buffer.Length(); ++i)
{
if (buffer[i] != ' ' && buffer[i] != '\t')
{
buffer.Truncate(i);
break;
}
}
ReplaceSelection(buffer);
// Remember that we just auto-indented so that the backspace
// key will un-autoindent us.
m_autoIndented = true;
}
}
else if (m_enableAutoComplete && m_autoCompleteManager != NULL)
{
// Handle auto completion.
wxString token;
if (GetTokenFromPosition(GetCurrentPos() - 1, ".:", token))
{
StartAutoCompletion(token);
}
}
event.Skip();
}
示例4: OnCharAdded
void Edit::OnCharAdded (wxStyledTextEvent &event) {
char chr = (char)event.GetKey();
int currentLine = GetCurrentLine();
// Change this if support for mac files with \r is needed
if (chr == '\n') {
int lineInd = 0;
if (currentLine > 0) {
lineInd = GetLineIndentation(currentLine - 1);
}
if (lineInd == 0) return;
SetLineIndentation (currentLine, lineInd);
GotoPos(PositionFromLine (currentLine) + lineInd);
}
}
示例5: OnCharAdded
void SvnConsole::OnCharAdded(wxStyledTextEvent& event)
{
if(event.GetKey() == '\n') {
// an enter was inserted
// take the last inserted line and send it to the m_process
wxString line = m_sci->GetTextRange(m_inferiorEnd, m_sci->GetLength());
line.Trim();
if(m_process) {
m_process->Write(line);
}
}
event.Skip();
}
示例6: OnCharAdded
void Edit::OnCharAdded(wxStyledTextEvent &event) {
event.Skip();
const wxChar c = event.GetKey();
if (c == wxT('\n')) {
const int line = GetCurrentLine();
const int indent = line < 1 ? 0 : GetLineIndentation(line - 1);
if (indent != 0) {
SetLineIndentation(line, indent);
GotoPos(GetLineIndentPosition(line));
}
}
}
示例7: OnCharAdded
void IWnd_stc::OnCharAdded (wxStyledTextEvent &evt)
{
char chr = (char)evt.GetKey();
if (chr == '\n')
{
int currentLine = GetCurrentLine();
if (currentLine < 1) return;
int lineInd = GetLineIndentation(currentLine - 1);
if (lineInd == 0) return;
SetLineIndentation (currentLine, lineInd);
GotoPos(GetLineIndentPosition(currentLine));
}
}
示例8:
void rc_ide2Frame::OnDocumentKey(wxStyledTextEvent& event)
{
wxStyledTextCtrl * t = (wxStyledTextCtrl*)AuiNotebook1->GetPage(AuiNotebook1->GetSelection());
char chr = event.GetKey();
int currentLine = t->GetCurrentLine();
int indent = 0;
if(chr == '\n')
{
//wxMessageBox(_("Current Line = ") + wxString::Format("%i",currentLine));
if(currentLine > 0)
{
indent = t->GetLineIndentation(currentLine-1);
}
if(indent == 0)
return;
//wxMessageBox(_("Position from line = ") + wxString::Format("%i",t->PositionFromLine(currentLine)));
t->SetLineIndentation(currentLine, indent);
t->GotoPos(t->GetLineIndentPosition(currentLine));
}
}
示例9: OnStcKey
void MyStyledText::OnStcKey(wxStyledTextEvent& event)
{
wxMessageBox("Onstyleddddddddddddddddddddddddd");
printf("key:%d\n", event.GetKey());
event.Skip();
}