1 // Scintilla source code edit control 2 /** @file CallTip.h 3 ** Interface to the call tip control. 4 **/ 5 // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> 6 // The License.txt file describes the conditions under which this software may be distributed. 7 8 #ifndef CALLTIP_H 9 #define CALLTIP_H 10 11 namespace Scintilla { 12 13 /** 14 */ 15 class CallTip { 16 int startHighlight; // character offset to start and... 17 int endHighlight; // ...end of highlighted text 18 std::string val; 19 Font font; 20 PRectangle rectUp; // rectangle of last up angle in the tip 21 PRectangle rectDown; // rectangle of last down arrow in the tip 22 int lineHeight; // vertical line spacing 23 int offsetMain; // The alignment point of the call tip 24 int tabSize; // Tab size in pixels, <=0 no TAB expand 25 bool useStyleCallTip; // if true, STYLE_CALLTIP should be used 26 bool above; // if true, display calltip above text 27 28 void DrawChunk(Surface *surface, int &x, const char *s, 29 int posStart, int posEnd, int ytext, PRectangle rcClient, 30 bool highlight, bool draw); 31 int PaintContents(Surface *surfaceWindow, bool draw); 32 bool IsTabCharacter(char ch) const; 33 int NextTabPos(int x) const; 34 35 public: 36 Window wCallTip; 37 Window wDraw; 38 bool inCallTipMode; 39 Sci::Position posStartCallTip; 40 ColourDesired colourBG; 41 ColourDesired colourUnSel; 42 ColourDesired colourSel; 43 ColourDesired colourShade; 44 ColourDesired colourLight; 45 int codePage; 46 int clickPlace; 47 48 int insetX; // text inset in x from calltip border 49 int widthArrow; 50 int borderHeight; 51 int verticalOffset; // pixel offset up or down of the calltip with respect to the line 52 53 CallTip(); 54 // Deleted so CallTip objects can not be copied. 55 CallTip(const CallTip &) = delete; 56 CallTip(CallTip &&) = delete; 57 CallTip &operator=(const CallTip &) = delete; 58 CallTip &operator=(CallTip &&) = delete; 59 ~CallTip(); 60 61 void PaintCT(Surface *surfaceWindow); 62 63 void MouseClick(Point pt); 64 65 /// Setup the calltip and return a rectangle of the area required. 66 PRectangle CallTipStart(Sci::Position pos, Point pt, int textHeight, const char *defn, 67 const char *faceName, int size, int codePage_, 68 int characterSet, int technology, const Window &wParent); 69 70 void CallTipCancel(); 71 72 /// Set a range of characters to be displayed in a highlight style. 73 /// Commonly used to highlight the current parameter. 74 void SetHighlight(int start, int end); 75 76 /// Set the tab size in pixels for the call tip. 0 or -ve means no tab expand. 77 void SetTabSize(int tabSz); 78 79 /// Set calltip position. 80 void SetPosition(bool aboveText); 81 82 /// Used to determine which STYLE_xxxx to use for call tip information UseStyleCallTip()83 bool UseStyleCallTip() const { return useStyleCallTip;} 84 85 // Modify foreground and background colours 86 void SetForeBack(const ColourDesired &fore, const ColourDesired &back); 87 }; 88 89 } 90 91 #endif 92