• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ wxStyledTextEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中wxStyledTextEvent的典型用法代码示例。如果您正苦于以下问题:C++ wxStyledTextEvent类的具体用法?C++ wxStyledTextEvent怎么用?C++ wxStyledTextEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了wxStyledTextEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: OnMarginClick

////////////////////////////////////////////////////////////////////////////////
// OnMarginClick()
//
//     This function handles the user clicks in the margin to the left of a
//     line of source code. We use the margin to display breakpoint indicators
//     so it makes sense that if you click on an breakpoint indicator, we will
//     clear that breakpoint.  If you click on a spot that does not contain a
//     breakpoint indicator (but it's still in the margin), we create a new
//     breakpoint at that line
//
// Parametes:
//     Selection Event Object
//
void frmDebugger::OnMarginClick(wxStyledTextEvent &event)
{
	int lineNo;

	// Check that the user clicked on the line number or breakpoint margin
	// We don't want to set a breakpoint when the user folds/unfolds code
	if (!(event.GetMargin() == 0 || event.GetMargin() == 1))
		return;

	lineNo = m_codeViewer->LineFromPosition(event.GetPosition());

	if (lineNo <= 0)
		return;

	// If we already have a breakpoint at the clickpoint, disable it, otherwise
	// create a new breakpoint
	if(m_codeViewer->MarkerGet(lineNo) &
	        MARKERINDEX_TO_MARKERMASK(MARKER_BREAKPOINT))
	{
		m_controller->ClearBreakpoint(lineNo);
	}
	else
	{
		m_controller->SetBreakpoint(lineNo);
	}
	m_controller->UpdateBreakpoints();
}
开发者ID:AnnaSkawinska,项目名称:pgadmin3,代码行数:40,代码来源:frmDebugger.cpp


示例2: wxDynamicCast

void t4p::PhpCallTipProviderClass::OnCallTipClick(wxStyledTextEvent& evt) {
    wxStyledTextCtrl* ctrl = wxDynamicCast(evt.GetEventObject(), wxStyledTextCtrl);

    if (!CurrentCallTipResources.empty()) {
        size_t resourcesSize = CurrentCallTipResources.size();
        int position = evt.GetPosition();
        wxString callTip;

        // up arrow. if already at the first choice, then loop around
        // looping around looks better than hiding arrows; because hiding arrows changes the
        // rendering position and make the call tip jump around when clicking up/down
        if (1 == position) {
            CurrentCallTipIndex = ((CurrentCallTipIndex >= 1) && (CurrentCallTipIndex - 1) < resourcesSize) ? CurrentCallTipIndex - 1 : resourcesSize - 1;
            callTip =  PhpCallTipSignature(CurrentCallTipIndex, CurrentCallTipResources);
        } else if (2 == position) {
            // down arrow
            CurrentCallTipIndex = ((CurrentCallTipIndex + 1) < resourcesSize) ? CurrentCallTipIndex + 1 : 0;
            callTip = PhpCallTipSignature(CurrentCallTipIndex, CurrentCallTipResources);
        }
        if (!callTip.IsEmpty()) {
            ctrl->CallTipCancel();
            ctrl->CallTipShow(ctrl->GetCurrentPos(), callTip);
        }
    }
    evt.Skip();
}
开发者ID:62BRAINS,项目名称:triumph4php,代码行数:26,代码来源:PhpCodeCompletionViewClass.cpp


示例3: OnMarginClick

void wxSTEditorFindReplacePanel::OnMarginClick( wxStyledTextEvent &event )
{
    if (!m_resultEditor) return; // set after editor is fully created

    if (event.GetEventType() == wxEVT_STE_MARGINDCLICK)
        return;

    wxSTEditor *editor = (wxSTEditor*)event.GetEventObject();
    int pos = event.GetPosition();

    if (event.GetEventType() == wxEVT_STC_DOUBLECLICK) // event pos not set correctly
        pos = editor->GetCurrentPos();

    int line = editor->LineFromPosition(pos);

    if (editor->GetLine(line).Strip(wxString::both).IsEmpty())
        return;

    wxArrayString* findAllStrings = m_findReplaceData->GetFindAllStrings();

    if ((line < 0) || (line >= (int)findAllStrings->GetCount()))
        return;

    editor->MarkerDeleteAll(STE_MARKER_BOOKMARK);
    editor->MarkerAdd(line, STE_MARKER_BOOKMARK);

    wxFindDialogEvent fEvent(wxEVT_COMMAND_FIND_NEXT, GetId());
    fEvent.SetEventObject(this);
    fEvent.SetFindString(m_findCombo->GetValue());
    fEvent.SetFlags(GetFindFlags());
    fEvent.SetExtraLong(line);
    Send(fEvent);
}
开发者ID:Slulego,项目名称:GD,代码行数:33,代码来源:stefindr.cpp


