diff options
-rw-r--r-- | cocoa/ScintillaCocoa.mm | 2 | ||||
-rw-r--r-- | doc/ScintillaDoc.html | 13 | ||||
-rw-r--r-- | gtk/ScintillaGTK.cxx | 1 | ||||
-rw-r--r-- | include/Scintilla.h | 2 | ||||
-rw-r--r-- | include/Scintilla.iface | 2 | ||||
-rw-r--r-- | qt/ScintillaEditBase/ScintillaQt.cpp | 2 | ||||
-rw-r--r-- | src/Editor.cxx | 6 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 1 |
8 files changed, 26 insertions, 3 deletions
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index ce1042e9b..79332eda6 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -1708,6 +1708,8 @@ void ScintillaCocoa::NotifyFocus(bool focus) (uintptr_t) this); if (delegateHasCommand) [delegate command:(focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS) idFrom:GetCtrlID()]; + + Editor::NotifyFocus(focus); } //-------------------------------------------------------------------------------------------------- diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index d2be3b3e1..031fc0f72 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -6521,6 +6521,8 @@ struct SCNotification { <a class="message" href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a><br /> <a class="message" href="#SCN_AUTOCCANCELLED">SCN_AUTOCCANCELLED</a><br /> <a class="message" href="#SCN_AUTOCCHARDELETED">SCN_AUTOCCHARDELETED</a><br /> + <a class="message" href="#SCN_FOCUSIN">SCN_FOCUSIN</a><br /> + <a class="message" href="#SCN_FOCUSOUT">SCN_FOCUSOUT</a><br /> </code> <p>The following <code>SCI_*</code> messages are associated with these notifications:</p> @@ -6532,8 +6534,10 @@ struct SCNotification { <a class="message" href="#SCI_GETIDENTIFIER">SCI_GETIDENTIFIER</a><br /> </code> - <p>The following additional notifications are sent using the <code>WM_COMMAND</code> message on - Windows. + <p>The following additional notifications are sent using a secondary "command" method and should + be avoided in new code as the primary "notification" method provides all the same events with richer + information. + The <code>WM_COMMAND</code> message is used on Windows. This emulates the Windows Edit control. Only the lower 16 bits of the control's ID is passed in these notifications.</p> <p>On GTK+, the "command" signal is sent and the signal handler should have the signature @@ -7275,6 +7279,11 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next The user deleted a character while autocompletion list was active. There is no other information in SCNotification.</p> + <p><b id="SCN_FOCUSIN">SCN_FOCUSIN</b><br /> + <b id="SCN_FOCUSOUT">SCN_FOCUSOUT</b><br /> + <code>SCN_FOCUSIN</code> (2028) is fired when Scintilla receives focus and + <code>SCN_FOCUSOUT</code> (2029) when it loses focus.</p> + <h2 id="Images">Images</h2> <p>Two formats are supported for images used in margin markers and autocompletion lists, RGBA and XPM.</p> diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index 273333465..91c1250fc 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -1208,6 +1208,7 @@ void ScintillaGTK::NotifyFocus(bool focus) { g_signal_emit(G_OBJECT(sci), scintilla_signals[COMMAND_SIGNAL], 0, Platform::LongFromTwoShorts (GetCtrlID(), focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS), PWidget(wMain)); + Editor::NotifyFocus(focus); } void ScintillaGTK::NotifyParent(SCNotification scn) { diff --git a/include/Scintilla.h b/include/Scintilla.h index 720ef21fc..b50d20260 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -987,6 +987,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCN_AUTOCCANCELLED 2025 #define SCN_AUTOCCHARDELETED 2026 #define SCN_HOTSPOTRELEASECLICK 2027 +#define SCN_FOCUSIN 2028 +#define SCN_FOCUSOUT 2029 #ifndef SCI_DISABLE_PROVISIONAL #define SC_LINE_END_TYPE_DEFAULT 0 #define SC_LINE_END_TYPE_UNICODE 1 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index b3e34ac3b..a49af7c69 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -4371,6 +4371,8 @@ evt void IndicatorRelease=2024(int modifiers, int position) evt void AutoCCancelled=2025(void) evt void AutoCCharDeleted=2026(void) evt void HotSpotReleaseClick=2027(int modifiers, int position) +evt void FocusIn=2028(void) +evt void FocusOut=2029(void) cat Provisional diff --git a/qt/ScintillaEditBase/ScintillaQt.cpp b/qt/ScintillaEditBase/ScintillaQt.cpp index d79fe3a86..2e3b9a0a5 100644 --- a/qt/ScintillaEditBase/ScintillaQt.cpp +++ b/qt/ScintillaEditBase/ScintillaQt.cpp @@ -392,6 +392,8 @@ void ScintillaQt::NotifyFocus(bool focus) Platform::LongFromTwoShorts (GetCtrlID(), focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS), reinterpret_cast<sptr_t>(wMain.GetID())); + + Editor::NotifyFocus(focus); } void ScintillaQt::NotifyParent(SCNotification scn) diff --git a/src/Editor.cxx b/src/Editor.cxx index c990af34b..8fda6b9ba 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -4414,7 +4414,11 @@ void Editor::DelCharBack(bool allowLineStartDeletion) { ShowCaretAtCurrentPosition(); } -void Editor::NotifyFocus(bool) {} +void Editor::NotifyFocus(bool focus) { + SCNotification scn = {}; + scn.nmhdr.code = focus ? SCN_FOCUSIN : SCN_FOCUSOUT; + NotifyParent(scn); +} void Editor::SetCtrlID(int identifier) { ctrlID = identifier; diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 03106b769..2ddc3944f 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -1429,6 +1429,7 @@ void ScintillaWin::NotifyFocus(bool focus) { ::SendMessage(::GetParent(MainHWND()), WM_COMMAND, MAKELONG(GetCtrlID(), focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS), reinterpret_cast<LPARAM>(MainHWND())); + Editor::NotifyFocus(focus); } void ScintillaWin::SetCtrlID(int identifier) { |