1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 *
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
8 *
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
13 *
14 * The Original Code is mozilla.org code.
15 *
16 * The Initial Developer of the Original Code is
17 * Netscape Communications Corporation.
18 * Portions created by the Initial Developer are Copyright (C) 2001
19 * the Initial Developer. All Rights Reserved.
20 *
21 * Contributor(s):
22 * Joe Hewitt <hewitt@netscape.com> (Original Author)
23 * Dean Tessman <dean_tessman@hotmail.com>
24 * Masayuki Nakano <masayuki@d-toybox.com>
25 *
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
37 *
38 * ***** END LICENSE BLOCK ***** */
39
40 #include "nsISupports.idl"
41
42 interface nsIAutoCompleteInput;
43
44 [scriptable, uuid(6F08D134-8536-4B28-B456-D150FBAA66A9)]
45 interface nsIAutoCompleteController : nsISupports
46 {
47 /*
48 * Possible values for the searchStatus attribute
49 */
50 const unsigned short STATUS_NONE = 1;
51 const unsigned short STATUS_SEARCHING = 2;
52 const unsigned short STATUS_COMPLETE_NO_MATCH = 3;
53 const unsigned short STATUS_COMPLETE_MATCH = 4;
54
55 /*
56 * The input widget that is currently being controlled.
57 */
58 attribute nsIAutoCompleteInput input;
59
60 /*
61 * State which indicates the status of possible ongoing searches
62 */
63 readonly attribute unsigned short searchStatus;
64
65 /*
66 * The number of matches
67 */
68 readonly attribute unsigned long matchCount;
69
70 /*
71 * Start a search on a string, assuming the input property is already set.
72 */
73 void startSearch(in AString searchString);
74
75 /*
76 * Stop all asynchronous searches
77 */
78 void stopSearch();
79
80 /*
81 * Notify the controller that the user has changed text in the textbox. This includes all
82 * means of changing the text value, including typing a character, backspacing, deleting, or
83 * pasting in an entirely new value.
84 */
85 void handleText(in boolean aIgnoreSelection);
86
87 /*
88 * Notify the controller that the user wishes to enter the current text. If
89 * aIsPopupSelection is true, then a selection was made from the popup, so
90 * fill this value into the input field before continuing. If false, just
91 * use the current value of the input field.
92 *
93 * @return True if the controller wishes to prevent event propagation and default event
94 */
95 boolean handleEnter(in boolean aIsPopupSelection);
96
97 /*
98 * Notify the controller that the user wishes to revert autocomplete
99 *
100 * @return True if the controller wishes to prevent event propagation and default event
101 */
102 boolean handleEscape();
103
104 /*
105 * Notify the controller that the user wishes to start composition
106 */
107 void handleStartComposition();
108
109 /*
110 * Notify the controller that the user wishes to end composition
111 */
112 void handleEndComposition();
113
114 /*
115 * Handle tab. Just closes up.
116 */
117 void handleTab();
118
119 /*
120 * Notify the controller of the following key navigation events:
121 * up, down, left, right, page up, page down
122 *
123 * @return True if the controller wishes to prevent event propagation and default event
124 */
125 boolean handleKeyNavigation(in unsigned long key);
126
127 /*
128 * Notify the controller that the user chose to delete the current
129 * auto-complete result.
130 */
131 boolean handleDelete();
132
133 /*
134 * Get the value of the result at a given index in the last completed search
135 */
136 AString getValueAt(in long index);
137
138 /*
139 * Get the comment of the result at a given index in the last completed search
140 */
141 AString getCommentAt(in long index);
142
143 /*
144 * Get a the style hint for the result at a given index in the last completed search
145 */
146 AString getStyleAt(in long index);
147
148 /*
149 * Get the url of the image of the result at a given index in the last completed search
150 */
151 AString getImageAt(in long index);
152
153 /*
154 * Get / set the current search string. Note, setting will not start searching
155 */
156 attribute AString searchString;
157 };