WxStyledTextCtrl用于PHP的代码折叠

| 我需要使用WxStyledTextCtrl显示PHP代码。除代码折叠外,其他所有工具都工作正常。 我按照wxWidgets页面http://wiki.wxwidgets.org/WxStyledTextCtrl中的示例进行操作,它们使用wxSTC_LEX_CPP词法分析器,并且可以正常工作。我修改了他们的代码,但是当我更改此代码时:
text->SetLexer(wxSTC_LEX_CPP);
为了这:
text->SetLexer(wxSTC_LEX_HTML);
代码折叠停止工作,我已经尝试了所有方法,但无法使其正常工作。 我正在使用VS2010编译的最新版本的wxWidgets。 任何帮助将不胜感激。     
已邀请:
        PHP的Scintilla代码折叠与其他代码折叠稍有不同,因为它是由HTML词法分析器处理的。下面的代码将启用PHP中的代码折叠。折叠看起来像Visual Studio(其中带有加号的框)
wxStyledTextCtrl *ctrl = // from somewhere ....
wxColour backgroundColor = // the background color
wxColour color =  // the foreground color
ctrl->SetProperty(wxT(\"fold\"), wxT(\"1\"));
ctrl->SetProperty(wxT(\"fold.comment\"), wxT(\"1\"));
ctrl->SetProperty(wxT(\"fold.html\"), wxT(\"1\"));
ctrl->SetFoldFlags(wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED | wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED);
int marginNum = 1; // can be 0-5 I believe 
ctrl->SetMarginType(marginNum, wxSTC_MARGIN_SYMBOL);
ctrl->SetMarginWidth(marginNum, 16);
ctrl->SetMarginSensitive(marginNum, true);
ctrl->SetMarginMask(1, wxSTC_MASK_FOLDERS);
ctrl->SetFoldMarginColour(true, backgroundColor);
ctrl->SetFoldMarginHiColour(true, backgroundColor);
ctrl->MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_BOXMINUS, backgroundColor, color);
ctrl->MarkerDefine(wxSTC_MARKNUM_FOLDER, wxSTC_MARK_BOXPLUS, backgroundColor, color);
ctrl->MarkerDefine(wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_VLINE, backgroundColor, color);
ctrl->MarkerDefine(wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_LCORNER, backgroundColor, color);
ctrl->MarkerDefine(wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_BOXPLUSCONNECTED, backgroundColor, color);
ctrl->MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_BOXMINUSCONNECTED, backgroundColor, color);
ctrl->MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_TCORNER, backgroundColor, color);
    

要回复问题请先登录注册