toolkit/components/autocomplete/nsIAutoCompleteSimpleResult.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/components/autocomplete/nsIAutoCompleteSimpleResult.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,91 @@
     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 +#include "nsIAutoCompleteResult.idl"
    1.10 +
    1.11 +interface nsIAutoCompleteSimpleResultListener;
    1.12 +
    1.13 +/**
    1.14 + * This class implements nsIAutoCompleteResult and provides simple methods
    1.15 + * for setting the value and result items. It can be used whenever some basic
    1.16 + * auto complete results are needed that can be pre-generated and filled into
    1.17 + * an array.
    1.18 + */
    1.19 +
    1.20 +[scriptable, uuid(fe8802f9-c2b7-4141-8e5b-280df3f62251)]
    1.21 +interface nsIAutoCompleteSimpleResult : nsIAutoCompleteResult
    1.22 +{
    1.23 +  /**
    1.24 +   * A writer for the readonly attribute 'searchString' which should contain
    1.25 +   * the string that the user typed.
    1.26 +   */
    1.27 +  void setSearchString(in AString aSearchString);
    1.28 +
    1.29 +  /**
    1.30 +   * A writer for the readonly attribute 'errorDescription'.
    1.31 +   */
    1.32 +  void setErrorDescription(in AString aErrorDescription);
    1.33 +
    1.34 +  /**
    1.35 +   * A writer for the readonly attribute 'defaultIndex' which should contain
    1.36 +   * the index of the list that will be selected by default (normally 0).
    1.37 +   */
    1.38 +  void setDefaultIndex(in long aDefaultIndex);
    1.39 +
    1.40 +  /**
    1.41 +   * A writer for the readonly attribute 'searchResult' which should contain
    1.42 +   * one of the constants nsIAutoCompleteResult.RESULT_* indicating the success
    1.43 +   * of the search.
    1.44 +   */
    1.45 +  void setSearchResult(in unsigned short aSearchResult);
    1.46 +
    1.47 +  /**
    1.48 +   * A writer for the readonly attribute 'typeAheadResult', typically set
    1.49 +   * because a result is only intended for type-ahead completion.
    1.50 +   */
    1.51 +  void setTypeAheadResult(in boolean aHidden);
    1.52 +
    1.53 +  /**
    1.54 +   * Appends a match consisting of the given value, comment, image, style and
    1.55 +   * the value to use for defaultIndex completion.
    1.56 +   * @param aValue
    1.57 +   *        The value to autocomplete to
    1.58 +   * @param aComment
    1.59 +   *        Comment shown in the autocomplete widget to describe this match
    1.60 +   * @param aImage
    1.61 +   *        Image shown in the autocomplete widget for this match.
    1.62 +   * @param aStyle
    1.63 +   *        Describes how to style the match in the autocomplete widget
    1.64 +   * @param aFinalCompleteValue
    1.65 +   *        Value used when the user confirms selecting this match. If not
    1.66 +   *        provided, aValue will be used.
    1.67 +   */
    1.68 +  void appendMatch(in AString aValue,
    1.69 +                   in AString aComment,
    1.70 +                   [optional] in AString aImage,
    1.71 +                   [optional] in AString aStyle,
    1.72 +                   [optional] in AString aFinalCompleteValue);
    1.73 +
    1.74 +  /**
    1.75 +   * Sets a listener for changes in the result.
    1.76 +   */
    1.77 +  void setListener(in nsIAutoCompleteSimpleResultListener aListener);
    1.78 +};
    1.79 +
    1.80 +[scriptable, uuid(004efdc5-1989-4874-8a7a-345bf2fa33af)]
    1.81 +interface nsIAutoCompleteSimpleResultListener : nsISupports
    1.82 +{
    1.83 +  /**
    1.84 +   * Dispatched after a value is removed from the result.
    1.85 +   * @param aResult
    1.86 +   *        The result from which aValue has been removed.
    1.87 +   * @param aValue
    1.88 +   *        The removed value.
    1.89 +   * @param aRemoveFromDb
    1.90 +   *        Whether the value should be removed from persistent storage as well.
    1.91 +   */
    1.92 +  void onValueRemoved(in nsIAutoCompleteSimpleResult aResult, in AString aValue,
    1.93 +                      in boolean aRemoveFromDb);
    1.94 +};

mercurial