Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 | #include "nsISupports.idl" |
michael@0 | 7 | |
michael@0 | 8 | interface nsITreeBoxObject; |
michael@0 | 9 | interface nsITreeSelection; |
michael@0 | 10 | interface nsITreeColumn; |
michael@0 | 11 | interface nsIDOMDataTransfer; |
michael@0 | 12 | |
michael@0 | 13 | [scriptable, uuid(091116f0-0bdc-4b32-b9c8-c8d5a37cb088)] |
michael@0 | 14 | interface nsITreeView : nsISupports |
michael@0 | 15 | { |
michael@0 | 16 | /** |
michael@0 | 17 | * The total number of rows in the tree (including the offscreen rows). |
michael@0 | 18 | */ |
michael@0 | 19 | readonly attribute long rowCount; |
michael@0 | 20 | |
michael@0 | 21 | /** |
michael@0 | 22 | * The selection for this view. |
michael@0 | 23 | */ |
michael@0 | 24 | attribute nsITreeSelection selection; |
michael@0 | 25 | |
michael@0 | 26 | /** |
michael@0 | 27 | * A whitespace delimited list of properties. For each property X the view |
michael@0 | 28 | * gives back will cause the pseudoclasses ::-moz-tree-cell(x), |
michael@0 | 29 | * ::-moz-tree-row(x), ::-moz-tree-twisty(x), ::-moz-tree-image(x), |
michael@0 | 30 | * ::-moz-tree-cell-text(x). to be matched on the pseudoelement |
michael@0 | 31 | * ::moz-tree-row. |
michael@0 | 32 | */ |
michael@0 | 33 | AString getRowProperties(in long index); |
michael@0 | 34 | |
michael@0 | 35 | /** |
michael@0 | 36 | * A whitespace delimited list of properties for a given cell. Each |
michael@0 | 37 | * property, x, that the view gives back will cause the pseudoclasses |
michael@0 | 38 | * ::-moz-tree-cell(x), ::-moz-tree-row(x), ::-moz-tree-twisty(x), |
michael@0 | 39 | * ::-moz-tree-image(x), ::-moz-tree-cell-text(x). to be matched on the |
michael@0 | 40 | * cell. |
michael@0 | 41 | */ |
michael@0 | 42 | AString getCellProperties(in long row, in nsITreeColumn col); |
michael@0 | 43 | |
michael@0 | 44 | /** |
michael@0 | 45 | * Called to get properties to paint a column background. For shading the sort |
michael@0 | 46 | * column, etc. |
michael@0 | 47 | */ |
michael@0 | 48 | AString getColumnProperties(in nsITreeColumn col); |
michael@0 | 49 | |
michael@0 | 50 | /** |
michael@0 | 51 | * Methods that can be used to test whether or not a twisty should be drawn, |
michael@0 | 52 | * and if so, whether an open or closed twisty should be used. |
michael@0 | 53 | */ |
michael@0 | 54 | boolean isContainer(in long index); |
michael@0 | 55 | boolean isContainerOpen(in long index); |
michael@0 | 56 | boolean isContainerEmpty(in long index); |
michael@0 | 57 | |
michael@0 | 58 | /** |
michael@0 | 59 | * isSeparator is used to determine if the row at index is a separator. |
michael@0 | 60 | * A value of true will result in the tree drawing a horizontal separator. |
michael@0 | 61 | * The tree uses the ::moz-tree-separator pseudoclass to draw the separator. |
michael@0 | 62 | */ |
michael@0 | 63 | boolean isSeparator(in long index); |
michael@0 | 64 | |
michael@0 | 65 | /** |
michael@0 | 66 | * Specifies if there is currently a sort on any column. Used mostly by dragdrop |
michael@0 | 67 | * to affect drop feedback. |
michael@0 | 68 | */ |
michael@0 | 69 | boolean isSorted(); |
michael@0 | 70 | |
michael@0 | 71 | const short DROP_BEFORE = -1; |
michael@0 | 72 | const short DROP_ON = 0; |
michael@0 | 73 | const short DROP_AFTER = 1; |
michael@0 | 74 | /** |
michael@0 | 75 | * Methods used by the drag feedback code to determine if a drag is allowable at |
michael@0 | 76 | * the current location. To get the behavior where drops are only allowed on |
michael@0 | 77 | * items, such as the mailNews folder pane, always return false when |
michael@0 | 78 | * the orientation is not DROP_ON. |
michael@0 | 79 | */ |
michael@0 | 80 | boolean canDrop(in long index, in long orientation, in nsIDOMDataTransfer dataTransfer); |
michael@0 | 81 | |
michael@0 | 82 | /** |
michael@0 | 83 | * Called when the user drops something on this view. The |orientation| param |
michael@0 | 84 | * specifies before/on/after the given |row|. |
michael@0 | 85 | */ |
michael@0 | 86 | void drop(in long row, in long orientation, in nsIDOMDataTransfer dataTransfer); |
michael@0 | 87 | |
michael@0 | 88 | /** |
michael@0 | 89 | * Methods used by the tree to draw thread lines in the tree. |
michael@0 | 90 | * getParentIndex is used to obtain the index of a parent row. |
michael@0 | 91 | * If there is no parent row, getParentIndex returns -1. |
michael@0 | 92 | */ |
michael@0 | 93 | long getParentIndex(in long rowIndex); |
michael@0 | 94 | |
michael@0 | 95 | /** |
michael@0 | 96 | * hasNextSibling is used to determine if the row at rowIndex has a nextSibling |
michael@0 | 97 | * that occurs *after* the index specified by afterIndex. Code that is forced |
michael@0 | 98 | * to march down the view looking at levels can optimize the march by starting |
michael@0 | 99 | * at afterIndex+1. |
michael@0 | 100 | */ |
michael@0 | 101 | boolean hasNextSibling(in long rowIndex, in long afterIndex); |
michael@0 | 102 | |
michael@0 | 103 | /** |
michael@0 | 104 | * The level is an integer value that represents |
michael@0 | 105 | * the level of indentation. It is multiplied by the width specified in the |
michael@0 | 106 | * :moz-tree-indentation pseudoelement to compute the exact indendation. |
michael@0 | 107 | */ |
michael@0 | 108 | long getLevel(in long index); |
michael@0 | 109 | |
michael@0 | 110 | /** |
michael@0 | 111 | * The image path for a given cell. For defining an icon for a cell. |
michael@0 | 112 | * If the empty string is returned, the :moz-tree-image pseudoelement |
michael@0 | 113 | * will be used. |
michael@0 | 114 | */ |
michael@0 | 115 | AString getImageSrc(in long row, in nsITreeColumn col); |
michael@0 | 116 | |
michael@0 | 117 | /** |
michael@0 | 118 | * The progress mode for a given cell. This method is only called for |
michael@0 | 119 | * columns of type |progressmeter|. |
michael@0 | 120 | */ |
michael@0 | 121 | const short PROGRESS_NORMAL = 1; |
michael@0 | 122 | const short PROGRESS_UNDETERMINED = 2; |
michael@0 | 123 | const short PROGRESS_NONE = 3; |
michael@0 | 124 | long getProgressMode(in long row, in nsITreeColumn col); |
michael@0 | 125 | |
michael@0 | 126 | /** |
michael@0 | 127 | * The value for a given cell. This method is only called for columns |
michael@0 | 128 | * of type other than |text|. |
michael@0 | 129 | */ |
michael@0 | 130 | AString getCellValue(in long row, in nsITreeColumn col); |
michael@0 | 131 | |
michael@0 | 132 | /** |
michael@0 | 133 | * The text for a given cell. If a column consists only of an image, then |
michael@0 | 134 | * the empty string is returned. |
michael@0 | 135 | */ |
michael@0 | 136 | AString getCellText(in long row, in nsITreeColumn col); |
michael@0 | 137 | |
michael@0 | 138 | /** |
michael@0 | 139 | * Called during initialization to link the view to the front end box object. |
michael@0 | 140 | */ |
michael@0 | 141 | void setTree(in nsITreeBoxObject tree); |
michael@0 | 142 | |
michael@0 | 143 | /** |
michael@0 | 144 | * Called on the view when an item is opened or closed. |
michael@0 | 145 | */ |
michael@0 | 146 | void toggleOpenState(in long index); |
michael@0 | 147 | |
michael@0 | 148 | /** |
michael@0 | 149 | * Called on the view when a header is clicked. |
michael@0 | 150 | */ |
michael@0 | 151 | void cycleHeader(in nsITreeColumn col); |
michael@0 | 152 | |
michael@0 | 153 | /** |
michael@0 | 154 | * Should be called from a XUL onselect handler whenever the selection changes. |
michael@0 | 155 | */ |
michael@0 | 156 | void selectionChanged(); |
michael@0 | 157 | |
michael@0 | 158 | /** |
michael@0 | 159 | * Called on the view when a cell in a non-selectable cycling column (e.g., unread/flag/etc.) is clicked. |
michael@0 | 160 | */ |
michael@0 | 161 | void cycleCell(in long row, in nsITreeColumn col); |
michael@0 | 162 | |
michael@0 | 163 | /** |
michael@0 | 164 | * isEditable is called to ask the view if the cell contents are editable. |
michael@0 | 165 | * A value of true will result in the tree popping up a text field when |
michael@0 | 166 | * the user tries to inline edit the cell. |
michael@0 | 167 | */ |
michael@0 | 168 | boolean isEditable(in long row, in nsITreeColumn col); |
michael@0 | 169 | |
michael@0 | 170 | /** |
michael@0 | 171 | * isSelectable is called to ask the view if the cell is selectable. |
michael@0 | 172 | * This method is only called if the selection style is |cell| or |text|. |
michael@0 | 173 | * XXXvarga shouldn't this be called isCellSelectable? |
michael@0 | 174 | */ |
michael@0 | 175 | boolean isSelectable(in long row, in nsITreeColumn col); |
michael@0 | 176 | |
michael@0 | 177 | /** |
michael@0 | 178 | * setCellValue is called when the value of the cell has been set by the user. |
michael@0 | 179 | * This method is only called for columns of type other than |text|. |
michael@0 | 180 | */ |
michael@0 | 181 | void setCellValue(in long row, in nsITreeColumn col, in AString value); |
michael@0 | 182 | |
michael@0 | 183 | /** |
michael@0 | 184 | * setCellText is called when the contents of the cell have been edited by the user. |
michael@0 | 185 | */ |
michael@0 | 186 | void setCellText(in long row, in nsITreeColumn col, in AString value); |
michael@0 | 187 | |
michael@0 | 188 | /** |
michael@0 | 189 | * A command API that can be used to invoke commands on the selection. The tree |
michael@0 | 190 | * will automatically invoke this method when certain keys are pressed. For example, |
michael@0 | 191 | * when the DEL key is pressed, performAction will be called with the "delete" string. |
michael@0 | 192 | */ |
michael@0 | 193 | void performAction(in wstring action); |
michael@0 | 194 | |
michael@0 | 195 | /** |
michael@0 | 196 | * A command API that can be used to invoke commands on a specific row. |
michael@0 | 197 | */ |
michael@0 | 198 | void performActionOnRow(in wstring action, in long row); |
michael@0 | 199 | |
michael@0 | 200 | /** |
michael@0 | 201 | * A command API that can be used to invoke commands on a specific cell. |
michael@0 | 202 | */ |
michael@0 | 203 | void performActionOnCell(in wstring action, in long row, in nsITreeColumn col); |
michael@0 | 204 | }; |
michael@0 | 205 | |
michael@0 | 206 | /** |
michael@0 | 207 | * The following interface is not scriptable and MUST NEVER BE MADE scriptable. |
michael@0 | 208 | * Native treeviews implement it, and we use this to check whether a treeview |
michael@0 | 209 | * is native (and therefore suitable for use by untrusted content). |
michael@0 | 210 | */ |
michael@0 | 211 | [uuid(46c90265-6553-41ae-8d39-7022e7d09145)] |
michael@0 | 212 | interface nsINativeTreeView : nsITreeView |
michael@0 | 213 | { |
michael@0 | 214 | [noscript] void ensureNative(); |
michael@0 | 215 | }; |