1 // Scintilla source code edit control
2 /** @file AutoComplete.h
3  ** Defines the auto completion list box.
4  **/
5 // Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
6 // The License.txt file describes the conditions under which this software may be distributed.
7 
8 #ifndef AUTOCOMPLETE_H
9 #define AUTOCOMPLETE_H
10 
11 #ifdef SCI_NAMESPACE
12 namespace Scintilla {
13 #endif
14 
15 /**
16  */
17 class AutoComplete {
18 	bool active;
19 	char stopChars[256];
20 	char fillUpChars[256];
21 	char separator;
22 	char typesep; // Type seperator
23 	enum { maxItemLen=1000 };
24 
25 public:
26 
27 	bool ignoreCase;
28 	bool chooseSingle;
29 	ListBox *lb;
30 	int posStart;
31 	int startLen;
32 	/// Should autocompletion be canceled if editor's currentPos <= startPos?
33 	bool cancelAtStartPos;
34 	bool autoHide;
35 	bool dropRestOfWord;
36 	unsigned int ignoreCaseBehaviour;
37 
38 	AutoComplete();
39 	~AutoComplete();
40 
41 	/// Is the auto completion list displayed?
42 	bool Active() const;
43 
44 	/// Display the auto completion list positioned to be near a character position
45 	void Start(Window &parent, int ctrlID, int position, Point location,
46 		int startLen_, int lineHeight, bool unicodeMode, int technology);
47 
48 	/// The stop chars are characters which, when typed, cause the auto completion list to disappear
49 	void SetStopChars(const char *stopChars_);
50 	bool IsStopChar(char ch);
51 
52 	/// The fillup chars are characters which, when typed, fill up the selected word
53 	void SetFillUpChars(const char *fillUpChars_);
54 	bool IsFillUpChar(char ch);
55 
56 	/// The separator character is used when interpreting the list in SetList
57 	void SetSeparator(char separator_);
58 	char GetSeparator() const;
59 
60 	/// The typesep character is used for seperating the word from the type
61 	void SetTypesep(char separator_);
62 	char GetTypesep() const;
63 
64 	/// The list string contains a sequence of words separated by the separator character
65 	void SetList(const char *list);
66 
67 	/// Return the position of the currently selected list item
68 	int GetSelection() const;
69 
70 	/// Return the value of an item in the list
71 	std::string GetValue(int item) const;
72 
73 	void Show(bool show);
74 	void Cancel();
75 
76 	/// Move the current list element by delta, scrolling appropriately
77 	void Move(int delta);
78 
79 	/// Select a list element that starts with word as the current element
80 	void Select(const char *word);
81 };
82 
83 #ifdef SCI_NAMESPACE
84 }
85 #endif
86 
87 #endif
88