Add GetDirect{Function,Pointer}() methods to wxStyledTextCtrl
These methods can be useful when working with dynamic lexers. Closes #17481.
This commit is contained in:
committed by
Vadim Zeitlin
parent
a6e249ea1a
commit
0a3057b83c
@@ -3525,6 +3525,13 @@ public:
|
||||
// Retrieve the number of characters in the document.
|
||||
int GetTextLength() const;
|
||||
|
||||
// Retrieve a pointer to a function that processes messages for this Scintilla.
|
||||
void* GetDirectFunction() const;
|
||||
|
||||
// Retrieve a pointer value to use as the first argument when calling
|
||||
// the function returned by GetDirectFunction.
|
||||
void* GetDirectPointer() const;
|
||||
|
||||
// Set to overtype (true) or insert mode.
|
||||
void SetOvertype(bool overtype);
|
||||
|
||||
|
@@ -4019,6 +4019,21 @@ public:
|
||||
*/
|
||||
int GetTextLength() const;
|
||||
|
||||
/**
|
||||
Retrieve a pointer to a function that processes messages for this Scintilla.
|
||||
|
||||
@since 3.1.1
|
||||
*/
|
||||
void* GetDirectFunction() const;
|
||||
|
||||
/**
|
||||
Retrieve a pointer value to use as the first argument when calling
|
||||
the function returned by GetDirectFunction.
|
||||
|
||||
@since 3.1.1
|
||||
*/
|
||||
void* GetDirectPointer() const;
|
||||
|
||||
/**
|
||||
Set to overtype (true) or insert mode.
|
||||
*/
|
||||
|
@@ -800,6 +800,11 @@ sptr_t ScintillaWX::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam)
|
||||
LexerManager::GetInstance()->Load((const char*)lParam);
|
||||
break;
|
||||
#endif
|
||||
case SCI_GETDIRECTFUNCTION:
|
||||
return reinterpret_cast<sptr_t>(DirectFunction);
|
||||
|
||||
case SCI_GETDIRECTPOINTER:
|
||||
return reinterpret_cast<sptr_t>(this);
|
||||
|
||||
default:
|
||||
return ScintillaBase::WndProc(iMessage, wParam, lParam);
|
||||
@@ -1246,6 +1251,11 @@ bool ScintillaWX::GetUseAntiAliasing() {
|
||||
return vs.extraFontFlag != 0;
|
||||
}
|
||||
|
||||
sptr_t ScintillaWX::DirectFunction(
|
||||
ScintillaWX* swx, unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
return swx->WndProc(iMessage, wParam, lParam);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
@@ -210,6 +210,9 @@ private:
|
||||
bool HasCaretSizeChanged();
|
||||
bool CreateSystemCaret();
|
||||
bool DestroySystemCaret();
|
||||
|
||||
static sptr_t DirectFunction(ScintillaWX* swx, unsigned int iMessage,
|
||||
uptr_t wParam, sptr_t lParam);
|
||||
#ifdef __WXMSW__
|
||||
HBITMAP sysCaretBitmap;
|
||||
int sysCaretWidth;
|
||||
|
@@ -591,8 +591,19 @@ methodOverrideMap = {
|
||||
|
||||
('Retrieve all the text in the document.', )),
|
||||
|
||||
'GetDirectFunction' : (None, 0, 0, 0),
|
||||
'GetDirectPointer' : (None, 0, 0, 0),
|
||||
'GetDirectFunction' :
|
||||
(0,
|
||||
'void* %s() const;',
|
||||
'''void* %s() const {
|
||||
return (void*)SendMsg(%s);''',
|
||||
0),
|
||||
|
||||
'GetDirectPointer' :
|
||||
(0,
|
||||
'void* %s() const;',
|
||||
'''void* %s() const {
|
||||
return (void*)SendMsg(%s);''',
|
||||
0),
|
||||
|
||||
'GetTargetText' :
|
||||
(0,
|
||||
|
@@ -1824,6 +1824,17 @@ int wxStyledTextCtrl::GetTextLength() const
|
||||
return SendMsg(SCI_GETTEXTLENGTH, 0, 0);
|
||||
}
|
||||
|
||||
// Retrieve a pointer to a function that processes messages for this Scintilla.
|
||||
void* wxStyledTextCtrl::GetDirectFunction() const {
|
||||
return (void*)SendMsg(SCI_GETDIRECTFUNCTION);
|
||||
}
|
||||
|
||||
// Retrieve a pointer value to use as the first argument when calling
|
||||
// the function returned by GetDirectFunction.
|
||||
void* wxStyledTextCtrl::GetDirectPointer() const {
|
||||
return (void*)SendMsg(SCI_GETDIRECTPOINTER);
|
||||
}
|
||||
|
||||
// Set to overtype (true) or insert mode.
|
||||
void wxStyledTextCtrl::SetOvertype(bool overtype)
|
||||
{
|
||||
|
Reference in New Issue
Block a user