michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: #include "nsIAutoCompleteResult.idl" michael@0: michael@0: interface nsIAutoCompleteSimpleResultListener; michael@0: michael@0: /** michael@0: * This class implements nsIAutoCompleteResult and provides simple methods michael@0: * for setting the value and result items. It can be used whenever some basic michael@0: * auto complete results are needed that can be pre-generated and filled into michael@0: * an array. michael@0: */ michael@0: michael@0: [scriptable, uuid(fe8802f9-c2b7-4141-8e5b-280df3f62251)] michael@0: interface nsIAutoCompleteSimpleResult : nsIAutoCompleteResult michael@0: { michael@0: /** michael@0: * A writer for the readonly attribute 'searchString' which should contain michael@0: * the string that the user typed. michael@0: */ michael@0: void setSearchString(in AString aSearchString); michael@0: michael@0: /** michael@0: * A writer for the readonly attribute 'errorDescription'. michael@0: */ michael@0: void setErrorDescription(in AString aErrorDescription); michael@0: michael@0: /** michael@0: * A writer for the readonly attribute 'defaultIndex' which should contain michael@0: * the index of the list that will be selected by default (normally 0). michael@0: */ michael@0: void setDefaultIndex(in long aDefaultIndex); michael@0: michael@0: /** michael@0: * A writer for the readonly attribute 'searchResult' which should contain michael@0: * one of the constants nsIAutoCompleteResult.RESULT_* indicating the success michael@0: * of the search. michael@0: */ michael@0: void setSearchResult(in unsigned short aSearchResult); michael@0: michael@0: /** michael@0: * A writer for the readonly attribute 'typeAheadResult', typically set michael@0: * because a result is only intended for type-ahead completion. michael@0: */ michael@0: void setTypeAheadResult(in boolean aHidden); michael@0: michael@0: /** michael@0: * Appends a match consisting of the given value, comment, image, style and michael@0: * the value to use for defaultIndex completion. michael@0: * @param aValue michael@0: * The value to autocomplete to michael@0: * @param aComment michael@0: * Comment shown in the autocomplete widget to describe this match michael@0: * @param aImage michael@0: * Image shown in the autocomplete widget for this match. michael@0: * @param aStyle michael@0: * Describes how to style the match in the autocomplete widget michael@0: * @param aFinalCompleteValue michael@0: * Value used when the user confirms selecting this match. If not michael@0: * provided, aValue will be used. michael@0: */ michael@0: void appendMatch(in AString aValue, michael@0: in AString aComment, michael@0: [optional] in AString aImage, michael@0: [optional] in AString aStyle, michael@0: [optional] in AString aFinalCompleteValue); michael@0: michael@0: /** michael@0: * Sets a listener for changes in the result. michael@0: */ michael@0: void setListener(in nsIAutoCompleteSimpleResultListener aListener); michael@0: }; michael@0: michael@0: [scriptable, uuid(004efdc5-1989-4874-8a7a-345bf2fa33af)] michael@0: interface nsIAutoCompleteSimpleResultListener : nsISupports michael@0: { michael@0: /** michael@0: * Dispatched after a value is removed from the result. michael@0: * @param aResult michael@0: * The result from which aValue has been removed. michael@0: * @param aValue michael@0: * The removed value. michael@0: * @param aRemoveFromDb michael@0: * Whether the value should be removed from persistent storage as well. michael@0: */ michael@0: void onValueRemoved(in nsIAutoCompleteSimpleResult aResult, in AString aValue, michael@0: in boolean aRemoveFromDb); michael@0: };