示例4: OnStcModified

void wxCodeCompletionBoxManager::OnStcModified(wxStyledTextEvent& event)
{
    event.Skip();
    if(m_box && m_box->IsShown() && m_box->m_stc == event.GetEventObject()) {
        m_box->StcModified(event);
    }
}
开发者ID:lpc1996,项目名称:codelite,代码行数:7,代码来源:wxCodeCompletionBoxManager.cpp


示例5: OnMarginClick

void ctlSQLBox::OnMarginClick(wxStyledTextEvent &event)
{
	if (event.GetMargin() == 2)
		ToggleFold(LineFromPosition(event.GetPosition()));

	event.Skip();
}
开发者ID:Joe-xXx,项目名称:pgadmin3,代码行数:7,代码来源:ctlSQLBox.cpp


示例6: OnTextModified

void TextFrame::OnTextModified(wxStyledTextEvent& event)
{
    wxStyledTextCtrl* txt = getCurrentTextCtrl();
    if(txt)
    {
        int line  = txt->LineFromPosition(event.GetPosition()),
            lines = event.GetLinesAdded(),
            linecount = txt->GetLineCount();

        getDocument()->setModified(txt->IsModified());

        if(lines!=0)
        {
            // Add or remove lines
            updateLineNbMargin();
            _fastFindLine->SetRange(1, linecount);

            // Bookmarks
            if(getDocument()->getBookmarks().addLines(line, lines))
                UpdateBookmarkPanel();

            // Markers
            _markbar->SetMax(linecount);
            _markbar->MoveMarkers(line, lines);
        }
    }

    event.Skip();
}
开发者ID:balooloo,项目名称:cody,代码行数:29,代码来源:text-frame.cpp


示例7: onCalltipClicked

/* TextEditor::onCalltipClicked
 * Called when the current calltip is clicked on
 *******************************************************************/
void TextEditor::onCalltipClicked(wxStyledTextEvent& e)
{
	// Can't do anything without function
	if (!ct_function)
		return;

	// Argset up
	if (e.GetPosition() == 1)
	{
		if (ct_argset > 0)
		{
			ct_argset--;
			updateCalltip();
		}
	}

	// Argset down
	if (e.GetPosition() == 2)
	{
		if ((unsigned)ct_argset < ct_function->nArgSets() - 1)
		{
			ct_argset++;
			updateCalltip();
		}
	}
}
开发者ID:macressler,项目名称:SLADE,代码行数:29,代码来源:TextEditor.cpp


示例8: OnDoubleClick

void SubsTextEditCtrl::OnDoubleClick(wxStyledTextEvent &evt) {
	auto bounds = GetBoundsOfWordAtPosition(evt.GetPosition());
	if (bounds.second != 0)
		SetSelection(bounds.first, bounds.first + bounds.second);
	else
		evt.Skip();
}
开发者ID:KagamiChan,项目名称:Aegisub,代码行数:7,代码来源:subs_edit_ctrl.cpp


示例9: 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


示例10: OnMarginClick

//! misc
void Edit::OnMarginClick (wxStyledTextEvent &event) {
    if (event.GetMargin() == 2) {
        int lineClick = LineFromPosition (event.GetPosition());
        int levelClick = GetFoldLevel (lineClick);
        if ((levelClick & wxSTC_FOLDLEVELHEADERFLAG) > 0) {
            ToggleFold (lineClick);
        }
    }
}
开发者ID:jfiguinha,项目名称:Regards,代码行数:10,代码来源:edit.cpp


