/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"
#include "nsISupportsArray.idl"

[scriptable, uuid(88DCFA80-062F-11d4-a449-B36A1A94C0FC)]
interface nsIAutoCompleteItem : nsISupports {
    /**
     * the result value
     * using AString to avoid excess allocations
     */
    attribute AString  value;    

    /**
     * an extra comment that will be
     * displayed next to the value but that
     * will not be part of the value
     * itself
     */
    attribute wstring comment;
    
    /**
     * class name used to define some style through
     * css like the colors, an icon url, etc...
     */
    attribute string className;
    
    /**
     * parameter use by the search engine
     */
    attribute nsISupports param;
};


[scriptable, uuid(88DCFA81-062F-11d4-a449-B36A1A94C0FC)]
interface nsIAutoCompleteResults : nsISupports {
    
    /**
     * the original search string
     */
    attribute wstring searchString;
    
    /**
     * Array of result items (nsIAutoCompleteItem)
     */
    attribute nsISupportsArray items;

    /**
     * Index (0 base) of the default item that
     * will be preselected and displayed
     */
    attribute long defaultItemIndex; 

    /**
     * param use by the the search engine
     */
    attribute nsISupports param; 
};

%{ C++
// {FE4FC780-063D-11d4-A449-D45A120774BC}
#define NS_AUTOCOMPLETERESULTS_CID \
{ 0xfe4fc780, 0x063d, 0x11d4, { 0xa4, 0x49, 0xd4, 0x5a, 0x12, 0x07, 0x74, 0xbc } }
#define NS_AUTOCOMPLETERESULTS_CONTRACTID  "@mozilla.org/autocomplete/results;1"

// {FE4FC781-063D-11d4-A449-D45A120774BC}
#define NS_AUTOCOMPLETEITEM_CID \
{ 0xfe4fc781, 0x063d, 0x11d4, { 0xa4, 0x49, 0xd4, 0x5a, 0x12, 0x07, 0x74, 0xbc } }
#define NS_AUTOCOMPLETEITEM_CONTRACTID  "@mozilla.org/autocomplete/item;1"
%}

