Add wxStyledTextCtrl::AutoCompGetCurrentText()

Added support for SCI_AUTOCGETCURRENTTEXT API.

Closes #16263.
This commit is contained in:
New Pagodi 2017-03-07 19:15:45 +01:00 committed by Artur Wieczorek
parent f33da324c0
commit 1bcb30f6d7
6 changed files with 45 additions and 1 deletions

View File

@ -129,6 +129,7 @@ All (GUI):
- Optimize font registration in PostScript code emitted by wxPostScriptDC. - Optimize font registration in PostScript code emitted by wxPostScriptDC.
- Fix drawing filled arc with wxPostScriptDC::DrawArc(). - Fix drawing filled arc with wxPostScriptDC::DrawArc().
- Optimize PostScript code emitted by wxPostScriptDC to draw elliptic arcs. - Optimize PostScript code emitted by wxPostScriptDC to draw elliptic arcs.
- Add wxStyledTextCtrl::AutoCompGetCurrentText() (NewPagodi).
wxGTK: wxGTK:

View File

@ -4498,6 +4498,9 @@ public:
// Get currently selected item position in the auto-completion list // Get currently selected item position in the auto-completion list
int AutoCompGetCurrent() const; int AutoCompGetCurrent() const;
// Get currently selected item text in the auto-completion list
wxString AutoCompGetCurrentText() const;
// Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference. // Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference.
void AutoCompSetCaseInsensitiveBehaviour(int behaviour); void AutoCompSetCaseInsensitiveBehaviour(int behaviour);

View File

@ -5757,6 +5757,13 @@ public:
*/ */
int AutoCompGetCurrent() const; int AutoCompGetCurrent() const;
/**
Get currently selected item text in the auto-completion list
@since 3.1.1
*/
wxString AutoCompGetCurrentText() const;
/** /**
Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference. Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference.

View File

@ -85,6 +85,7 @@ docsMap = {
'AutoCGetCaseInsensitiveBehaviour':'Autocompletion', 'AutoCGetCaseInsensitiveBehaviour':'Autocompletion',
'AutoCGetChooseSingle':'Autocompletion', 'AutoCGetChooseSingle':'Autocompletion',
'AutoCGetCurrent':'Autocompletion', 'AutoCGetCurrent':'Autocompletion',
'AutoCGetCurrentText':'Autocompletion',
'AutoCGetDropRestOfWord':'Autocompletion', 'AutoCGetDropRestOfWord':'Autocompletion',
'AutoCGetIgnoreCase':'Autocompletion', 'AutoCGetIgnoreCase':'Autocompletion',
'AutoCGetMaxHeight':'Autocompletion', 'AutoCGetMaxHeight':'Autocompletion',
@ -806,6 +807,8 @@ docSubstitutions = {
'TextWidth':{'NUL terminated text argument.':''}, 'TextWidth':{'NUL terminated text argument.':''},
'GetCurLine':{'Result is NUL-terminated.':'', 'GetCurLine':{'Result is NUL-terminated.':'',
'Returns the index of the caret on the line.':''}, 'Returns the index of the caret on the line.':''},
'AutoCGetCurrentText':{'Result is NUL-terminated.':'',
'Returns the length of the item text':''},
'StartStyling': 'StartStyling':
{'The unused parameter is no longer used and should be set to 0.':''}, {'The unused parameter is no longer used and should be set to 0.':''},
@ -1330,6 +1333,7 @@ sinceAnnotations= {
'VCHomeDisplay':'3.1.0', 'VCHomeDisplay':'3.1.0',
'VCHomeDisplayExtend':'3.1.0', 'VCHomeDisplayExtend':'3.1.0',
'AutoCGetCurrentText':'3.1.1',
'FoldDisplayTextSetStyle':'3.1.1', 'FoldDisplayTextSetStyle':'3.1.1',
'GetDirectFunction':'3.1.1', 'GetDirectFunction':'3.1.1',
'GetDirectPointer':'3.1.1', 'GetDirectPointer':'3.1.1',

View File

@ -522,7 +522,23 @@ methodOverrideMap = {
'AutoCGetTypeSeparator' : ('AutoCompGetTypeSeparator', 0, 0), 'AutoCGetTypeSeparator' : ('AutoCompGetTypeSeparator', 0, 0),
'AutoCSetTypeSeparator' : ('AutoCompSetTypeSeparator', 0, 0), 'AutoCSetTypeSeparator' : ('AutoCompSetTypeSeparator', 0, 0),
'AutoCGetCurrent' : ('AutoCompGetCurrent', 0, 0), 'AutoCGetCurrent' : ('AutoCompGetCurrent', 0, 0),
'AutoCGetCurrentText' : (None, 0, 0),
'AutoCGetCurrentText' :
('AutoCompGetCurrentText',
'wxString %s() const;',
'''wxString %s() const {
const int msg = %s;
long len = SendMsg(msg, 0, 0);
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(msg, 0, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);'''
),
'AutoCSetMaxWidth' : ('AutoCompSetMaxWidth', 0, 0), 'AutoCSetMaxWidth' : ('AutoCompSetMaxWidth', 0, 0),
'AutoCGetMaxWidth' : ('AutoCompGetMaxWidth', 0, 0), 'AutoCGetMaxWidth' : ('AutoCompGetMaxWidth', 0, 0),
'AutoCSetMaxHeight' : ('AutoCompSetMaxHeight', 0, 0), 'AutoCSetMaxHeight' : ('AutoCompSetMaxHeight', 0, 0),

View File

@ -3618,6 +3618,19 @@ int wxStyledTextCtrl::AutoCompGetCurrent() const
return SendMsg(SCI_AUTOCGETCURRENT, 0, 0); return SendMsg(SCI_AUTOCGETCURRENT, 0, 0);
} }
// Get currently selected item text in the auto-completion list
wxString wxStyledTextCtrl::AutoCompGetCurrentText() const {
const int msg = SCI_AUTOCGETCURRENTTEXT;
long len = SendMsg(msg, 0, 0);
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(msg, 0, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);
}
// Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference. // Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference.
void wxStyledTextCtrl::AutoCompSetCaseInsensitiveBehaviour(int behaviour) void wxStyledTextCtrl::AutoCompSetCaseInsensitiveBehaviour(int behaviour)
{ {