示例11: onMarginClick

/* TextEditor::onMarginClick
 * Called when a margin is clicked
 *******************************************************************/
void TextEditor::onMarginClick(wxStyledTextEvent& e)
{
	if (e.GetMargin() == 1)
	{
		int line = LineFromPosition(e.GetPosition());
		int level = GetFoldLevel(line);
		if ((level & wxSTC_FOLDLEVELHEADERFLAG) > 0)
			ToggleFold(line);
		updateFolding();
	}
}
开发者ID:Gaerzi,项目名称:SLADE,代码行数:14,代码来源:TextEditor.cpp


示例12: 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


示例13: OnMarginClick

void IWnd_stc::OnMarginClick (wxStyledTextEvent &evt)
{
	if (evt.GetMargin() == StcManager::FOLDING_ID) 
	{
        int lineClick = LineFromPosition (evt.GetPosition());
        int levelClick = GetFoldLevel (lineClick);
        if ((levelClick & wxSTC_FOLDLEVELHEADERFLAG) > 0) 
		{
            ToggleFold (lineClick);
        }
    }
}
开发者ID:xuanya4202,项目名称:ew_base,代码行数:12,代码来源:iwnd_stc.cpp


示例14:

// Event callback when a margin is clicked, used here for code folding
void SavvyEditor::AppFrame::OnMarginClick(wxStyledTextEvent& a_Event)
{
	if (a_Event.GetMargin() == MARGIN_FOLD)
	{
		int lineClick = m_LastSelectedTextCtrl->LineFromPosition(a_Event.GetPosition());
		int levelClick = m_LastSelectedTextCtrl->GetFoldLevel(lineClick);

		if ((levelClick & wxSTC_FOLDLEVELHEADERFLAG) > 0)
		{
			m_LastSelectedTextCtrl->ToggleFold(lineClick);
		}
	}
}
开发者ID:lotsopa,项目名称:Savvy,代码行数:14,代码来源:SavvyAppFrame.cpp


示例15: OnMarginClick

void udCodeEditorPanel::OnMarginClick ( wxStyledTextEvent &event )
{
	if ( event.GetMargin() == 1 )
	{
		int lineClick = m_scintillaEditor->LineFromPosition ( event.GetPosition() );
		int levelClick = m_scintillaEditor->GetFoldLevel ( lineClick );

		if ( ( levelClick & wxSTC_FOLDLEVELHEADERFLAG ) > 0 )
		{
			m_scintillaEditor->ToggleFold ( lineClick );
		}
	}
}
开发者ID:LETARTARE,项目名称:CodeDesigner,代码行数:13,代码来源:EditorPanel.cpp


示例16: 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


示例17: 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


示例18: OnDoubleClick

void SubsTextEditCtrl::OnDoubleClick(wxStyledTextEvent &evt) {
	int pos = evt.GetPosition();
	if (pos == -1 && !tokenized_line.empty()) {
		auto tok = tokenized_line.back();
		SetSelection(line_text.size() - tok.length, line_text.size());
	}
	else {
		auto bounds = GetBoundsOfWordAtPosition(evt.GetPosition());
		if (bounds.second != 0)
			SetSelection(bounds.first, bounds.first + bounds.second);
		else
			evt.Skip();
	}
}
开发者ID:Phonations,项目名称:Aegisub,代码行数:14,代码来源:subs_edit_ctrl.cpp


示例19: OnMarginClick

void TextFrame::OnMarginClick(wxStyledTextEvent& event)
{
  if (event.GetMargin() == MARGIN_FOLD) {
    wxStyledTextCtrl* txt = getCurrentTextCtrl();
    if(txt)
    {
      int line  = txt->LineFromPosition(event.GetPosition());
      int levelClick = txt->GetFoldLevel (line);
      if ((levelClick & wxSTC_FOLDLEVELHEADERFLAG) > 0) {
        txt->ToggleFold (line);
      }
    }
  }
} 
开发者ID:balooloo,项目名称:cody,代码行数:14,代码来源:text-frame.cpp


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ wxSysColourChangedEvent类代码示例发布时间:2022-05-31
下一篇:
C++ wxString类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap