本文整理汇总了C++中wxStyledTextEvent::GetText方法的典型用法代码示例。如果您正苦于以下问题:C++ wxStyledTextEvent::GetText方法的具体用法?C++ wxStyledTextEvent::GetText怎么用?C++ wxStyledTextEvent::GetText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxStyledTextEvent
的用法示例。
在下文中一共展示了wxStyledTextEvent::GetText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxDynamicCast
void t4p::PhpCodeCompletionProviderClass::OnAutoCompletionSelected(wxStyledTextEvent& event) {
wxStyledTextCtrl* txtCtrl = wxDynamicCast(event.GetEventObject(), wxStyledTextCtrl);
if (!txtCtrl) {
return;
}
t4p::CodeControlClass* ctrl = (t4p::CodeControlClass*)txtCtrl;
if (!AutoCompletionResourceMatches.empty()) {
UnicodeString selected = t4p::WxToIcu(event.GetText());
bool handled = false;
for (size_t i = 0; i < AutoCompletionResourceMatches.size(); ++i) {
t4p::PhpTagClass res = AutoCompletionResourceMatches[i];
if (res.Identifier == selected) {
// user had selected a function /method name; let's add the
// parenthesis and show the call tip
ctrl->AutoCompCancel();
wxString selected = event.GetText();
int startPos = ctrl->WordStartPosition(ctrl->GetCurrentPos(), true);
ctrl->SetSelection(startPos, ctrl->GetCurrentPos());
wxString status;
if ((t4p::PhpTagClass::FUNCTION == res.Type || t4p::PhpTagClass::METHOD == res.Type) && !res.HasParameters()) {
ctrl->ReplaceSelection(selected + wxT("()"));
ctrl->HandleCallTip(0, true);
} else if (t4p::PhpTagClass::FUNCTION == res.Type || t4p::PhpTagClass::METHOD == res.Type) {
ctrl->ReplaceSelection(selected + wxT("("));
ctrl->HandleCallTip(0, true);
} else {
ctrl->ReplaceSelection(selected);
}
handled = true;
break;
}
}
if (!handled) {
// complete the PHP alternative syntax for control structures
// ie endif endwhile endfor endforeach endswitch
// Scintilla cannot handle semicolons in keywords; we will add the semicolon here
if (selected.caseCompare(UNICODE_STRING_SIMPLE("endif"), 0) == 0 ||
selected.caseCompare(UNICODE_STRING_SIMPLE("endwhile"), 0) == 0 ||
selected.caseCompare(UNICODE_STRING_SIMPLE("endfor"), 0) == 0 ||
selected.caseCompare(UNICODE_STRING_SIMPLE("endforeach"), 0) == 0 ||
selected.caseCompare(UNICODE_STRING_SIMPLE("endswitch"), 0) == 0) {
ctrl->AutoCompCancel();
wxString selected = event.GetText();
int startPos = ctrl->WordStartPosition(ctrl->GetCurrentPos(), true);
ctrl->SetSelection(startPos, ctrl->GetCurrentPos());
ctrl->ReplaceSelection(selected + wxT(";"));
}
}
}
}