xref: /MusicPlayer2/scintilla/src/CallTip.cxx (revision 8af74909132ed5e696cb05b6689ae4baf14c1c96)
1*8af74909SZhong Yang // Scintilla source code edit control
2*8af74909SZhong Yang /** @file CallTip.cxx
3*8af74909SZhong Yang  ** Code for displaying call tips.
4*8af74909SZhong Yang  **/
5*8af74909SZhong Yang // Copyright 1998-2001 by Neil Hodgson <[email protected]>
6*8af74909SZhong Yang // The License.txt file describes the conditions under which this software may be distributed.
7*8af74909SZhong Yang 
8*8af74909SZhong Yang #include <cstddef>
9*8af74909SZhong Yang #include <cstdlib>
10*8af74909SZhong Yang #include <cassert>
11*8af74909SZhong Yang #include <cstring>
12*8af74909SZhong Yang #include <cstdio>
13*8af74909SZhong Yang #include <cmath>
14*8af74909SZhong Yang 
15*8af74909SZhong Yang #include <stdexcept>
16*8af74909SZhong Yang #include <string>
17*8af74909SZhong Yang #include <string_view>
18*8af74909SZhong Yang #include <vector>
19*8af74909SZhong Yang #include <algorithm>
20*8af74909SZhong Yang #include <memory>
21*8af74909SZhong Yang 
22*8af74909SZhong Yang #include "Platform.h"
23*8af74909SZhong Yang 
24*8af74909SZhong Yang #include "Scintilla.h"
25*8af74909SZhong Yang 
26*8af74909SZhong Yang #include "Position.h"
27*8af74909SZhong Yang #include "IntegerRectangle.h"
28*8af74909SZhong Yang #include "CallTip.h"
29*8af74909SZhong Yang 
30*8af74909SZhong Yang using namespace Scintilla;
31*8af74909SZhong Yang 
Length() const32*8af74909SZhong Yang size_t Chunk::Length() const noexcept {
33*8af74909SZhong Yang 	return end - start;
34*8af74909SZhong Yang }
35*8af74909SZhong Yang 
CallTip()36*8af74909SZhong Yang CallTip::CallTip() noexcept {
37*8af74909SZhong Yang 	wCallTip = {};
38*8af74909SZhong Yang 	inCallTipMode = false;
39*8af74909SZhong Yang 	posStartCallTip = 0;
40*8af74909SZhong Yang 	rectUp = PRectangle(0,0,0,0);
41*8af74909SZhong Yang 	rectDown = PRectangle(0,0,0,0);
42*8af74909SZhong Yang 	lineHeight = 1;
43*8af74909SZhong Yang 	offsetMain = 0;
44*8af74909SZhong Yang 	tabSize = 0;
45*8af74909SZhong Yang 	above = false;
46*8af74909SZhong Yang 	useStyleCallTip = false;    // for backwards compatibility
47*8af74909SZhong Yang 
48*8af74909SZhong Yang 	insetX = 5;
49*8af74909SZhong Yang 	widthArrow = 14;
50*8af74909SZhong Yang 	borderHeight = 2; // Extra line for border and an empty line at top and bottom.
51*8af74909SZhong Yang 	verticalOffset = 1;
52*8af74909SZhong Yang 
53*8af74909SZhong Yang #ifdef __APPLE__
54*8af74909SZhong Yang 	// proper apple colours for the default
55*8af74909SZhong Yang 	colourBG = ColourDesired(0xff, 0xff, 0xc6);
56*8af74909SZhong Yang 	colourUnSel = ColourDesired(0, 0, 0);
57*8af74909SZhong Yang #else
58*8af74909SZhong Yang 	colourBG = ColourDesired(0xff, 0xff, 0xff);
59*8af74909SZhong Yang 	colourUnSel = ColourDesired(0x80, 0x80, 0x80);
60*8af74909SZhong Yang #endif
61*8af74909SZhong Yang 	colourSel = ColourDesired(0, 0, 0x80);
62*8af74909SZhong Yang 	colourShade = ColourDesired(0, 0, 0);
63*8af74909SZhong Yang 	colourLight = ColourDesired(0xc0, 0xc0, 0xc0);
64*8af74909SZhong Yang 	codePage = 0;
65*8af74909SZhong Yang 	clickPlace = 0;
66*8af74909SZhong Yang }
67*8af74909SZhong Yang 
~CallTip()68*8af74909SZhong Yang CallTip::~CallTip() {
69*8af74909SZhong Yang 	font.Release();
70*8af74909SZhong Yang 	wCallTip.Destroy();
71*8af74909SZhong Yang }
72*8af74909SZhong Yang 
73*8af74909SZhong Yang // We ignore tabs unless a tab width has been set.
IsTabCharacter(char ch) const74*8af74909SZhong Yang bool CallTip::IsTabCharacter(char ch) const noexcept {
75*8af74909SZhong Yang 	return (tabSize > 0) && (ch == '\t');
76*8af74909SZhong Yang }
77*8af74909SZhong Yang 
NextTabPos(int x) const78*8af74909SZhong Yang int CallTip::NextTabPos(int x) const noexcept {
79*8af74909SZhong Yang 	if (tabSize > 0) {              // paranoia... not called unless this is true
80*8af74909SZhong Yang 		x -= insetX;                // position relative to text
81*8af74909SZhong Yang 		x = (x + tabSize) / tabSize;  // tab "number"
82*8af74909SZhong Yang 		return tabSize*x + insetX;  // position of next tab
83*8af74909SZhong Yang 	} else {
84*8af74909SZhong Yang 		return x + 1;                 // arbitrary
85*8af74909SZhong Yang 	}
86*8af74909SZhong Yang }
87*8af74909SZhong Yang 
88*8af74909SZhong Yang namespace {
89*8af74909SZhong Yang 
90*8af74909SZhong Yang // Although this test includes 0, we should never see a \0 character.
IsArrowCharacter(char ch)91*8af74909SZhong Yang constexpr bool IsArrowCharacter(char ch) noexcept {
92*8af74909SZhong Yang 	return (ch == 0) || (ch == '\001') || (ch == '\002');
93*8af74909SZhong Yang }
94*8af74909SZhong Yang 
DrawArrow(Scintilla::Surface * surface,const PRectangle & rc,bool upArrow,ColourDesired colourBG,ColourDesired colourUnSel)95*8af74909SZhong Yang void DrawArrow(Scintilla::Surface *surface, const PRectangle &rc, bool upArrow, ColourDesired colourBG, ColourDesired colourUnSel) {
96*8af74909SZhong Yang 	surface->FillRectangle(rc, colourBG);
97*8af74909SZhong Yang 	const int width = static_cast<int>(rc.Width());
98*8af74909SZhong Yang 	const int halfWidth = width / 2 - 3;
99*8af74909SZhong Yang 	const int quarterWidth = halfWidth / 2;
100*8af74909SZhong Yang 	const int centreX = static_cast<int>(rc.left) + width / 2 - 1;
101*8af74909SZhong Yang 	const int centreY = static_cast<int>(rc.top + rc.bottom) / 2;
102*8af74909SZhong Yang 	const PRectangle rcClientInner(rc.left + 1, rc.top + 1, rc.right - 2, rc.bottom - 1);
103*8af74909SZhong Yang 	surface->FillRectangle(rcClientInner, colourUnSel);
104*8af74909SZhong Yang 
105*8af74909SZhong Yang 	if (upArrow) {      // Up arrow
106*8af74909SZhong Yang 		Point pts[] = {
107*8af74909SZhong Yang 			Point::FromInts(centreX - halfWidth, centreY + quarterWidth),
108*8af74909SZhong Yang 			Point::FromInts(centreX + halfWidth, centreY + quarterWidth),
109*8af74909SZhong Yang 			Point::FromInts(centreX, centreY - halfWidth + quarterWidth),
110*8af74909SZhong Yang 		};
111*8af74909SZhong Yang 		surface->Polygon(pts, std::size(pts), colourBG, colourBG);
112*8af74909SZhong Yang 	} else {            // Down arrow
113*8af74909SZhong Yang 		Point pts[] = {
114*8af74909SZhong Yang 			Point::FromInts(centreX - halfWidth, centreY - quarterWidth),
115*8af74909SZhong Yang 			Point::FromInts(centreX + halfWidth, centreY - quarterWidth),
116*8af74909SZhong Yang 			Point::FromInts(centreX, centreY + halfWidth - quarterWidth),
117*8af74909SZhong Yang 		};
118*8af74909SZhong Yang 		surface->Polygon(pts, std::size(pts), colourBG, colourBG);
119*8af74909SZhong Yang 	}
120*8af74909SZhong Yang }
121*8af74909SZhong Yang 
122*8af74909SZhong Yang }
123*8af74909SZhong Yang 
124*8af74909SZhong Yang // Draw a section of the call tip that does not include \n in one colour.
125*8af74909SZhong Yang // The text may include tabs or arrow characters.
DrawChunk(Surface * surface,int x,std::string_view sv,int ytext,PRectangle rcClient,bool asHighlight,bool draw)126*8af74909SZhong Yang int CallTip::DrawChunk(Surface *surface, int x, std::string_view sv,
127*8af74909SZhong Yang 	int ytext, PRectangle rcClient, bool asHighlight, bool draw) {
128*8af74909SZhong Yang 
129*8af74909SZhong Yang 	if (sv.empty()) {
130*8af74909SZhong Yang 		return x;
131*8af74909SZhong Yang 	}
132*8af74909SZhong Yang 
133*8af74909SZhong Yang 	// Divide the text into sections that are all text, or that are
134*8af74909SZhong Yang 	// single arrows or single tab characters (if tabSize > 0).
135*8af74909SZhong Yang 	// Start with single element 0 to simplify append checks.
136*8af74909SZhong Yang 	std::vector<size_t> ends(1);
137*8af74909SZhong Yang 	for (size_t i=0; i<sv.length(); i++) {
138*8af74909SZhong Yang 		if (IsArrowCharacter(sv[i]) || IsTabCharacter(sv[i])) {
139*8af74909SZhong Yang 			if (ends.back() != i)
140*8af74909SZhong Yang 				ends.push_back(i);
141*8af74909SZhong Yang 			ends.push_back(i+1);
142*8af74909SZhong Yang 		}
143*8af74909SZhong Yang 	}
144*8af74909SZhong Yang 	if (ends.back() != sv.length())
145*8af74909SZhong Yang 		ends.push_back(sv.length());
146*8af74909SZhong Yang 	ends.erase(ends.begin());	// Remove initial 0.
147*8af74909SZhong Yang 
148*8af74909SZhong Yang 	size_t startSeg = 0;
149*8af74909SZhong Yang 	for (const size_t endSeg : ends) {
150*8af74909SZhong Yang 		assert(endSeg > 0);
151*8af74909SZhong Yang 		int xEnd;
152*8af74909SZhong Yang 		if (IsArrowCharacter(sv[startSeg])) {
153*8af74909SZhong Yang 			xEnd = x + widthArrow;
154*8af74909SZhong Yang 			const bool upArrow = sv[startSeg] == '\001';
155*8af74909SZhong Yang 			rcClient.left = static_cast<XYPOSITION>(x);
156*8af74909SZhong Yang 			rcClient.right = static_cast<XYPOSITION>(xEnd);
157*8af74909SZhong Yang 			if (draw) {
158*8af74909SZhong Yang 				DrawArrow(surface, rcClient, upArrow, colourBG, colourUnSel);
159*8af74909SZhong Yang 			}
160*8af74909SZhong Yang 			offsetMain = xEnd;
161*8af74909SZhong Yang 			if (upArrow) {
162*8af74909SZhong Yang 				rectUp = rcClient;
163*8af74909SZhong Yang 			} else {
164*8af74909SZhong Yang 				rectDown = rcClient;
165*8af74909SZhong Yang 			}
166*8af74909SZhong Yang 		} else if (IsTabCharacter(sv[startSeg])) {
167*8af74909SZhong Yang 			xEnd = NextTabPos(x);
168*8af74909SZhong Yang 		} else {
169*8af74909SZhong Yang 			const std::string_view segText = sv.substr(startSeg, endSeg - startSeg);
170*8af74909SZhong Yang 			xEnd = x + static_cast<int>(std::lround(surface->WidthText(font, segText)));
171*8af74909SZhong Yang 			if (draw) {
172*8af74909SZhong Yang 				rcClient.left = static_cast<XYPOSITION>(x);
173*8af74909SZhong Yang 				rcClient.right = static_cast<XYPOSITION>(xEnd);
174*8af74909SZhong Yang 				surface->DrawTextTransparent(rcClient, font, static_cast<XYPOSITION>(ytext),
175*8af74909SZhong Yang 									segText, asHighlight ? colourSel : colourUnSel);
176*8af74909SZhong Yang 			}
177*8af74909SZhong Yang 		}
178*8af74909SZhong Yang 		x = xEnd;
179*8af74909SZhong Yang 		startSeg = endSeg;
180*8af74909SZhong Yang 	}
181*8af74909SZhong Yang 	return x;
182*8af74909SZhong Yang }
183*8af74909SZhong Yang 
PaintContents(Surface * surfaceWindow,bool draw)184*8af74909SZhong Yang int CallTip::PaintContents(Surface *surfaceWindow, bool draw) {
185*8af74909SZhong Yang 	const PRectangle rcClientPos = wCallTip.GetClientPosition();
186*8af74909SZhong Yang 	const PRectangle rcClientSize(0.0f, 0.0f, rcClientPos.right - rcClientPos.left,
187*8af74909SZhong Yang 	                        rcClientPos.bottom - rcClientPos.top);
188*8af74909SZhong Yang 	PRectangle rcClient(1.0f, 1.0f, rcClientSize.right - 1, rcClientSize.bottom - 1);
189*8af74909SZhong Yang 
190*8af74909SZhong Yang 	// To make a nice small call tip window, it is only sized to fit most normal characters without accents
191*8af74909SZhong Yang 	const int ascent = static_cast<int>(std::round(surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font)));
192*8af74909SZhong Yang 
193*8af74909SZhong Yang 	// For each line...
194*8af74909SZhong Yang 	// Draw the definition in three parts: before highlight, highlighted, after highlight
195*8af74909SZhong Yang 	int ytext = static_cast<int>(rcClient.top) + ascent + 1;
196*8af74909SZhong Yang 	rcClient.bottom = ytext + surfaceWindow->Descent(font) + 1;
197*8af74909SZhong Yang 	std::string_view remaining(val);
198*8af74909SZhong Yang 	int maxWidth = 0;
199*8af74909SZhong Yang 	size_t lineStart = 0;
200*8af74909SZhong Yang 	while (!remaining.empty()) {
201*8af74909SZhong Yang 		const std::string_view chunkVal = remaining.substr(0, remaining.find_first_of('\n'));
202*8af74909SZhong Yang 		remaining.remove_prefix(chunkVal.length());
203*8af74909SZhong Yang 		if (!remaining.empty()) {
204*8af74909SZhong Yang 			remaining.remove_prefix(1);	// Skip \n
205*8af74909SZhong Yang 		}
206*8af74909SZhong Yang 
207*8af74909SZhong Yang 		const Chunk chunkLine(lineStart, lineStart + chunkVal.length());
208*8af74909SZhong Yang 		Chunk chunkHighlight(
209*8af74909SZhong Yang 			std::clamp(highlight.start, chunkLine.start, chunkLine.end),
210*8af74909SZhong Yang 			std::clamp(highlight.end, chunkLine.start, chunkLine.end)
211*8af74909SZhong Yang 		);
212*8af74909SZhong Yang 		chunkHighlight.start -= lineStart;
213*8af74909SZhong Yang 		chunkHighlight.end -= lineStart;
214*8af74909SZhong Yang 
215*8af74909SZhong Yang 		rcClient.top = static_cast<XYPOSITION>(ytext - ascent - 1);
216*8af74909SZhong Yang 
217*8af74909SZhong Yang 		int x = insetX;     // start each line at this inset
218*8af74909SZhong Yang 
219*8af74909SZhong Yang 		x = DrawChunk(surfaceWindow, x,
220*8af74909SZhong Yang 			chunkVal.substr(0, chunkHighlight.start),
221*8af74909SZhong Yang 			ytext, rcClient, false, draw);
222*8af74909SZhong Yang 		x = DrawChunk(surfaceWindow, x,
223*8af74909SZhong Yang 			chunkVal.substr(chunkHighlight.start, chunkHighlight.Length()),
224*8af74909SZhong Yang 			ytext, rcClient, true, draw);
225*8af74909SZhong Yang 		x = DrawChunk(surfaceWindow, x,
226*8af74909SZhong Yang 			chunkVal.substr(chunkHighlight.end),
227*8af74909SZhong Yang 			ytext, rcClient, false, draw);
228*8af74909SZhong Yang 
229*8af74909SZhong Yang 		ytext += lineHeight;
230*8af74909SZhong Yang 		rcClient.bottom += lineHeight;
231*8af74909SZhong Yang 		maxWidth = std::max(maxWidth, x);
232*8af74909SZhong Yang 		lineStart += chunkVal.length() + 1;
233*8af74909SZhong Yang 	}
234*8af74909SZhong Yang 	return maxWidth;
235*8af74909SZhong Yang }
236*8af74909SZhong Yang 
PaintCT(Surface * surfaceWindow)237*8af74909SZhong Yang void CallTip::PaintCT(Surface *surfaceWindow) {
238*8af74909SZhong Yang 	if (val.empty())
239*8af74909SZhong Yang 		return;
240*8af74909SZhong Yang 	const PRectangle rcClientPos = wCallTip.GetClientPosition();
241*8af74909SZhong Yang 	const PRectangle rcClientSize(0.0f, 0.0f, rcClientPos.right - rcClientPos.left,
242*8af74909SZhong Yang 	                        rcClientPos.bottom - rcClientPos.top);
243*8af74909SZhong Yang 	const PRectangle rcClient(1.0f, 1.0f, rcClientSize.right - 1, rcClientSize.bottom - 1);
244*8af74909SZhong Yang 
245*8af74909SZhong Yang 	surfaceWindow->FillRectangle(rcClient, colourBG);
246*8af74909SZhong Yang 
247*8af74909SZhong Yang 	offsetMain = insetX;    // initial alignment assuming no arrows
248*8af74909SZhong Yang 	PaintContents(surfaceWindow, true);
249*8af74909SZhong Yang 
250*8af74909SZhong Yang #ifndef __APPLE__
251*8af74909SZhong Yang 	// OSX doesn't put borders on "help tags"
252*8af74909SZhong Yang 	// Draw a raised border around the edges of the window
253*8af74909SZhong Yang 	const IntegerRectangle ircClientSize(rcClientSize);
254*8af74909SZhong Yang 	surfaceWindow->MoveTo(0, ircClientSize.bottom - 1);
255*8af74909SZhong Yang 	surfaceWindow->PenColour(colourShade);
256*8af74909SZhong Yang 	surfaceWindow->LineTo(ircClientSize.right - 1, ircClientSize.bottom - 1);
257*8af74909SZhong Yang 	surfaceWindow->LineTo(ircClientSize.right - 1, 0);
258*8af74909SZhong Yang 	surfaceWindow->PenColour(colourLight);
259*8af74909SZhong Yang 	surfaceWindow->LineTo(0, 0);
260*8af74909SZhong Yang 	surfaceWindow->LineTo(0, ircClientSize.bottom - 1);
261*8af74909SZhong Yang #endif
262*8af74909SZhong Yang }
263*8af74909SZhong Yang 
MouseClick(Point pt)264*8af74909SZhong Yang void CallTip::MouseClick(Point pt) noexcept {
265*8af74909SZhong Yang 	clickPlace = 0;
266*8af74909SZhong Yang 	if (rectUp.Contains(pt))
267*8af74909SZhong Yang 		clickPlace = 1;
268*8af74909SZhong Yang 	if (rectDown.Contains(pt))
269*8af74909SZhong Yang 		clickPlace = 2;
270*8af74909SZhong Yang }
271*8af74909SZhong Yang 
CallTipStart(Sci::Position pos,Point pt,int textHeight,const char * defn,const char * faceName,int size,int codePage_,int characterSet,int technology,const Window & wParent)272*8af74909SZhong Yang PRectangle CallTip::CallTipStart(Sci::Position pos, Point pt, int textHeight, const char *defn,
273*8af74909SZhong Yang                                  const char *faceName, int size,
274*8af74909SZhong Yang                                  int codePage_, int characterSet,
275*8af74909SZhong Yang 								 int technology, const Window &wParent) {
276*8af74909SZhong Yang 	clickPlace = 0;
277*8af74909SZhong Yang 	val = defn;
278*8af74909SZhong Yang 	codePage = codePage_;
279*8af74909SZhong Yang 	std::unique_ptr<Surface> surfaceMeasure(Surface::Allocate(technology));
280*8af74909SZhong Yang 	surfaceMeasure->Init(wParent.GetID());
281*8af74909SZhong Yang 	surfaceMeasure->SetUnicodeMode(SC_CP_UTF8 == codePage);
282*8af74909SZhong Yang 	surfaceMeasure->SetDBCSMode(codePage);
283*8af74909SZhong Yang 	highlight = Chunk();
284*8af74909SZhong Yang 	inCallTipMode = true;
285*8af74909SZhong Yang 	posStartCallTip = pos;
286*8af74909SZhong Yang 	const XYPOSITION deviceHeight = static_cast<XYPOSITION>(surfaceMeasure->DeviceHeightFont(size));
287*8af74909SZhong Yang 	const FontParameters fp(faceName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, SC_WEIGHT_NORMAL, false, 0, technology, characterSet);
288*8af74909SZhong Yang 	font.Create(fp);
289*8af74909SZhong Yang 	// Look for multiple lines in the text
290*8af74909SZhong Yang 	// Only support \n here - simply means container must avoid \r!
291*8af74909SZhong Yang 	const int numLines = 1 + static_cast<int>(std::count(val.begin(), val.end(), '\n'));
292*8af74909SZhong Yang 	rectUp = PRectangle(0,0,0,0);
293*8af74909SZhong Yang 	rectDown = PRectangle(0,0,0,0);
294*8af74909SZhong Yang 	offsetMain = insetX;            // changed to right edge of any arrows
295*8af74909SZhong Yang 	const int width = PaintContents(surfaceMeasure.get(), false) + insetX;
296*8af74909SZhong Yang 	lineHeight = static_cast<int>(std::lround(surfaceMeasure->Height(font)));
297*8af74909SZhong Yang 
298*8af74909SZhong Yang 	// The returned
299*8af74909SZhong Yang 	// rectangle is aligned to the right edge of the last arrow encountered in
300*8af74909SZhong Yang 	// the tip text, else to the tip text left edge.
301*8af74909SZhong Yang 	const int height = lineHeight * numLines - static_cast<int>(surfaceMeasure->InternalLeading(font)) + borderHeight * 2;
302*8af74909SZhong Yang 	if (above) {
303*8af74909SZhong Yang 		return PRectangle(pt.x - offsetMain, pt.y - verticalOffset - height, pt.x + width - offsetMain, pt.y - verticalOffset);
304*8af74909SZhong Yang 	} else {
305*8af74909SZhong Yang 		return PRectangle(pt.x - offsetMain, pt.y + verticalOffset + textHeight, pt.x + width - offsetMain, pt.y + verticalOffset + textHeight + height);
306*8af74909SZhong Yang 	}
307*8af74909SZhong Yang }
308*8af74909SZhong Yang 
CallTipCancel()309*8af74909SZhong Yang void CallTip::CallTipCancel() {
310*8af74909SZhong Yang 	inCallTipMode = false;
311*8af74909SZhong Yang 	if (wCallTip.Created()) {
312*8af74909SZhong Yang 		wCallTip.Destroy();
313*8af74909SZhong Yang 	}
314*8af74909SZhong Yang }
315*8af74909SZhong Yang 
SetHighlight(size_t start,size_t end)316*8af74909SZhong Yang void CallTip::SetHighlight(size_t start, size_t end) {
317*8af74909SZhong Yang 	// Avoid flashing by checking something has really changed
318*8af74909SZhong Yang 	if ((start != highlight.start) || (end != highlight.end)) {
319*8af74909SZhong Yang 		highlight.start = start;
320*8af74909SZhong Yang 		highlight.end = (end > start) ? end : start;
321*8af74909SZhong Yang 		if (wCallTip.Created()) {
322*8af74909SZhong Yang 			wCallTip.InvalidateAll();
323*8af74909SZhong Yang 		}
324*8af74909SZhong Yang 	}
325*8af74909SZhong Yang }
326*8af74909SZhong Yang 
327*8af74909SZhong Yang // Set the tab size (sizes > 0 enable the use of tabs). This also enables the
328*8af74909SZhong Yang // use of the STYLE_CALLTIP.
SetTabSize(int tabSz)329*8af74909SZhong Yang void CallTip::SetTabSize(int tabSz) noexcept {
330*8af74909SZhong Yang 	tabSize = tabSz;
331*8af74909SZhong Yang 	useStyleCallTip = true;
332*8af74909SZhong Yang }
333*8af74909SZhong Yang 
334*8af74909SZhong Yang // Set the calltip position, below the text by default or if above is false
335*8af74909SZhong Yang // else above the text.
SetPosition(bool aboveText)336*8af74909SZhong Yang void CallTip::SetPosition(bool aboveText) noexcept {
337*8af74909SZhong Yang 	above = aboveText;
338*8af74909SZhong Yang }
339*8af74909SZhong Yang 
UseStyleCallTip() const340*8af74909SZhong Yang bool CallTip::UseStyleCallTip() const noexcept {
341*8af74909SZhong Yang 	return useStyleCallTip;
342*8af74909SZhong Yang }
343*8af74909SZhong Yang 
344*8af74909SZhong Yang // It might be better to have two access functions for this and to use
345*8af74909SZhong Yang // them for all settings of colours.
SetForeBack(const ColourDesired & fore,const ColourDesired & back)346*8af74909SZhong Yang void CallTip::SetForeBack(const ColourDesired &fore, const ColourDesired &back) noexcept {
347*8af74909SZhong Yang 	colourBG = back;
348*8af74909SZhong Yang 	colourUnSel = fore;
349*8af74909SZhong Yang }
350