本文整理汇总了C++中wxStyledTextEvent类的典型用法代码示例。如果您正苦于以下问题:C++ wxStyledTextEvent类的具体用法?C++ wxStyledTextEvent怎么用?C++ wxStyledTextEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxStyledTextEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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();
}
示例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);
}
示例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);
}
}
示例5: OnMarginClick
void ctlSQLBox::OnMarginClick(wxStyledTextEvent &event)
{
if (event.GetMargin() == 2)
ToggleFold(LineFromPosition(event.GetPosition()));
event.Skip();
}
示例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();
}
示例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();
}
}
}
示例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();
}
示例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();
}
示例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);
}
}
}
示例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();
}
}
示例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();
}
示例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);
}
}
}
示例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);
}
}
}
示例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 );
}
}
}