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


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

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


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