toolkit/components/autocomplete/nsIAutoCompleteResult.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/components/autocomplete/nsIAutoCompleteResult.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,96 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "nsISupports.idl"
     1.9 +
    1.10 +[scriptable, uuid(9203c031-c4e7-4537-a4ec-81443d623d5a)]
    1.11 +interface nsIAutoCompleteResult : nsISupports
    1.12 +{
    1.13 +  /**
    1.14 +   * Possible values for the searchResult attribute
    1.15 +   */
    1.16 +  const unsigned short RESULT_IGNORED = 1; /* indicates invalid searchString */
    1.17 +  const unsigned short RESULT_FAILURE = 2; /* indicates failure */
    1.18 +  const unsigned short RESULT_NOMATCH = 3; /* indicates success with no matches
    1.19 +                                              and that the search is complete */
    1.20 +  const unsigned short RESULT_SUCCESS = 4; /* indicates success with matches
    1.21 +                                              and that the search is complete */
    1.22 +  const unsigned short RESULT_NOMATCH_ONGOING = 5; /* indicates success 
    1.23 +                                                      with no matches
    1.24 +                                                      and that the search 
    1.25 +                                                      is still ongoing */
    1.26 +  const unsigned short RESULT_SUCCESS_ONGOING = 6; /* indicates success 
    1.27 +                                                      with matches
    1.28 +                                                      and that the search 
    1.29 +                                                      is still ongoing */
    1.30 +  /**
    1.31 +   * The original search string
    1.32 +   */
    1.33 +  readonly attribute AString searchString;
    1.34 +
    1.35 +  /**
    1.36 +   * The result of the search
    1.37 +   */
    1.38 +  readonly attribute unsigned short searchResult;
    1.39 +
    1.40 +  /**
    1.41 +   * Index of the default item that should be entered if none is selected
    1.42 +   */
    1.43 +  readonly attribute long defaultIndex;
    1.44 +
    1.45 +  /**
    1.46 +   * A string describing the cause of a search failure
    1.47 +   */
    1.48 +  readonly attribute AString errorDescription;
    1.49 +
    1.50 +  /**
    1.51 +   * The number of matches
    1.52 +   */
    1.53 +  readonly attribute unsigned long matchCount;
    1.54 +
    1.55 +  /**
    1.56 +   * If true, the results will not be displayed in the popup. However,
    1.57 +   * if a default index is specified, the default item will still be
    1.58 +   * completed in the input.
    1.59 +   */
    1.60 +  readonly attribute boolean typeAheadResult;
    1.61 +
    1.62 +  /**
    1.63 +   * Get the value of the result at the given index
    1.64 +   */
    1.65 +  AString getValueAt(in long index);
    1.66 +
    1.67 +  /**
    1.68 +   * This returns the string that is displayed in the dropdown
    1.69 +   */
    1.70 +  AString getLabelAt(in long index);
    1.71 +
    1.72 +  /**
    1.73 +   * Get the comment of the result at the given index
    1.74 +   */
    1.75 +  AString getCommentAt(in long index);
    1.76 +
    1.77 +  /**
    1.78 +   * Get the style hint for the result at the given index
    1.79 +   */
    1.80 +  AString getStyleAt(in long index);
    1.81 +
    1.82 +  /**
    1.83 +   * Get the image of the result at the given index
    1.84 +   */
    1.85 +  AString getImageAt(in long index);
    1.86 +
    1.87 +  /**
    1.88 +   * Get the final value that should be completed when the user confirms
    1.89 +   * the match at the given index.
    1.90 +   */
    1.91 +  AString getFinalCompleteValueAt(in long index);
    1.92 +
    1.93 +  /**
    1.94 +   * Remove the value at the given index from the autocomplete results.
    1.95 +   * If removeFromDb is set to true, the value should be removed from
    1.96 +   * persistent storage as well.
    1.97 +   */
    1.98 +  void removeValueAt(in long rowIndex, in boolean removeFromDb);
    1.99 +};

mercurial