当前位置: 首页>>代码示例>>C++>>正文


C++ wxStyledTextEvent::GetKey方法代码示例

本文整理汇总了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();
}
开发者ID:macressler,项目名称:SLADE,代码行数:62,代码来源:TextEditor.cpp

示例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);
}
开发者ID:ruifig,项目名称:nutcracker,代码行数:30,代码来源:FileEditorWnd.cpp

示例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();

}
开发者ID:Halfbrick,项目名称:decoda,代码行数:54,代码来源:CodeEdit.cpp

示例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);
    }
}
开发者ID:jfiguinha,项目名称:Regards,代码行数:14,代码来源:edit.cpp

示例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();
}
开发者ID:HTshandou,项目名称:codelite,代码行数:14,代码来源:svn_console.cpp

示例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));
    }
  }
}
开发者ID:8l,项目名称:objeck-lang,代码行数:14,代码来源:editor.cpp

示例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));
	}

}
开发者ID:xuanya4202,项目名称:ew_base,代码行数:16,代码来源:iwnd_stc.cpp

示例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));
    }

}
开发者ID:n00b87,项目名称:RC-BASIC,代码行数:22,代码来源:rc_ide2Main.cpp

示例9: OnStcKey

void MyStyledText::OnStcKey(wxStyledTextEvent& event)
{
	wxMessageBox("Onstyleddddddddddddddddddddddddd");
	printf("key:%d\n", event.GetKey());
	event.Skip();
}
开发者ID:luzhlon,项目名称:cpp,代码行数:6,代码来源:MyIOPanel.cpp


注:本文中的wxStyledTextEvent::GetKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。