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: michael@0: [scriptable, uuid(9203c031-c4e7-4537-a4ec-81443d623d5a)] michael@0: interface nsIAutoCompleteResult : nsISupports michael@0: { michael@0: /** michael@0: * Possible values for the searchResult attribute michael@0: */ michael@0: const unsigned short RESULT_IGNORED = 1; /* indicates invalid searchString */ michael@0: const unsigned short RESULT_FAILURE = 2; /* indicates failure */ michael@0: const unsigned short RESULT_NOMATCH = 3; /* indicates success with no matches michael@0: and that the search is complete */ michael@0: const unsigned short RESULT_SUCCESS = 4; /* indicates success with matches michael@0: and that the search is complete */ michael@0: const unsigned short RESULT_NOMATCH_ONGOING = 5; /* indicates success michael@0: with no matches michael@0: and that the search michael@0: is still ongoing */ michael@0: const unsigned short RESULT_SUCCESS_ONGOING = 6; /* indicates success michael@0: with matches michael@0: and that the search michael@0: is still ongoing */ michael@0: /** michael@0: * The original search string michael@0: */ michael@0: readonly attribute AString searchString; michael@0: michael@0: /** michael@0: * The result of the search michael@0: */ michael@0: readonly attribute unsigned short searchResult; michael@0: michael@0: /** michael@0: * Index of the default item that should be entered if none is selected michael@0: */ michael@0: readonly attribute long defaultIndex; michael@0: michael@0: /** michael@0: * A string describing the cause of a search failure michael@0: */ michael@0: readonly attribute AString errorDescription; michael@0: michael@0: /** michael@0: * The number of matches michael@0: */ michael@0: readonly attribute unsigned long matchCount; michael@0: michael@0: /** michael@0: * If true, the results will not be displayed in the popup. However, michael@0: * if a default index is specified, the default item will still be michael@0: * completed in the input. michael@0: */ michael@0: readonly attribute boolean typeAheadResult; michael@0: michael@0: /** michael@0: * Get the value of the result at the given index michael@0: */ michael@0: AString getValueAt(in long index); michael@0: michael@0: /** michael@0: * This returns the string that is displayed in the dropdown michael@0: */ michael@0: AString getLabelAt(in long index); michael@0: michael@0: /** michael@0: * Get the comment of the result at the given index michael@0: */ michael@0: AString getCommentAt(in long index); michael@0: michael@0: /** michael@0: * Get the style hint for the result at the given index michael@0: */ michael@0: AString getStyleAt(in long index); michael@0: michael@0: /** michael@0: * Get the image of the result at the given index michael@0: */ michael@0: AString getImageAt(in long index); michael@0: michael@0: /** michael@0: * Get the final value that should be completed when the user confirms michael@0: * the match at the given index. michael@0: */ michael@0: AString getFinalCompleteValueAt(in long index); michael@0: michael@0: /** michael@0: * Remove the value at the given index from the autocomplete results. michael@0: * If removeFromDb is set to true, the value should be removed from michael@0: * persistent storage as well. michael@0: */ michael@0: void removeValueAt(in long rowIndex, in boolean removeFromDb); michael@0: };