toolkit/components/typeaheadfind/nsITypeAheadFind.idl

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6
michael@0 7 /********************************* #includes *********************************/
michael@0 8
michael@0 9 #include "domstubs.idl" // nsIDOMElement, nsIDOMWindow
michael@0 10 #include "nsISupports.idl" // nsISupports
michael@0 11
michael@0 12
michael@0 13 /******************************** Declarations *******************************/
michael@0 14
michael@0 15 interface nsIDocShell;
michael@0 16
michael@0 17
michael@0 18 /****************************** nsTypeAheadFind ******************************/
michael@0 19
michael@0 20 [scriptable, uuid(0749a445-19d3-4eb9-9d66-78eca8c6f604)]
michael@0 21 interface nsITypeAheadFind : nsISupports
michael@0 22 {
michael@0 23 /****************************** Initializer ******************************/
michael@0 24
michael@0 25 /* Necessary initialization that can't happen in the constructor, either
michael@0 26 * because function calls here may fail, or because the docShell is
michael@0 27 * required. */
michael@0 28 void init(in nsIDocShell aDocShell);
michael@0 29
michael@0 30
michael@0 31 /***************************** Core functions ****************************/
michael@0 32
michael@0 33 /* Find aSearchString in page. If aLinksOnly is true, only search the page's
michael@0 34 * hyperlinks for the string. */
michael@0 35 unsigned short find(in AString aSearchString, in boolean aLinksOnly);
michael@0 36
michael@0 37 /* Find another match in the page. */
michael@0 38 unsigned short findAgain(in boolean findBackwards, in boolean aLinksOnly);
michael@0 39
michael@0 40
michael@0 41 /**************************** Helper functions ***************************/
michael@0 42
michael@0 43 /* Change searched docShell. This happens when e.g. we use the same
michael@0 44 * nsITypeAheadFind object to search different tabs. */
michael@0 45 void setDocShell(in nsIDocShell aDocShell);
michael@0 46
michael@0 47 /* Change the look of the the "found match" selection to aToggle, and repaint
michael@0 48 * the selection. */
michael@0 49 void setSelectionModeAndRepaint(in short toggle);
michael@0 50
michael@0 51 /* Collapse the "found match" selection to its start. Because not all
michael@0 52 * matches are owned by the same selection controller, this doesn't
michael@0 53 * necessarily happen automatically. */
michael@0 54 void collapseSelection();
michael@0 55
michael@0 56
michael@0 57 /******************************* Attributes ******************************/
michael@0 58
michael@0 59 readonly attribute AString searchString;
michael@0 60 // Most recent search string
michael@0 61 attribute boolean caseSensitive; // Searches are case sensitive
michael@0 62 readonly attribute nsIDOMElement foundLink;
michael@0 63 // Most recent elem found, if a link
michael@0 64 readonly attribute nsIDOMElement foundEditable;
michael@0 65 // Most recent elem found, if editable
michael@0 66 readonly attribute nsIDOMWindow currentWindow;
michael@0 67 // Window of most recent match
michael@0 68
michael@0 69
michael@0 70 /******************************* Constants *******************************/
michael@0 71
michael@0 72 /* Find return codes */
michael@0 73 const unsigned short FIND_FOUND = 0;
michael@0 74 // Successful find
michael@0 75 const unsigned short FIND_NOTFOUND = 1;
michael@0 76 // Unsuccessful find
michael@0 77 const unsigned short FIND_WRAPPED = 2;
michael@0 78 // Successful find, but wrapped around
michael@0 79 const unsigned short FIND_PENDING = 3;
michael@0 80 // Unknown status, find has not finished
michael@0 81
michael@0 82
michael@0 83 /*************************************************************************/
michael@0 84
michael@0 85 };
michael@0 86
michael@0 87
michael@0 88 /*****************************************************************************/

mercurial