extern wxString stc2wx(const char* str);
extern wxString stc2wx(const char* str, size_t len);
-extern const wxWX2MBbuf wx2stc(const wxString& str);
+extern wxCharBuffer wx2stc(const wxString& str);
// This function takes both wxString and wxCharBuffer because it uses either
// one or the other of them depending on the build mode. In Unicode it uses the
inline wxString stc2wx(const char* str, size_t len) {
return wxString(str, len);
}
-inline const wxWX2MBbuf wx2stc(const wxString& str) {
+inline const char* wx2stc(const wxString& str) {
return str.mbc_str();
}
// Add text to the document at current position.
void wxStyledTextCtrl::AddText(const wxString& text) {
- wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
+ const wxWX2MBbuf buf = wx2stc(text);
SendMsg(2001, wx2stclen(text, buf), (sptr_t)(const char*)buf);
}
TextToFind ft;
ft.chrg.cpMin = minPos;
ft.chrg.cpMax = maxPos;
- wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
+ const wxWX2MBbuf buf = wx2stc(text);
ft.lpstrText = (char*)(const char*)buf;
return SendMsg(2150, flags, (sptr_t)&ft);
// Returns the length of the replacement text.
int wxStyledTextCtrl::ReplaceTarget(const wxString& text) {
- wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
+ const wxWX2MBbuf buf = wx2stc(text);
return SendMsg(2194, wx2stclen(text, buf), (sptr_t)(const char*)buf);
}
// caused by processing the \d patterns.
int wxStyledTextCtrl::ReplaceTargetRE(const wxString& text) {
- wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
+ const wxWX2MBbuf buf = wx2stc(text);
return SendMsg(2195, wx2stclen(text, buf), (sptr_t)(const char*)buf);
}
// Returns length of range or -1 for failure in which case target is not moved.
int wxStyledTextCtrl::SearchInTarget(const wxString& text) {
- wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
+ const wxWX2MBbuf buf = wx2stc(text);
return SendMsg(2197, wx2stclen(text, buf), (sptr_t)(const char*)buf);
}
// Append a string to the end of the document without changing the selection.
void wxStyledTextCtrl::AppendText(const wxString& text) {
- wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
+ const wxWX2MBbuf buf = wx2stc(text);
SendMsg(2282, wx2stclen(text, buf), (sptr_t)(const char*)buf);
}