From b06e63dbd2594cac3248c2d98b0e25f79e354cc1 Mon Sep 17 00:00:00 2001 From: New Pagodi Date: Fri, 16 Sep 2016 01:38:27 +0200 Subject: [PATCH] Add new wxStyledTextCtrl wxEVT_STC_AUTOCOMP_COMPLETED event This is the translation of Scintilla SCN_AUTOCCOMPLETED notification. Closes #17664. --- docs/changes.txt | 1 + include/wx/stc/stc.h | 5 ++++- interface/wx/stc/stc.h | 4 ++++ src/stc/stc.cpp | 33 +++++++++++++++++++++------------ src/stc/stc.cpp.in | 33 +++++++++++++++++++++------------ src/stc/stc.h.in | 5 ++++- src/stc/stc.interface.h.in | 4 ++++ 7 files changed, 59 insertions(+), 26 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 05a63e70a6..b6eb8f14fa 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -104,6 +104,7 @@ All (GUI): - Add support for affine transformation matrix in wxGCDC. - Add wxGraphicsContext::Flush() for Cairo renderer. - Add wxStyledTextEvent::GetListCompletionMethod() (NewPagodi). +- Add wxEVT_STC_AUTOCOMP_COMPLETED event (NewPagodi). wxGTK: diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index c272ea4c64..a2e4dac114 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -5431,6 +5431,7 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_CHAR_DELETED, wxSt wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_RELEASE_CLICK, wxStyledTextEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CLIPBOARD_COPY, wxStyledTextEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CLIPBOARD_PASTE, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_COMPLETED, wxStyledTextEvent ); #else enum { wxEVT_STC_CHANGE, @@ -5465,7 +5466,8 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CLIPBOARD_PASTE, wxStyledTe wxEVT_STC_AUTOCOMP_CHAR_DELETED, wxEVT_STC_HOTSPOT_RELEASE_CLICK, wxEVT_STC_CLIPBOARD_COPY, - wxEVT_STC_CLIPBOARD_PASTE + wxEVT_STC_CLIPBOARD_PASTE, + wxEVT_STC_AUTOCOMP_COMPLETED }; #endif @@ -5510,6 +5512,7 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); #define EVT_STC_HOTSPOT_RELEASE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_RELEASE_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), #define EVT_STC_CLIPBOARD_COPY(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CLIPBOARD_COPY, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), #define EVT_STC_CLIPBOARD_PASTE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CLIPBOARD_PASTE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_AUTOCOMP_COMPLETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_COMPLETED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), #endif diff --git a/interface/wx/stc/stc.h b/interface/wx/stc/stc.h index 97f92bea40..021667e72a 100644 --- a/interface/wx/stc/stc.h +++ b/interface/wx/stc/stc.h @@ -2801,6 +2801,10 @@ Process a @c wxEVT_STC_CLIPBOARD_PASTE event, generated when text is being pasted from the clipboard. Use wxStyledTextEvent::SetString() to modify the text that will be inserted into the control. Valid event functions: @link wxStyledTextEvent::GetPosition GetPosition@endlink, @link wxStyledTextEvent::GetString GetString@endlink, @link wxStyledTextEvent::SetString SetString@endlink. @since 3.1.0 + @event{EVT_STC_AUTOCOMP_COMPLETED(id, fn)} + Process a @c wxEVT_STC_AUTOCOMP_COMPLETED event, generated after an autocompletion list has closed and inserted its text into the control. Valid event functions: @link wxStyledTextEvent::GetPosition GetPosition@endlink, @link wxStyledTextEvent::GetString GetString@endlink, @link wxStyledTextEvent::GetKey GetKey@endlink, @link wxStyledTextEvent::GetListCompletionMethod GetListCompletionMethod@endlink. + @since 3.1.1 + @endEventTable @library{wxstc} diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index 588bbabbb5..ab2ede459e 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -136,6 +136,7 @@ wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CHAR_DELETED, wxStyledTextEvent ); wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_RELEASE_CLICK, wxStyledTextEvent ); wxDEFINE_EVENT( wxEVT_STC_CLIPBOARD_COPY, wxStyledTextEvent ); wxDEFINE_EVENT( wxEVT_STC_CLIPBOARD_PASTE, wxStyledTextEvent ); +wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_COMPLETED, wxStyledTextEvent ); @@ -5363,14 +5364,6 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) { evt.SetEventType(wxEVT_STC_PAINTED); break; - case SCN_AUTOCSELECTION: - evt.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION); - evt.SetListType(scn.listType); - SetEventText(evt, scn.text, strlen(scn.text)); - evt.SetPosition(scn.lParam); - evt.SetListCompletionMethod(scn.listCompletionMethod); - break; - case SCN_USERLISTSELECTION: evt.SetEventType(wxEVT_STC_USERLISTSELECTION); evt.SetListType(scn.listType); @@ -5408,8 +5401,8 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) { evt.SetEventType(wxEVT_STC_HOTSPOT_DCLICK); break; - case SCN_CALLTIPCLICK: - evt.SetEventType(wxEVT_STC_CALLTIP_CLICK); + case SCN_HOTSPOTRELEASECLICK: + evt.SetEventType(wxEVT_STC_HOTSPOT_RELEASE_CLICK); break; case SCN_INDICATORCLICK: @@ -5420,6 +5413,18 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) { evt.SetEventType(wxEVT_STC_INDICATOR_RELEASE); break; + case SCN_CALLTIPCLICK: + evt.SetEventType(wxEVT_STC_CALLTIP_CLICK); + break; + + case SCN_AUTOCSELECTION: + evt.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION); + evt.SetListType(scn.listType); + SetEventText(evt, scn.text, strlen(scn.text)); + evt.SetPosition(scn.lParam); + evt.SetListCompletionMethod(scn.listCompletionMethod); + break; + case SCN_AUTOCCANCELLED: evt.SetEventType(wxEVT_STC_AUTOCOMP_CANCELLED); break; @@ -5428,8 +5433,12 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) { evt.SetEventType(wxEVT_STC_AUTOCOMP_CHAR_DELETED); break; - case SCN_HOTSPOTRELEASECLICK: - evt.SetEventType(wxEVT_STC_HOTSPOT_RELEASE_CLICK); + case SCN_AUTOCCOMPLETED: + evt.SetEventType(wxEVT_STC_AUTOCOMP_COMPLETED); + evt.SetListType(scn.listType); + SetEventText(evt, scn.text, strlen(scn.text)); + evt.SetPosition(scn.lParam); + evt.SetListCompletionMethod(scn.listCompletionMethod); break; default: diff --git a/src/stc/stc.cpp.in b/src/stc/stc.cpp.in index 8e766d279e..f72676e3bd 100644 --- a/src/stc/stc.cpp.in +++ b/src/stc/stc.cpp.in @@ -136,6 +136,7 @@ wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CHAR_DELETED, wxStyledTextEvent ); wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_RELEASE_CLICK, wxStyledTextEvent ); wxDEFINE_EVENT( wxEVT_STC_CLIPBOARD_COPY, wxStyledTextEvent ); wxDEFINE_EVENT( wxEVT_STC_CLIPBOARD_PASTE, wxStyledTextEvent ); +wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_COMPLETED, wxStyledTextEvent ); @@ -1069,14 +1070,6 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) { evt.SetEventType(wxEVT_STC_PAINTED); break; - case SCN_AUTOCSELECTION: - evt.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION); - evt.SetListType(scn.listType); - SetEventText(evt, scn.text, strlen(scn.text)); - evt.SetPosition(scn.lParam); - evt.SetListCompletionMethod(scn.listCompletionMethod); - break; - case SCN_USERLISTSELECTION: evt.SetEventType(wxEVT_STC_USERLISTSELECTION); evt.SetListType(scn.listType); @@ -1114,8 +1107,8 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) { evt.SetEventType(wxEVT_STC_HOTSPOT_DCLICK); break; - case SCN_CALLTIPCLICK: - evt.SetEventType(wxEVT_STC_CALLTIP_CLICK); + case SCN_HOTSPOTRELEASECLICK: + evt.SetEventType(wxEVT_STC_HOTSPOT_RELEASE_CLICK); break; case SCN_INDICATORCLICK: @@ -1126,6 +1119,18 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) { evt.SetEventType(wxEVT_STC_INDICATOR_RELEASE); break; + case SCN_CALLTIPCLICK: + evt.SetEventType(wxEVT_STC_CALLTIP_CLICK); + break; + + case SCN_AUTOCSELECTION: + evt.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION); + evt.SetListType(scn.listType); + SetEventText(evt, scn.text, strlen(scn.text)); + evt.SetPosition(scn.lParam); + evt.SetListCompletionMethod(scn.listCompletionMethod); + break; + case SCN_AUTOCCANCELLED: evt.SetEventType(wxEVT_STC_AUTOCOMP_CANCELLED); break; @@ -1134,8 +1139,12 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) { evt.SetEventType(wxEVT_STC_AUTOCOMP_CHAR_DELETED); break; - case SCN_HOTSPOTRELEASECLICK: - evt.SetEventType(wxEVT_STC_HOTSPOT_RELEASE_CLICK); + case SCN_AUTOCCOMPLETED: + evt.SetEventType(wxEVT_STC_AUTOCOMP_COMPLETED); + evt.SetListType(scn.listType); + SetEventText(evt, scn.text, strlen(scn.text)); + evt.SetPosition(scn.lParam); + evt.SetListCompletionMethod(scn.listCompletionMethod); break; default: diff --git a/src/stc/stc.h.in b/src/stc/stc.h.in index 0c27c85989..98bd996ab7 100644 --- a/src/stc/stc.h.in +++ b/src/stc/stc.h.in @@ -684,6 +684,7 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_CHAR_DELETED, wxSt wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_RELEASE_CLICK, wxStyledTextEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CLIPBOARD_COPY, wxStyledTextEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CLIPBOARD_PASTE, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_COMPLETED, wxStyledTextEvent ); #else enum { wxEVT_STC_CHANGE, @@ -718,7 +719,8 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CLIPBOARD_PASTE, wxStyledTe wxEVT_STC_AUTOCOMP_CHAR_DELETED, wxEVT_STC_HOTSPOT_RELEASE_CLICK, wxEVT_STC_CLIPBOARD_COPY, - wxEVT_STC_CLIPBOARD_PASTE + wxEVT_STC_CLIPBOARD_PASTE, + wxEVT_STC_AUTOCOMP_COMPLETED }; #endif @@ -763,6 +765,7 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); #define EVT_STC_HOTSPOT_RELEASE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_RELEASE_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), #define EVT_STC_CLIPBOARD_COPY(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CLIPBOARD_COPY, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), #define EVT_STC_CLIPBOARD_PASTE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CLIPBOARD_PASTE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_AUTOCOMP_COMPLETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_COMPLETED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), #endif diff --git a/src/stc/stc.interface.h.in b/src/stc/stc.interface.h.in index 21ca6e6b06..2ee9e0eb4a 100644 --- a/src/stc/stc.interface.h.in +++ b/src/stc/stc.interface.h.in @@ -116,6 +116,10 @@ Process a @c wxEVT_STC_CLIPBOARD_PASTE event, generated when text is being pasted from the clipboard. Use wxStyledTextEvent::SetString() to modify the text that will be inserted into the control. Valid event functions: @link wxStyledTextEvent::GetPosition GetPosition@endlink, @link wxStyledTextEvent::GetString GetString@endlink, @link wxStyledTextEvent::SetString SetString@endlink. @since 3.1.0 + @event{EVT_STC_AUTOCOMP_COMPLETED(id, fn)} + Process a @c wxEVT_STC_AUTOCOMP_COMPLETED event, generated after an autocompletion list has closed and inserted its text into the control. Valid event functions: @link wxStyledTextEvent::GetPosition GetPosition@endlink, @link wxStyledTextEvent::GetString GetString@endlink, @link wxStyledTextEvent::GetKey GetKey@endlink, @link wxStyledTextEvent::GetListCompletionMethod GetListCompletionMethod@endlink. + @since 3.1.1 + @endEventTable @library{wxstc}