Home | History | Annotate | Download | only in ui
      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  */
     35 WebInspector.TextEditor = function() { };
     36 
     37 WebInspector.TextEditor.Events = {
     38     GutterClick: "gutterClick"
     39 };
     40 
     41 /** @typedef {{lineNumber: number, event: !Event}} */
     42 WebInspector.TextEditor.GutterClickEventData;
     43 
     44 WebInspector.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      * @param {boolean} disabled
    118      * @param {boolean} conditional
    119      */
    120     addBreakpoint: function(lineNumber, disabled, conditional) { },
    121 
    122     /**
    123      * @param {number} lineNumber
    124      */
    125     removeBreakpoint: function(lineNumber) { },
    126 
    127     /**
    128      * @param {number} lineNumber
    129      */
    130     setExecutionLine: function(lineNumber) { },
    131 
    132     clearExecutionLine: function() { },
    133 
    134     /**
    135      * @param {number} lineNumber
    136      * @param {!Element} element
    137      */
    138     addDecoration: function(lineNumber, element) { },
    139 
    140     /**
    141      * @param {number} lineNumber
    142      * @param {!Element} element
    143      */
    144     removeDecoration: function(lineNumber, element) { },
    145 
    146     /**
    147      * @param {!RegExp} regex
    148      * @param {?WebInspector.TextRange} range
    149      */
    150     highlightSearchResults: function(regex, range) { },
    151 
    152     /**
    153      * @param {number} lineNumber
    154      * @param {number=} columnNumber
    155      * @param {boolean=} shouldHighlight
    156      */
    157     revealPosition: function(lineNumber, columnNumber, shouldHighlight) { },
    158 
    159     clearPositionHighlight: function() { },
    160 
    161     /**
    162      * @return {!Array.<!Element>}
    163      */
    164     elementsToRestoreScrollPositionsFor: function() { },
    165 
    166     /**
    167      * @param {!WebInspector.TextEditor} textEditor
    168      */
    169     inheritScrollPositions: function(textEditor) { },
    170 
    171     beginUpdates: function() { },
    172 
    173     endUpdates: function() { },
    174 
    175     onResize: function() { },
    176 
    177     /**
    178      * @param {!WebInspector.TextRange} range
    179      * @param {string} text
    180      * @return {!WebInspector.TextRange}
    181      */
    182     editRange: function(range, text) { },
    183 
    184     /**
    185      * @param {number} lineNumber
    186      */
    187     scrollToLine: function(lineNumber) { },
    188 
    189     /**
    190      * @return {number}
    191      */
    192     firstVisibleLine: function() { },
    193 
    194     /**
    195      * @return {number}
    196      */
    197     lastVisibleLine: function() { },
    198 
    199     /**
    200      * @return {!WebInspector.TextRange}
    201      */
    202     selection: function() { },
    203 
    204     /**
    205      * @return {!Array.<!WebInspector.TextRange>}
    206      */
    207     selections: function() { },
    208 
    209     /**
    210      * @return {?WebInspector.TextRange}
    211      */
    212     lastSelection: function() { },
    213 
    214     /**
    215      * @param {!WebInspector.TextRange} textRange
    216      */
    217     setSelection: function(textRange) { },
    218 
    219     /**
    220      * @param {!WebInspector.TextRange} range
    221      * @return {string}
    222      */
    223     copyRange: function(range) { },
    224 
    225     /**
    226      * @param {string} text
    227      */
    228     setText: function(text) { },
    229 
    230     /**
    231      * @return {string}
    232      */
    233     text: function() { },
    234 
    235     /**
    236      * @return {!WebInspector.TextRange}
    237      */
    238     range: function() { },
    239 
    240     /**
    241      * @param {number} lineNumber
    242      * @return {string}
    243      */
    244     line: function(lineNumber) { },
    245 
    246     /**
    247      * @return {number}
    248      */
    249     get linesCount() { },
    250 
    251     /**
    252      * @param {number} line
    253      * @param {string} name
    254      * @param {?Object} value
    255      */
    256     setAttribute: function(line, name, value) { },
    257 
    258     /**
    259      * @param {number} line
    260      * @param {string} name
    261      * @return {?Object} value
    262      */
    263     getAttribute: function(line, name) { },
    264 
    265     /**
    266      * @param {number} line
    267      * @param {string} name
    268      */
    269     removeAttribute: function(line, name) { },
    270 
    271     wasShown: function() { },
    272 
    273     willHide: function() { },
    274 
    275     /**
    276      * @param {?WebInspector.CompletionDictionary} dictionary
    277      */
    278     setCompletionDictionary: function(dictionary) { },
    279 
    280     /**
    281      * @param {number} lineNumber
    282      * @param {number} columnNumber
    283      * @return {?WebInspector.TextEditorPositionHandle}
    284      */
    285     textEditorPositionHandle: function(lineNumber, columnNumber) { },
    286 
    287     dispose: function() { }
    288 }
    289 
    290 /**
    291  * @interface
    292  */
    293 WebInspector.TextEditorPositionHandle = function()
    294 {
    295 }
    296 
    297 WebInspector.TextEditorPositionHandle.prototype = {
    298     /**
    299      * @return {?{lineNumber: number, columnNumber: number}}
    300      */
    301     resolve: function() { },
    302 
    303     /**
    304      * @param {!WebInspector.TextEditorPositionHandle} positionHandle
    305      * @return {boolean}
    306      */
    307     equal: function(positionHandle) { }
    308 }
    309 
    310 /**
    311  * @interface
    312  */
    313 WebInspector.TextEditorDelegate = function()
    314 {
    315 }
    316 
    317 WebInspector.TextEditorDelegate.prototype = {
    318     /**
    319      * @param {!WebInspector.TextRange} oldRange
    320      * @param {!WebInspector.TextRange} newRange
    321      */
    322     onTextChanged: function(oldRange, newRange) { },
    323 
    324     /**
    325      * @param {!WebInspector.TextRange} textRange
    326      */
    327     selectionChanged: function(textRange) { },
    328 
    329     /**
    330      * @param {number} lineNumber
    331      */
    332     scrollChanged: function(lineNumber) { },
    333 
    334     editorFocused: function() { },
    335 
    336     /**
    337      * @param {!WebInspector.ContextMenu} contextMenu
    338      * @param {number} lineNumber
    339      */
    340     populateLineGutterContextMenu: function(contextMenu, lineNumber) { },
    341 
    342     /**
    343      * @param {!WebInspector.ContextMenu} contextMenu
    344      * @param {number} lineNumber
    345      */
    346     populateTextAreaContextMenu: function(contextMenu, lineNumber) { },
    347 
    348     /**
    349      * @param {string} hrefValue
    350      * @param {boolean} isExternal
    351      * @return {!Element}
    352      */
    353     createLink: function(hrefValue, isExternal) { },
    354 
    355     /**
    356      * @param {?WebInspector.TextRange} from
    357      * @param {?WebInspector.TextRange} to
    358      */
    359     onJumpToPosition: function(from, to) { }
    360 }
    361 
    362 /**
    363  * @interface
    364  */
    365 WebInspector.TokenizerFactory = function() { }
    366 
    367 WebInspector.TokenizerFactory.prototype = {
    368     /**
    369      * @param {string} mimeType
    370      * @return {function(string, function(string, ?string, number, number))}
    371      */
    372     createTokenizer: function(mimeType) { }
    373 }