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 /** 12 */ 13 class CallTip { 14 int startHighlight; // character offset to start and... 15 int endHighlight; // ...end of highlighted text 16 char *val; 17 Font font; 18 PRectangle rectUp; // rectangle of last up angle in the tip 19 PRectangle rectDown; // rectangle of last down arrow in the tip 20 int lineHeight; // vertical line spacing 21 int offsetMain; // The alignment point of the call tip 22 int tabSize; // Tab size in pixels, <=0 no TAB expand 23 bool useStyleCallTip; // if true, STYLE_CALLTIP should be used 24 25 // Private so CallTip objects can not be copied CallTip(const CallTip &)26 CallTip(const CallTip &) {} 27 CallTip &operator=(const CallTip &) { return *this; } 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 c); 33 int NextTabPos(int x); 34 35 public: 36 Window wCallTip; 37 Window wDraw; 38 bool inCallTipMode; 39 int posStartCallTip; 40 ColourPair colourBG; 41 ColourPair colourUnSel; 42 ColourPair colourSel; 43 ColourPair colourShade; 44 ColourPair colourLight; 45 int codePage; 46 int clickPlace; 47 48 CallTip(); 49 ~CallTip(); 50 51 /// Claim or accept palette entries for the colours required to paint a calltip. 52 void RefreshColourPalette(Palette &pal, bool want); 53 54 void PaintCT(Surface *surfaceWindow); 55 56 void MouseClick(Point pt); 57 58 /// Setup the calltip and return a rectangle of the area required. 59 PRectangle CallTipStart(int pos, Point pt, const char *defn, 60 const char *faceName, int size, int codePage_, 61 int characterSet, Window &wParent); 62 63 void CallTipCancel(); 64 65 /// Set a range of characters to be displayed in a highlight style. 66 /// Commonly used to highlight the current parameter. 67 void SetHighlight(int start, int end); 68 69 /// Set the tab size in pixels for the call tip. 0 or -ve means no tab expand. 70 void SetTabSize(int tabSz); 71 72 /// Used to determine which STYLE_xxxx to use for call tip information UseStyleCallTip()73 bool UseStyleCallTip() const { return useStyleCallTip;} 74 75 // Modify foreground and background colours 76 void SetForeBack(const ColourPair &fore, const ColourPair &back); 77 }; 78 79 #endif 80