|
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 #include "nsIAutoCompleteResult.idl" |
|
7 |
|
8 interface nsIAutoCompleteSimpleResultListener; |
|
9 |
|
10 /** |
|
11 * This class implements nsIAutoCompleteResult and provides simple methods |
|
12 * for setting the value and result items. It can be used whenever some basic |
|
13 * auto complete results are needed that can be pre-generated and filled into |
|
14 * an array. |
|
15 */ |
|
16 |
|
17 [scriptable, uuid(fe8802f9-c2b7-4141-8e5b-280df3f62251)] |
|
18 interface nsIAutoCompleteSimpleResult : nsIAutoCompleteResult |
|
19 { |
|
20 /** |
|
21 * A writer for the readonly attribute 'searchString' which should contain |
|
22 * the string that the user typed. |
|
23 */ |
|
24 void setSearchString(in AString aSearchString); |
|
25 |
|
26 /** |
|
27 * A writer for the readonly attribute 'errorDescription'. |
|
28 */ |
|
29 void setErrorDescription(in AString aErrorDescription); |
|
30 |
|
31 /** |
|
32 * A writer for the readonly attribute 'defaultIndex' which should contain |
|
33 * the index of the list that will be selected by default (normally 0). |
|
34 */ |
|
35 void setDefaultIndex(in long aDefaultIndex); |
|
36 |
|
37 /** |
|
38 * A writer for the readonly attribute 'searchResult' which should contain |
|
39 * one of the constants nsIAutoCompleteResult.RESULT_* indicating the success |
|
40 * of the search. |
|
41 */ |
|
42 void setSearchResult(in unsigned short aSearchResult); |
|
43 |
|
44 /** |
|
45 * A writer for the readonly attribute 'typeAheadResult', typically set |
|
46 * because a result is only intended for type-ahead completion. |
|
47 */ |
|
48 void setTypeAheadResult(in boolean aHidden); |
|
49 |
|
50 /** |
|
51 * Appends a match consisting of the given value, comment, image, style and |
|
52 * the value to use for defaultIndex completion. |
|
53 * @param aValue |
|
54 * The value to autocomplete to |
|
55 * @param aComment |
|
56 * Comment shown in the autocomplete widget to describe this match |
|
57 * @param aImage |
|
58 * Image shown in the autocomplete widget for this match. |
|
59 * @param aStyle |
|
60 * Describes how to style the match in the autocomplete widget |
|
61 * @param aFinalCompleteValue |
|
62 * Value used when the user confirms selecting this match. If not |
|
63 * provided, aValue will be used. |
|
64 */ |
|
65 void appendMatch(in AString aValue, |
|
66 in AString aComment, |
|
67 [optional] in AString aImage, |
|
68 [optional] in AString aStyle, |
|
69 [optional] in AString aFinalCompleteValue); |
|
70 |
|
71 /** |
|
72 * Sets a listener for changes in the result. |
|
73 */ |
|
74 void setListener(in nsIAutoCompleteSimpleResultListener aListener); |
|
75 }; |
|
76 |
|
77 [scriptable, uuid(004efdc5-1989-4874-8a7a-345bf2fa33af)] |
|
78 interface nsIAutoCompleteSimpleResultListener : nsISupports |
|
79 { |
|
80 /** |
|
81 * Dispatched after a value is removed from the result. |
|
82 * @param aResult |
|
83 * The result from which aValue has been removed. |
|
84 * @param aValue |
|
85 * The removed value. |
|
86 * @param aRemoveFromDb |
|
87 * Whether the value should be removed from persistent storage as well. |
|
88 */ |
|
89 void onValueRemoved(in nsIAutoCompleteSimpleResult aResult, in AString aValue, |
|
90 in boolean aRemoveFromDb); |
|
91 }; |