1/* 2 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2010 Apple Inc. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: 8 * 9 * * Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * * Redistributions in binary form must reproduce the above 12 * copyright notice, this list of conditions and the following disclaimer 13 * in the documentation and/or other materials provided with the 14 * distribution. 15 * * Neither the name of Google Inc. nor the names of its 16 * contributors may be used to endorse or promote products derived from 17 * this software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32/** 33 * @interface 34 */ 35WebInspector.TextEditor = function() { }; 36 37WebInspector.TextEditor.Events = { 38 GutterClick: "gutterClick" 39}; 40 41WebInspector.TextEditor.prototype = { 42 /** 43 * @return {boolean} 44 */ 45 isClean: function() { }, 46 47 markClean: function() { }, 48 49 /* 50 * @param {number} lineNumber 51 * @param {number} column 52 * @return {?{x: number, y: number, height: number}} 53 */ 54 cursorPositionToCoordinates: function(lineNumber, column) { }, 55 56 /** 57 * @param {number} x 58 * @param {number} y 59 * @return {?WebInspector.TextRange} 60 */ 61 coordinatesToCursorPosition: function(x, y) { }, 62 63 /** 64 * @param {number} lineNumber 65 * @param {number} column 66 * @return {?{startColumn: number, endColumn: number, type: string}} 67 */ 68 tokenAtTextPosition: function(lineNumber, column) { }, 69 70 /** 71 * @param {string} mimeType 72 */ 73 set mimeType(mimeType) { }, 74 75 /** 76 * @param {boolean} readOnly 77 */ 78 setReadOnly: function(readOnly) { }, 79 80 /** 81 * @return {boolean} 82 */ 83 readOnly: function() { }, 84 85 /** 86 * @return {Element} 87 */ 88 defaultFocusedElement: function() { }, 89 90 /** 91 * @param {string} regex 92 * @param {string} cssClass 93 * @return {Object} 94 */ 95 highlightRegex: function(regex, cssClass) { }, 96 97 /** 98 * @param {WebInspector.TextRange} range 99 * @param {string} cssClass 100 * @return {Object} 101 */ 102 highlightRange: function(range, cssClass) { }, 103 104 /** 105 * @param {Object} highlightDescriptor 106 */ 107 removeHighlight: function(highlightDescriptor) { }, 108 109 /** 110 * @param {number} lineNumber 111 */ 112 revealLine: function(lineNumber) { }, 113 114 /** 115 * @param {number} lineNumber 116 * @param {boolean} disabled 117 * @param {boolean} conditional 118 */ 119 addBreakpoint: function(lineNumber, disabled, conditional) { }, 120 121 /** 122 * @param {number} lineNumber 123 */ 124 removeBreakpoint: function(lineNumber) { }, 125 126 /** 127 * @param {number} lineNumber 128 */ 129 setExecutionLine: function(lineNumber) { }, 130 131 clearExecutionLine: function() { }, 132 133 /** 134 * @param {number} lineNumber 135 * @param {Element} element 136 */ 137 addDecoration: function(lineNumber, element) { }, 138 139 /** 140 * @param {number} lineNumber 141 * @param {Element} element 142 */ 143 removeDecoration: function(lineNumber, element) { }, 144 145 /** 146 * @param {WebInspector.TextRange} range 147 */ 148 markAndRevealRange: function(range) { }, 149 150 /** 151 * @param {number} lineNumber 152 */ 153 highlightLine: function(lineNumber) { }, 154 155 clearLineHighlight: function() { }, 156 157 /** 158 * @return {Array.<Element>} 159 */ 160 elementsToRestoreScrollPositionsFor: function() { }, 161 162 /** 163 * @param {WebInspector.TextEditor} textEditor 164 */ 165 inheritScrollPositions: function(textEditor) { }, 166 167 beginUpdates: function() { }, 168 169 endUpdates: function() { }, 170 171 onResize: function() { }, 172 173 /** 174 * @param {WebInspector.TextRange} range 175 * @param {string} text 176 * @return {WebInspector.TextRange} 177 */ 178 editRange: function(range, text) { }, 179 180 /** 181 * @param {number} lineNumber 182 */ 183 scrollToLine: function(lineNumber) { }, 184 185 /** 186 * @return {WebInspector.TextRange} 187 */ 188 selection: function() { }, 189 190 /** 191 * @return {WebInspector.TextRange?} 192 */ 193 lastSelection: function() { }, 194 195 /** 196 * @param {WebInspector.TextRange} textRange 197 */ 198 setSelection: function(textRange) { }, 199 200 /** 201 * @param {WebInspector.TextRange} range 202 * @return {string} 203 */ 204 copyRange: function(range) { }, 205 206 /** 207 * @param {string} text 208 */ 209 setText: function(text) { }, 210 211 /** 212 * @return {string} 213 */ 214 text: function() { }, 215 216 /** 217 * @return {WebInspector.TextRange} 218 */ 219 range: function() { }, 220 221 /** 222 * @param {number} lineNumber 223 * @return {string} 224 */ 225 line: function(lineNumber) { }, 226 227 /** 228 * @return {number} 229 */ 230 get linesCount() { }, 231 232 /** 233 * @param {number} line 234 * @param {string} name 235 * @param {Object?} value 236 */ 237 setAttribute: function(line, name, value) { }, 238 239 /** 240 * @param {number} line 241 * @param {string} name 242 * @return {Object|null} value 243 */ 244 getAttribute: function(line, name) { }, 245 246 /** 247 * @param {number} line 248 * @param {string} name 249 */ 250 removeAttribute: function(line, name) { }, 251 252 wasShown: function() { }, 253 254 willHide: function() { } 255} 256 257/** 258 * @interface 259 */ 260WebInspector.TextEditorDelegate = function() 261{ 262} 263 264WebInspector.TextEditorDelegate.prototype = { 265 /** 266 * @param {WebInspector.TextRange} oldRange 267 * @param {WebInspector.TextRange} newRange 268 */ 269 onTextChanged: function(oldRange, newRange) { }, 270 271 /** 272 * @param {WebInspector.TextRange} textRange 273 */ 274 selectionChanged: function(textRange) { }, 275 276 /** 277 * @param {number} lineNumber 278 */ 279 scrollChanged: function(lineNumber) { }, 280 281 /** 282 * @param {WebInspector.ContextMenu} contextMenu 283 * @param {number} lineNumber 284 */ 285 populateLineGutterContextMenu: function(contextMenu, lineNumber) { }, 286 287 /** 288 * @param {WebInspector.ContextMenu} contextMenu 289 * @param {number} lineNumber 290 */ 291 populateTextAreaContextMenu: function(contextMenu, lineNumber) { }, 292 293 /** 294 * @param {string} hrefValue 295 * @param {boolean} isExternal 296 * @return {Element} 297 */ 298 createLink: function(hrefValue, isExternal) { } 299} 300