toolkit/components/autocomplete/nsIAutoCompleteController.idl

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:c16dc4c83bcf
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 #include "nsISupports.idl"
6
7 interface nsIAutoCompleteInput;
8
9 [scriptable, uuid(ff9f8465-204a-47a6-b3c9-0628b3856684)]
10 interface nsIAutoCompleteController : nsISupports
11 {
12 /*
13 * Possible values for the searchStatus attribute
14 */
15 const unsigned short STATUS_NONE = 1;
16 const unsigned short STATUS_SEARCHING = 2;
17 const unsigned short STATUS_COMPLETE_NO_MATCH = 3;
18 const unsigned short STATUS_COMPLETE_MATCH = 4;
19
20 /*
21 * The input widget that is currently being controlled.
22 */
23 attribute nsIAutoCompleteInput input;
24
25 /*
26 * State which indicates the status of possible ongoing searches
27 */
28 readonly attribute unsigned short searchStatus;
29
30 /*
31 * The number of matches
32 */
33 readonly attribute unsigned long matchCount;
34
35 /*
36 * Start a search on a string, assuming the input property is already set.
37 */
38 void startSearch(in AString searchString);
39
40 /*
41 * Stop all asynchronous searches
42 */
43 void stopSearch();
44
45 /*
46 * Notify the controller that the user has changed text in the textbox.
47 * This includes all means of changing the text value, including typing a
48 * character, backspacing, deleting, pasting, committing composition or
49 * canceling composition.
50 *
51 * NOTE: handleText() must be called after composition actually ends, even if
52 * the composition is canceled and the textbox value isn't changed.
53 * Then, implementation of handleText() can access the editor when
54 * it's not in composing mode. DOM compositionend event is not good
55 * timing for calling handleText(). DOM input event immediately after
56 * DOM compositionend event is the best timing to call this.
57 */
58 void handleText();
59
60 /*
61 * Notify the controller that the user wishes to enter the current text. If
62 * aIsPopupSelection is true, then a selection was made from the popup, so
63 * fill this value into the input field before continuing. If false, just
64 * use the current value of the input field.
65 *
66 * @return True if the controller wishes to prevent event propagation and default event
67 */
68 boolean handleEnter(in boolean aIsPopupSelection);
69
70 /*
71 * Notify the controller that the user wishes to revert autocomplete
72 *
73 * @return True if the controller wishes to prevent event propagation and default event
74 */
75 boolean handleEscape();
76
77 /*
78 * Notify the controller that the user wishes to start composition
79 *
80 * NOTE: nsIAutoCompleteController implementation expects that this is called
81 * by DOM compositionstart handler.
82 */
83 void handleStartComposition();
84
85 /*
86 * Notify the controller that the user wishes to end composition
87 *
88 * NOTE: nsIAutoCompleteController implementation expects that this is called
89 * by DOM compositionend handler.
90 */
91 void handleEndComposition();
92
93 /*
94 * Handle tab. Just closes up.
95 */
96 void handleTab();
97
98 /*
99 * Notify the controller of the following key navigation events:
100 * up, down, left, right, page up, page down
101 *
102 * @return True if the controller wishes to prevent event propagation and default event
103 */
104 boolean handleKeyNavigation(in unsigned long key);
105
106 /*
107 * Notify the controller that the user chose to delete the current
108 * auto-complete result.
109 */
110 boolean handleDelete();
111
112 /*
113 * Get the value of the result at a given index in the last completed search
114 */
115 AString getValueAt(in long index);
116
117 /*
118 * Get the label of the result at a given index in the last completed search
119 */
120 AString getLabelAt(in long index);
121
122 /*
123 * Get the comment of the result at a given index in the last completed search
124 */
125 AString getCommentAt(in long index);
126
127 /*
128 * Get the style hint for the result at a given index in the last completed search
129 */
130 AString getStyleAt(in long index);
131
132 /*
133 * Get the url of the image of the result at a given index in the last completed search
134 */
135 AString getImageAt(in long index);
136
137 /*
138 * For the last completed search, get the final value that should be completed
139 * when the user confirms the match at the given index
140 */
141 AString getFinalCompleteValueAt(in long index);
142
143 /*
144 * Get / set the current search string. Note, setting will not start searching
145 */
146 attribute AString searchString;
147 };

mercurial