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
41/** @typedef {{lineNumber: number, event: !Event}} */
42WebInspector.TextEditor.GutterClickEventData;
43
44WebInspector.TextEditor.prototype = {
45
46    undo: function() { },
47
48    redo: function() { },
49
50    /**
51     * @return {boolean}
52     */
53    isClean: function() { },
54
55    markClean: function() { },
56
57    /**
58     * @return {string}
59     */
60    indent: function() { },
61
62    /**
63     * @param {number} lineNumber
64     * @param {number} column
65     * @return {?{x: number, y: number, height: number}}
66     */
67    cursorPositionToCoordinates: function(lineNumber, column) { return null; },
68
69    /**
70     * @param {number} x
71     * @param {number} y
72     * @return {?WebInspector.TextRange}
73     */
74    coordinatesToCursorPosition: function(x, y) { return null; },
75
76    /**
77     * @param {number} lineNumber
78     * @param {number} column
79     * @return {?{startColumn: number, endColumn: number, type: string}}
80     */
81    tokenAtTextPosition: function(lineNumber, column) { return null; },
82
83    /**
84     * @param {string} mimeType
85     */
86    setMimeType: function(mimeType) { },
87
88    /**
89     * @param {boolean} readOnly
90     */
91    setReadOnly: function(readOnly) { },
92
93    /**
94     * @return {boolean}
95     */
96    readOnly: function() { },
97
98    /**
99     * @return {!Element}
100     */
101    defaultFocusedElement: function() { },
102
103    /**
104     * @param {!WebInspector.TextRange} range
105     * @param {string} cssClass
106     * @return {!Object}
107     */
108    highlightRange: function(range, cssClass) { },
109
110    /**
111     * @param {!Object} highlightDescriptor
112     */
113    removeHighlight: function(highlightDescriptor) { },
114
115    /**
116     * @param {number} lineNumber
117     */
118    revealLine: function(lineNumber) { },
119
120    /**
121     * @param {number} lineNumber
122     * @param {boolean} disabled
123     * @param {boolean} conditional
124     */
125    addBreakpoint: function(lineNumber, disabled, conditional) { },
126
127    /**
128     * @param {number} lineNumber
129     */
130    removeBreakpoint: function(lineNumber) { },
131
132    /**
133     * @param {number} lineNumber
134     */
135    setExecutionLine: function(lineNumber) { },
136
137    clearExecutionLine: function() { },
138
139    /**
140     * @param {number} lineNumber
141     * @param {!Element} element
142     */
143    addDecoration: function(lineNumber, element) { },
144
145    /**
146     * @param {number} lineNumber
147     * @param {!Element} element
148     */
149    removeDecoration: function(lineNumber, element) { },
150
151    /**
152     * @param {!RegExp} regex
153     * @param {?WebInspector.TextRange} range
154     */
155    highlightSearchResults: function(regex, range) { },
156
157    /**
158     * @param {number} lineNumber
159     * @param {number=} columnNumber
160     */
161    highlightPosition: function(lineNumber, columnNumber) { },
162
163    clearPositionHighlight: function() { },
164
165    /**
166     * @return {!Array.<!Element>}
167     */
168    elementsToRestoreScrollPositionsFor: function() { },
169
170    /**
171     * @param {!WebInspector.TextEditor} textEditor
172     */
173    inheritScrollPositions: function(textEditor) { },
174
175    beginUpdates: function() { },
176
177    endUpdates: function() { },
178
179    onResize: function() { },
180
181    /**
182     * @param {!WebInspector.TextRange} range
183     * @param {string} text
184     * @return {!WebInspector.TextRange}
185     */
186    editRange: function(range, text) { },
187
188    /**
189     * @param {number} lineNumber
190     */
191    scrollToLine: function(lineNumber) { },
192
193    /**
194     * @return {number}
195     */
196    firstVisibleLine: function() { },
197
198    /**
199     * @return {number}
200     */
201    lastVisibleLine: function() { },
202
203    /**
204     * @return {!WebInspector.TextRange}
205     */
206    selection: function() { },
207
208    /**
209     * @return {?WebInspector.TextRange}
210     */
211    lastSelection: function() { },
212
213    /**
214     * @param {!WebInspector.TextRange} textRange
215     */
216    setSelection: function(textRange) { },
217
218    /**
219     * @param {!WebInspector.TextRange} range
220     * @return {string}
221     */
222    copyRange: function(range) { },
223
224    /**
225     * @param {string} text
226     */
227    setText: function(text) { },
228
229    /**
230     * @return {string}
231     */
232    text: function() { },
233
234    /**
235     * @return {!WebInspector.TextRange}
236     */
237    range: function() { },
238
239    /**
240     * @param {number} lineNumber
241     * @return {string}
242     */
243    line: function(lineNumber) { },
244
245    /**
246     * @return {number}
247     */
248    get linesCount() { },
249
250    /**
251     * @param {number} line
252     * @param {string} name
253     * @param {?Object} value
254     */
255    setAttribute: function(line, name, value) { },
256
257    /**
258     * @param {number} line
259     * @param {string} name
260     * @return {?Object} value
261     */
262    getAttribute: function(line, name) { },
263
264    /**
265     * @param {number} line
266     * @param {string} name
267     */
268    removeAttribute: function(line, name) { },
269
270    wasShown: function() { },
271
272    willHide: function() { },
273
274    /**
275     * @param {?WebInspector.CompletionDictionary} dictionary
276     */
277    setCompletionDictionary: function(dictionary) { },
278}
279
280/**
281 * @interface
282 */
283WebInspector.TextEditorDelegate = function()
284{
285}
286
287WebInspector.TextEditorDelegate.prototype = {
288    /**
289     * @param {!WebInspector.TextRange} oldRange
290     * @param {!WebInspector.TextRange} newRange
291     */
292    onTextChanged: function(oldRange, newRange) { },
293
294    /**
295     * @param {!WebInspector.TextRange} textRange
296     */
297    selectionChanged: function(textRange) { },
298
299    /**
300     * @param {number} lineNumber
301     */
302    scrollChanged: function(lineNumber) { },
303
304    editorFocused: function() { },
305
306    /**
307     * @param {!WebInspector.ContextMenu} contextMenu
308     * @param {number} lineNumber
309     */
310    populateLineGutterContextMenu: function(contextMenu, lineNumber) { },
311
312    /**
313     * @param {!WebInspector.ContextMenu} contextMenu
314     * @param {number} lineNumber
315     */
316    populateTextAreaContextMenu: function(contextMenu, lineNumber) { },
317
318    /**
319     * @param {string} hrefValue
320     * @param {boolean} isExternal
321     * @return {!Element}
322     */
323    createLink: function(hrefValue, isExternal) { }
324}
325