本文整理汇总了C++中wxStyledTextEvent::GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ wxStyledTextEvent::GetPosition方法的具体用法?C++ wxStyledTextEvent::GetPosition怎么用?C++ wxStyledTextEvent::GetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxStyledTextEvent
的用法示例。
在下文中一共展示了wxStyledTextEvent::GetPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
}
}
示例2: 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();
}
}
示例3: 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();
}
示例4: 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);
}
示例5: 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();
}
示例6: OnMarginClick
void ctlSQLBox::OnMarginClick(wxStyledTextEvent &event)
{
if (event.GetMargin() == 2)
ToggleFold(LineFromPosition(event.GetPosition()));
event.Skip();
}
示例7: 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();
}
示例8: 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();
}
示例9: onMouseDwellStart
/* TextEditor::onMouseDwellStart
* Called when the mouse pointer has 'dwelt' in one position for a
* certain amount of time
*******************************************************************/
void TextEditor::onMouseDwellStart(wxStyledTextEvent& e)
{
if (wxTheApp->IsActive() && HasFocus() && !call_tip->IsShown() && txed_calltips_mouse && e.GetPosition() >= 0)
{
openCalltip(e.GetPosition(), -1, true);
ct_dwell = true;
}
}
示例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: OnMouseDClick
void FindUsageTab::OnMouseDClick(wxStyledTextEvent& e)
{
long pos = e.GetPosition();
int line = m_sci->LineFromPosition(pos);
UsageResultsMap::const_iterator iter = m_matches.find(line);
if(iter != m_matches.end()) {
DoOpenResult(iter->second);
}
m_sci->SetSelection(wxNOT_FOUND, pos);
}
示例12: 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();
}
}
示例13: OnMarginClick
void ReplaceInFilesPanel::OnMarginClick(wxStyledTextEvent& e)
{
int line = m_sci->LineFromPosition(e.GetPosition());
if(m_matchInfo.find(line) == m_matchInfo.end()) {
FindResultsTab::OnMarginClick(e);
} else if(m_sci->MarkerGet(line) & 7 << 0x7) {
m_sci->MarkerDelete(line, 0x7);
} else {
m_sci->MarkerAdd(line, 0x7);
}
}
示例14: 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);
}
}
}
示例15:
// 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);
}
}
}