From 64ebd8eea5c3210e0013c529a7b56c49c4350986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Granjoux?= Date: Fri, 23 Sep 2011 23:16:12 +0200 Subject: Allow to display calltip above or below the text --- src/ScintillaBase.cxx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/ScintillaBase.cxx') diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 0f1c9cda3..e6f208ccc 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -400,7 +400,6 @@ int ScintillaBase::AutoCompleteGetCurrentText(char *buffer) { void ScintillaBase::CallTipShow(Point pt, const char *defn) { ac.Cancel(); - pt.y += vs.lineHeight; // If container knows about STYLE_CALLTIP then use it in place of the // STYLE_DEFAULT for the face name, size and character set. Also use it // for the foreground and background colour. @@ -409,6 +408,7 @@ void ScintillaBase::CallTipShow(Point pt, const char *defn) { ct.SetForeBack(vs.styles[STYLE_CALLTIP].fore, vs.styles[STYLE_CALLTIP].back); } PRectangle rc = ct.CallTipStart(sel.MainCaret(), pt, + vs.lineHeight, defn, vs.styles[ctStyle].fontName, vs.styles[ctStyle].sizeZoomed, @@ -417,10 +417,16 @@ void ScintillaBase::CallTipShow(Point pt, const char *defn) { vs.technology, wMain); // If the call-tip window would be out of the client - // space, adjust so it displays above the text. + // space PRectangle rcClient = GetClientRectangle(); + int offset = vs.lineHeight + rc.Height(); + // adjust so it displays below the text. + if (rc.top < rcClient.top) { + rc.top += offset; + rc.bottom += offset; + } + // adjust so it displays above the text. if (rc.bottom > rcClient.bottom) { - int offset = vs.lineHeight + rc.Height(); rc.top -= offset; rc.bottom -= offset; } @@ -814,6 +820,11 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara InvalidateStyleRedraw(); break; + case SCI_CALLTIPSETPOSITION: + ct.SetPosition((bool)wParam); + InvalidateStyleRedraw(); + break; + case SCI_USEPOPUP: displayPopupMenu = wParam != 0; break; -- cgit v1.2.3