Home | History | Annotate | Download | only in WebView
      1 /*
      2  * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.  All rights reserved.
      3  *
      4  * Redistribution and use in source and binary forms, with or without
      5  * modification, are permitted provided that the following conditions
      6  * are met:
      7  *
      8  * 1.  Redistributions of source code must retain the above copyright
      9  *     notice, this list of conditions and the following disclaimer.
     10  * 2.  Redistributions in binary form must reproduce the above copyright
     11  *     notice, this list of conditions and the following disclaimer in the
     12  *     documentation and/or other materials provided with the distribution.
     13  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
     14  *     its contributors may be used to endorse or promote products derived
     15  *     from this software without specific prior written permission.
     16  *
     17  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
     18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     20  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
     21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
     24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27  */
     28 
     29 #import <Cocoa/Cocoa.h>
     30 
     31 #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
     32 #define WebNSInteger int
     33 #else
     34 #define WebNSInteger NSInteger
     35 #endif
     36 
     37 @class DOMCSSStyleDeclaration;
     38 @class DOMDocument;
     39 @class DOMElement;
     40 @class DOMNode;
     41 @class DOMRange;
     42 
     43 @class WebArchive;
     44 @class WebBackForwardList;
     45 @class WebDataSource;
     46 @class WebFrame;
     47 @class WebFrameView;
     48 @class WebHistoryItem;
     49 @class WebPreferences;
     50 @class WebScriptObject;
     51 @class WebViewPrivate;
     52 
     53 // Element dictionary keys
     54 extern NSString *WebElementDOMNodeKey;          // DOMNode of the element
     55 extern NSString *WebElementFrameKey;            // WebFrame of the element
     56 extern NSString *WebElementImageAltStringKey;   // NSString of the ALT attribute of the image element
     57 extern NSString *WebElementImageKey;            // NSImage of the image element
     58 extern NSString *WebElementImageRectKey;        // NSValue of an NSRect, the rect of the image element
     59 extern NSString *WebElementImageURLKey;         // NSURL of the image element
     60 extern NSString *WebElementIsSelectedKey;       // NSNumber of BOOL indicating whether the element is selected or not
     61 extern NSString *WebElementLinkURLKey;          // NSURL of the link if the element is within an anchor
     62 extern NSString *WebElementLinkTargetFrameKey;  // WebFrame of the target of the anchor
     63 extern NSString *WebElementLinkTitleKey;        // NSString of the title of the anchor
     64 extern NSString *WebElementLinkLabelKey;        // NSString of the text within the anchor
     65 
     66 /*
     67     @discussion Notifications sent by WebView to mark the progress of loads.
     68     @constant WebViewProgressStartedNotification Posted whenever a load begins in the WebView, including
     69     a load that is initiated in a subframe.  After receiving this notification zero or more
     70     WebViewProgressEstimateChangedNotifications will be sent.  The userInfo will be nil.
     71     @constant WebViewProgressEstimateChangedNotification Posted whenever the value of
     72     estimatedProgress changes.  The userInfo will be nil.
     73     @constant WebViewProgressFinishedNotification Posted when the load for a WebView has finished.
     74     The userInfo will be nil.
     75 */
     76 extern NSString *WebViewProgressStartedNotification;
     77 extern NSString *WebViewProgressEstimateChangedNotification;
     78 extern NSString *WebViewProgressFinishedNotification;
     79 
     80 /*!
     81     @class WebView
     82     WebView manages the interaction between WebFrameViews and WebDataSources.  Modification
     83     of the policies and behavior of the WebKit is largely managed by WebViews and their
     84     delegates.
     85 
     86     <p>
     87     Typical usage:
     88     </p>
     89     <pre>
     90     WebView *webView;
     91     WebFrame *mainFrame;
     92 
     93     webView  = [[WebView alloc] initWithFrame: NSMakeRect (0,0,640,480)];
     94     mainFrame = [webView mainFrame];
     95     [mainFrame loadRequest:request];
     96     </pre>
     97 
     98     WebViews have the following delegates:  WebUIDelegate, WebResourceLoadDelegate,
     99     WebFrameLoadDelegate, and WebPolicyDelegate.
    100 
    101     WebKit depends on the WebView's WebUIDelegate for all window
    102     related management, including opening new windows and controlling the user interface
    103     elements in those windows.
    104 
    105     WebResourceLoadDelegate is used to monitor the progress of resources as they are
    106     loaded.  This delegate may be used to present users with a progress monitor.
    107 
    108     The WebFrameLoadDelegate receives messages when the URL in a WebFrame is
    109     changed.
    110 
    111     WebView's WebPolicyDelegate can make determinations about how
    112     content should be handled, based on the resource's URL and MIME type.
    113 */
    114 @interface WebView : NSView
    115 {
    116 @private
    117     WebViewPrivate *_private;
    118 }
    119 
    120 /*!
    121     @method canShowMIMEType:
    122     @abstract Checks if the WebKit can show content of a certain MIME type.
    123     @param MIMEType The MIME type to check.
    124     @result YES if the WebKit can show content with MIMEtype.
    125 */
    126 + (BOOL)canShowMIMEType:(NSString *)MIMEType;
    127 
    128 
    129 /*!
    130      @method canShowMIMETypeAsHTML:
    131      @abstract Checks if the the MIME type is a type that the WebKit will interpret as HTML.
    132      @param MIMEType The MIME type to check.
    133      @result YES if the MIMEtype in an HTML type.
    134 */
    135 + (BOOL)canShowMIMETypeAsHTML:(NSString *)MIMEType;
    136 
    137 /*!
    138     @method MIMETypesShownAsHTML
    139     @result Returns an array of NSStrings that describe the MIME types
    140     WebKit will attempt to render as HTML.
    141 */
    142 + (NSArray *)MIMETypesShownAsHTML;
    143 
    144 /*!
    145     @method setMIMETypesShownAsHTML:
    146     @discussion Sets the array of NSString MIME types that WebKit will
    147     attempt to render as HTML.  Typically you will retrieve the built-in
    148     array using MIMETypesShownAsHTML and add additional MIME types to that
    149     array.
    150 */
    151 + (void)setMIMETypesShownAsHTML:(NSArray *)MIMETypes;
    152 
    153 /*!
    154     @method URLFromPasteboard:
    155     @abstract Returns a URL from a pasteboard
    156     @param pasteboard The pasteboard with a URL
    157     @result A URL if the pasteboard has one. Nil if it does not.
    158     @discussion This method differs than NSURL's URLFromPasteboard method in that it tries multiple pasteboard types
    159     including NSURLPboardType to find a URL on the pasteboard.
    160 */
    161 + (NSURL *)URLFromPasteboard:(NSPasteboard *)pasteboard;
    162 
    163 /*!
    164     @method URLTitleFromPasteboard:
    165     @abstract Returns a URL title from a pasteboard
    166     @param pasteboard The pasteboard with a URL title
    167     @result A URL title if the pasteboard has one. Nil if it does not.
    168     @discussion This method returns a title that refers a URL on the pasteboard. An example of this is the link label
    169     which is the text inside the anchor tag.
    170 */
    171 + (NSString *)URLTitleFromPasteboard:(NSPasteboard *)pasteboard;
    172 
    173 /*!
    174     @method registerURLSchemeAsLocal:
    175     @abstract Adds the scheme to the list of schemes to be treated as local.
    176     @param scheme The scheme to register
    177 */
    178 + (void)registerURLSchemeAsLocal:(NSString *)scheme;
    179 
    180 /*!
    181     @method initWithFrame:frameName:groupName:
    182     @abstract The designated initializer for WebView.
    183     @discussion Initialize a WebView with the supplied parameters. This method will
    184     create a main WebFrame with the view. Passing a top level frame name is useful if you
    185     handle a targetted frame navigation that would normally open a window in some other
    186     way that still ends up creating a new WebView.
    187     @param frame The frame used to create the view.
    188     @param frameName The name to use for the top level frame. May be nil.
    189     @param groupName The name of the webView set to which this webView will be added.  May be nil.
    190     @result Returns an initialized WebView.
    191 */
    192 - (id)initWithFrame:(NSRect)frame frameName:(NSString *)frameName groupName:(NSString *)groupName;
    193 
    194 /*!
    195     @method close
    196     @abstract Closes the receiver, unloading its web page and canceling any pending loads.
    197     Once the receiver has closed, it will no longer respond to requests or fire delegate methods.
    198     (However, the -close method itself may fire delegate methods.)
    199     @discussion A garbage collected application is required to call close when the receiver is no longer needed.
    200     The close method will be called automatically when the window or hostWindow closes and shouldCloseWithWindow returns YES.
    201     A non-garbage collected application can still call close, providing a convenient way to prevent receiver
    202     from doing any more loading and firing any future delegate methods.
    203 */
    204 - (void)close;
    205 
    206 /*!
    207     @method setShouldCloseWithWindow:
    208     @abstract Set whether the receiver closes when either it's window or hostWindow closes.
    209     @param close YES if the receiver should close when either it's window or hostWindow closes, otherwise NO.
    210 */
    211 - (void)setShouldCloseWithWindow:(BOOL)close;
    212 
    213 /*!
    214     @method shouldCloseWithWindow
    215     @abstract Returns whether the receiver closes when either it's window or hostWindow closes.
    216     @discussion Defaults to YES in garbage collected applications, otherwise NO to maintain backwards compatibility.
    217     @result YES if the receiver closes when either it's window or hostWindow closes, otherwise NO.
    218 */
    219 - (BOOL)shouldCloseWithWindow;
    220 
    221 /*!
    222     @method setUIDelegate:
    223     @abstract Set the WebView's WebUIDelegate.
    224     @param delegate The WebUIDelegate to set as the delegate.
    225 */
    226 - (void)setUIDelegate:(id)delegate;
    227 
    228 /*!
    229     @method UIDelegate
    230     @abstract Return the WebView's WebUIDelegate.
    231     @result The WebView's WebUIDelegate.
    232 */
    233 - (id)UIDelegate;
    234 
    235 /*!
    236     @method setResourceLoadDelegate:
    237     @abstract Set the WebView's WebResourceLoadDelegate load delegate.
    238     @param delegate The WebResourceLoadDelegate to set as the load delegate.
    239 */
    240 - (void)setResourceLoadDelegate:(id)delegate;
    241 
    242 /*!
    243     @method resourceLoadDelegate
    244     @result Return the WebView's WebResourceLoadDelegate.
    245 */
    246 - (id)resourceLoadDelegate;
    247 
    248 /*!
    249     @method setDownloadDelegate:
    250     @abstract Set the WebView's WebDownloadDelegate.
    251     @discussion The download delegate is retained by WebDownload when any downloads are in progress.
    252     @param delegate The WebDownloadDelegate to set as the download delegate.
    253 */
    254 - (void)setDownloadDelegate:(id)delegate;
    255 
    256 /*!
    257     @method downloadDelegate
    258     @abstract Return the WebView's WebDownloadDelegate.
    259     @result The WebView's WebDownloadDelegate.
    260 */
    261 - (id)downloadDelegate;
    262 
    263 /*!
    264     @method setFrameLoadDelegate:
    265     @abstract Set the WebView's WebFrameLoadDelegate delegate.
    266     @param delegate The WebFrameLoadDelegate to set as the delegate.
    267 */
    268 - (void)setFrameLoadDelegate:(id)delegate;
    269 
    270 /*!
    271     @method frameLoadDelegate
    272     @abstract Return the WebView's WebFrameLoadDelegate delegate.
    273     @result The WebView's WebFrameLoadDelegate delegate.
    274 */
    275 - (id)frameLoadDelegate;
    276 
    277 /*!
    278     @method setPolicyDelegate:
    279     @abstract Set the WebView's WebPolicyDelegate delegate.
    280     @param delegate The WebPolicyDelegate to set as the delegate.
    281 */
    282 - (void)setPolicyDelegate:(id)delegate;
    283 
    284 /*!
    285     @method policyDelegate
    286     @abstract Return the WebView's WebPolicyDelegate.
    287     @result The WebView's WebPolicyDelegate.
    288 */
    289 - (id)policyDelegate;
    290 
    291 /*!
    292     @method mainFrame
    293     @abstract Return the top level frame.
    294     @discussion Note that even document that are not framesets will have a
    295     mainFrame.
    296     @result The main frame.
    297 */
    298 - (WebFrame *)mainFrame;
    299 
    300 /*!
    301     @method selectedFrame
    302     @abstract Return the frame that has the active selection.
    303     @discussion Returns the frame that contains the first responder, if any. Otherwise returns the
    304     frame that contains a non-zero-length selection, if any. Returns nil if no frame meets these criteria.
    305     @result The selected frame.
    306 */
    307 - (WebFrame *)selectedFrame;
    308 
    309 /*!
    310     @method backForwardList
    311     @result The backforward list for this webView.
    312 */
    313 - (WebBackForwardList *)backForwardList;
    314 
    315 /*!
    316     @method setMaintainsBackForwardList:
    317     @abstract Enable or disable the use of a backforward list for this webView.
    318     @param flag Turns use of the back forward list on or off
    319 */
    320 - (void)setMaintainsBackForwardList:(BOOL)flag;
    321 
    322 /*!
    323     @method goBack
    324     @abstract Go back to the previous URL in the backforward list.
    325     @result YES if able to go back in the backforward list, NO otherwise.
    326 */
    327 - (BOOL)goBack;
    328 
    329 /*!
    330     @method goForward
    331     @abstract Go forward to the next URL in the backforward list.
    332     @result YES if able to go forward in the backforward list, NO otherwise.
    333 */
    334 - (BOOL)goForward;
    335 
    336 /*!
    337     @method goToBackForwardItem:
    338     @abstract Go back or forward to an item in the backforward list.
    339     @result YES if able to go to the item, NO otherwise.
    340 */
    341 - (BOOL)goToBackForwardItem:(WebHistoryItem *)item;
    342 
    343 /*!
    344     @method setTextSizeMultiplier:
    345     @abstract Change the size of the text rendering in views managed by this webView.
    346     @param multiplier A fractional percentage value, 1.0 is 100%.
    347 */
    348 - (void)setTextSizeMultiplier:(float)multiplier;
    349 
    350 /*!
    351     @method textSizeMultiplier
    352     @result The text size multipler.
    353 */
    354 - (float)textSizeMultiplier;
    355 
    356 /*!
    357     @method setApplicationNameForUserAgent:
    358     @abstract Set the application name.
    359     @discussion This name will be used in user-agent strings
    360     that are chosen for best results in rendering web pages.
    361     @param applicationName The application name
    362 */
    363 - (void)setApplicationNameForUserAgent:(NSString *)applicationName;
    364 
    365 /*!
    366     @method applicationNameForUserAgent
    367     @result The name of the application as used in the user-agent string.
    368 */
    369 - (NSString *)applicationNameForUserAgent;
    370 
    371 /*!
    372     @method setCustomUserAgent:
    373     @abstract Set the user agent.
    374     @discussion Setting this means that the webView should use this user-agent string
    375     instead of constructing a user-agent string for each URL. Setting it to nil
    376     causes the webView to construct the user-agent string for each URL
    377     for best results rendering web pages.
    378     @param userAgentString The user agent description
    379 */
    380 - (void)setCustomUserAgent:(NSString *)userAgentString;
    381 
    382 /*!
    383     @method customUserAgent
    384     @result The custom user-agent string or nil if no custom user-agent string has been set.
    385 */
    386 - (NSString *)customUserAgent;
    387 
    388 /*!
    389     @method userAgentForURL:
    390     @abstract Get the appropriate user-agent string for a particular URL.
    391     @param URL The URL.
    392     @result The user-agent string for the supplied URL.
    393 */
    394 - (NSString *)userAgentForURL:(NSURL *)URL;
    395 
    396 
    397 /*!
    398     @method supportsTextEncoding
    399     @abstract Find out if the current web page supports text encodings.
    400     @result YES if the document view of the current web page can
    401     support different text encodings.
    402 */
    403 - (BOOL)supportsTextEncoding;
    404 
    405 /*!
    406     @method setCustomTextEncodingName:
    407     @discussion Make the page display with a different text encoding; stops any load in progress.
    408     The text encoding passed in overrides the normal text encoding smarts including
    409     what's specified in a web page's header or HTTP response.
    410     The text encoding automatically goes back to the default when the top level frame
    411     changes to a new location.
    412     Setting the text encoding name to nil makes the webView use default encoding rules.
    413     @param encoding The text encoding name to use to display a page or nil.
    414 */
    415 - (void)setCustomTextEncodingName:(NSString *)encodingName;
    416 
    417 /*!
    418     @method customTextEncodingName
    419     @result The custom text encoding name or nil if no custom text encoding name has been set.
    420 */
    421 - (NSString *)customTextEncodingName;
    422 
    423 /*!
    424     @method setMediaStyle:
    425     @discussion Set the media style for the WebView.  The mediaStyle will override the normal value
    426     of the CSS media property.  Setting the value to nil will restore the normal value.
    427     @param mediaStyle The value to use for the CSS media property.
    428 */
    429 - (void)setMediaStyle:(NSString *)mediaStyle;
    430 
    431 /*!
    432     @method mediaStyle
    433     @result mediaStyle The value to use for the CSS media property, as set by setMediaStyle:.  It
    434     will be nil unless set by that method.
    435 */
    436 - (NSString *)mediaStyle;
    437 
    438 /*!
    439     @method stringByEvaluatingJavaScriptFromString:
    440     @param script The text of the JavaScript.
    441     @result The result of the script, converted to a string, or nil for failure.
    442 */
    443 - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script;
    444 
    445 /*!
    446     @method windowScriptObject
    447     @discussion windowScriptObject return a WebScriptObject that represents the
    448     window object from the script environment.
    449     @result Returns the window object from the script environment.
    450 */
    451 - (WebScriptObject *)windowScriptObject;
    452 
    453 /*!
    454     @method setPreferences:
    455     @param preferences The preferences to use for the webView.
    456     @abstract Override the standard setting for the webView.
    457 */
    458 - (void)setPreferences: (WebPreferences *)prefs;
    459 
    460 /*!
    461     @method preferences
    462     @result Returns the preferences used by this webView.
    463     @discussion This method will return [WebPreferences standardPreferences] if no
    464     other instance of WebPreferences has been set.
    465 */
    466 - (WebPreferences *)preferences;
    467 
    468 /*!
    469     @method setPreferencesIdentifier:
    470     @param anIdentifier The string to use a prefix for storing values for this WebView in the user
    471     defaults database.
    472     @discussion If the WebPreferences for this WebView are stored in the user defaults database, the
    473     string set in this method will be used a key prefix.
    474 */
    475 - (void)setPreferencesIdentifier:(NSString *)anIdentifier;
    476 
    477 /*!
    478     @method preferencesIdentifier
    479     @result Returns the WebPreferences key prefix.
    480 */
    481 - (NSString *)preferencesIdentifier;
    482 
    483 
    484 /*!
    485     @method setHostWindow:
    486     @param hostWindow The host window for the web view.
    487     @discussion Parts of WebKit (such as plug-ins and JavaScript) depend on a window to function
    488     properly. Set a host window so these parts continue to function even when the web view is
    489     not in an actual window.
    490 */
    491 - (void)setHostWindow:(NSWindow *)hostWindow;
    492 
    493 /*!
    494     @method hostWindow
    495     @result The host window for the web view.
    496 */
    497 - (NSWindow *)hostWindow;
    498 
    499 /*!
    500     @method searchFor:direction:caseSensitive:
    501     @abstract Searches a document view for a string and highlights the string if it is found.
    502     Starts the search from the current selection.  Will search across all frames.
    503     @param string The string to search for.
    504     @param forward YES to search forward, NO to seach backwards.
    505     @param caseFlag YES to for case-sensitive search, NO for case-insensitive search.
    506     @result YES if found, NO if not found.
    507 */
    508 - (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag;
    509 
    510 /*!
    511     @method registerViewClass:representationClass:forMIMEType:
    512     @discussion Register classes that implement WebDocumentView and WebDocumentRepresentation respectively.
    513     A document class may register for a primary MIME type by excluding
    514     a subtype, i.e. "video/" will match the document class with
    515     all video types.  More specific matching takes precedence
    516     over general matching.
    517     @param viewClass The WebDocumentView class to use to render data for a given MIME type.
    518     @param representationClass The WebDocumentRepresentation class to use to represent data of the given MIME type.
    519     @param MIMEType The MIME type to represent with an object of the given class.
    520 */
    521 + (void)registerViewClass:(Class)viewClass representationClass:(Class)representationClass forMIMEType:(NSString *)MIMEType;
    522 
    523 
    524 /*!
    525     @method setGroupName:
    526     @param groupName The name of the group for this WebView.
    527     @discussion JavaScript may access named frames within the same group.
    528 */
    529 - (void)setGroupName:(NSString *)groupName;
    530 
    531 /*!
    532     @method groupName
    533     @discussion The group name for this WebView.
    534 */
    535 - (NSString *)groupName;
    536 
    537 /*!
    538     @method estimatedProgress
    539     @discussion An estimate of the percent complete for a document load.  This
    540     value will range from 0 to 1.0 and, once a load completes, will remain at 1.0
    541     until a new load starts, at which point it will be reset to 0.  The value is an
    542     estimate based on the total number of bytes expected to be received
    543     for a document, including all it's possible subresources.  For more accurate progress
    544     indication it is recommended that you implement a WebFrameLoadDelegate and a
    545     WebResourceLoadDelegate.
    546 */
    547 - (double)estimatedProgress;
    548 
    549 /*!
    550     @method isLoading
    551     @discussion Returns YES if there are any pending loads.
    552 */
    553 - (BOOL)isLoading;
    554 
    555 /*!
    556     @method elementAtPoint:
    557     @param point A point in the coordinates of the WebView
    558     @result An element dictionary describing the point
    559 */
    560 - (NSDictionary *)elementAtPoint:(NSPoint)point;
    561 
    562 /*!
    563     @method pasteboardTypesForSelection
    564     @abstract Returns the pasteboard types that WebView can use for the current selection
    565 */
    566 - (NSArray *)pasteboardTypesForSelection;
    567 
    568 /*!
    569     @method writeSelectionWithPasteboardTypes:toPasteboard:
    570     @abstract Writes the current selection to the pasteboard
    571     @param types The types that WebView will write to the pasteboard
    572     @param pasteboard The pasteboard to write to
    573 */
    574 - (void)writeSelectionWithPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
    575 
    576 /*!
    577     @method pasteboardTypesForElement:
    578     @abstract Returns the pasteboard types that WebView can use for an element
    579     @param element The element
    580 */
    581 - (NSArray *)pasteboardTypesForElement:(NSDictionary *)element;
    582 
    583 /*!
    584     @method writeElement:withPasteboardTypes:toPasteboard:
    585     @abstract Writes an element to the pasteboard
    586     @param element The element to write to the pasteboard
    587     @param types The types that WebView will write to the pasteboard
    588     @param pasteboard The pasteboard to write to
    589 */
    590 - (void)writeElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
    591 
    592 /*!
    593     @method moveDragCaretToPoint:
    594     @param point A point in the coordinates of the WebView
    595     @discussion This method moves the caret that shows where something being dragged will be dropped. It may cause the WebView to scroll
    596     to make the new position of the drag caret visible.
    597 */
    598 - (void)moveDragCaretToPoint:(NSPoint)point;
    599 
    600 /*!
    601     @method removeDragCaret
    602     @abstract Removes the drag caret from the WebView
    603 */
    604 - (void)removeDragCaret;
    605 
    606 /*!
    607     @method setDrawsBackground:
    608     @param drawsBackround YES to cause the receiver to draw a default white background, NO otherwise.
    609     @abstract Sets whether the receiver draws a default white background when the loaded page has no background specified.
    610 */
    611 - (void)setDrawsBackground:(BOOL)drawsBackround;
    612 
    613 /*!
    614     @method drawsBackground
    615     @result Returns YES if the receiver draws a default white background, NO otherwise.
    616 */
    617 - (BOOL)drawsBackground;
    618 
    619 /*!
    620     @method setShouldUpdateWhileOffscreen:
    621     @abstract Sets whether the receiver must update even when it is not in a window that is currently visible.
    622     @param updateWhileOffscreen whether the receiver is required to render updates to the web page when it is not in a visible window.
    623     @abstract If set to NO, then whenever the web view is not in a visible window, updates to the web page will not necessarily be rendered in the view.
    624     However, when the window is made visible, the view will be updated automatically. Not updating while hidden can improve performance. If set to is YES,
    625     hidden web views are always updated. This is the default.
    626 */
    627 - (void)setShouldUpdateWhileOffscreen:(BOOL)updateWhileOffscreen;
    628 
    629 /*!
    630     @method shouldUpdateWhileOffscreen
    631     @result Returns whether the web view is always updated even when it is not in a window that is currently visible.
    632 */
    633 - (BOOL)shouldUpdateWhileOffscreen;
    634 
    635 /*!
    636     @method setMainFrameURL:
    637     @param URLString The URL to load in the mainFrame.
    638 */
    639 - (void)setMainFrameURL:(NSString *)URLString;
    640 
    641 /*!
    642     @method mainFrameURL
    643     @result Returns the main frame's current URL.
    644 */
    645 - (NSString *)mainFrameURL;
    646 
    647 /*!
    648     @method mainFrameDocument
    649     @result Returns the main frame's DOMDocument.
    650 */
    651 - (DOMDocument *)mainFrameDocument;
    652 
    653 /*!
    654     @method mainFrameTitle
    655     @result Returns the main frame's title if any, otherwise an empty string.
    656 */
    657 - (NSString *)mainFrameTitle;
    658 
    659 /*!
    660     @method mainFrameIcon
    661     @discussion The methods returns the site icon for the current page loaded in the mainFrame.
    662     @result Returns the main frame's icon if any, otherwise nil.
    663 */
    664 - (NSImage *)mainFrameIcon;
    665 
    666 @end
    667 
    668 
    669 @interface WebView (WebIBActions) <NSUserInterfaceValidations>
    670 - (IBAction)takeStringURLFrom:(id)sender;
    671 - (IBAction)stopLoading:(id)sender;
    672 - (IBAction)reload:(id)sender;
    673 - (IBAction)reloadFromOrigin:(id)sender;
    674 - (BOOL)canGoBack;
    675 - (IBAction)goBack:(id)sender;
    676 - (BOOL)canGoForward;
    677 - (IBAction)goForward:(id)sender;
    678 - (BOOL)canMakeTextLarger;
    679 - (IBAction)makeTextLarger:(id)sender;
    680 - (BOOL)canMakeTextSmaller;
    681 - (IBAction)makeTextSmaller:(id)sender;
    682 - (BOOL)canMakeTextStandardSize;
    683 - (IBAction)makeTextStandardSize:(id)sender;
    684 - (IBAction)toggleContinuousSpellChecking:(id)sender;
    685 - (IBAction)toggleSmartInsertDelete:(id)sender;
    686 @end
    687 
    688 
    689 // WebView editing support
    690 
    691 extern NSString * const WebViewDidBeginEditingNotification;
    692 extern NSString * const WebViewDidChangeNotification;
    693 extern NSString * const WebViewDidEndEditingNotification;
    694 extern NSString * const WebViewDidChangeTypingStyleNotification;
    695 extern NSString * const WebViewDidChangeSelectionNotification;
    696 
    697 @interface WebView (WebViewCSS)
    698 - (DOMCSSStyleDeclaration *)computedStyleForElement:(DOMElement *)element pseudoElement:(NSString *)pseudoElement;
    699 @end
    700 
    701 @interface WebView (WebViewEditing)
    702 - (DOMRange *)editableDOMRangeForPoint:(NSPoint)point;
    703 - (void)setSelectedDOMRange:(DOMRange *)range affinity:(NSSelectionAffinity)selectionAffinity;
    704 - (DOMRange *)selectedDOMRange;
    705 - (NSSelectionAffinity)selectionAffinity;
    706 - (BOOL)maintainsInactiveSelection;
    707 - (void)setEditable:(BOOL)flag;
    708 - (BOOL)isEditable;
    709 - (void)setTypingStyle:(DOMCSSStyleDeclaration *)style;
    710 - (DOMCSSStyleDeclaration *)typingStyle;
    711 - (void)setSmartInsertDeleteEnabled:(BOOL)flag;
    712 - (BOOL)smartInsertDeleteEnabled;
    713 - (void)setContinuousSpellCheckingEnabled:(BOOL)flag;
    714 - (BOOL)isContinuousSpellCheckingEnabled;
    715 - (WebNSInteger)spellCheckerDocumentTag;
    716 - (NSUndoManager *)undoManager;
    717 - (void)setEditingDelegate:(id)delegate;
    718 - (id)editingDelegate;
    719 - (DOMCSSStyleDeclaration *)styleDeclarationWithText:(NSString *)text;
    720 @end
    721 
    722 @interface WebView (WebViewUndoableEditing)
    723 - (void)replaceSelectionWithNode:(DOMNode *)node;
    724 - (void)replaceSelectionWithText:(NSString *)text;
    725 - (void)replaceSelectionWithMarkupString:(NSString *)markupString;
    726 - (void)replaceSelectionWithArchive:(WebArchive *)archive;
    727 - (void)deleteSelection;
    728 - (void)applyStyle:(DOMCSSStyleDeclaration *)style;
    729 @end
    730 
    731 @interface WebView (WebViewEditingActions)
    732 
    733 - (void)copy:(id)sender;
    734 - (void)cut:(id)sender;
    735 - (void)paste:(id)sender;
    736 - (void)copyFont:(id)sender;
    737 - (void)pasteFont:(id)sender;
    738 - (void)delete:(id)sender;
    739 - (void)pasteAsPlainText:(id)sender;
    740 - (void)pasteAsRichText:(id)sender;
    741 
    742 - (void)changeFont:(id)sender;
    743 - (void)changeAttributes:(id)sender;
    744 - (void)changeDocumentBackgroundColor:(id)sender;
    745 - (void)changeColor:(id)sender;
    746 
    747 - (void)alignCenter:(id)sender;
    748 - (void)alignJustified:(id)sender;
    749 - (void)alignLeft:(id)sender;
    750 - (void)alignRight:(id)sender;
    751 
    752 - (void)checkSpelling:(id)sender;
    753 - (void)showGuessPanel:(id)sender;
    754 - (void)performFindPanelAction:(id)sender;
    755 
    756 - (void)startSpeaking:(id)sender;
    757 - (void)stopSpeaking:(id)sender;
    758 
    759 - (void)moveToBeginningOfSentence:(id)sender;
    760 - (void)moveToBeginningOfSentenceAndModifySelection:(id)sender;
    761 - (void)moveToEndOfSentence:(id)sender;
    762 - (void)moveToEndOfSentenceAndModifySelection:(id)sender;
    763 - (void)selectSentence:(id)sender;
    764 
    765 /*
    766 The following methods are declared in NSResponder.h.
    767 WebView overrides each method in this list, providing
    768 a custom implementation for each.
    769 
    770 - (void)capitalizeWord:(id)sender;
    771 - (void)centerSelectionInVisibleArea:(id)sender;
    772 - (void)changeCaseOfLetter:(id)sender;
    773 - (void)complete:(id)sender;
    774 - (void)deleteBackward:(id)sender;
    775 - (void)deleteBackwardByDecomposingPreviousCharacter:(id)sender;
    776 - (void)deleteForward:(id)sender;
    777 - (void)deleteToBeginningOfLine:(id)sender;
    778 - (void)deleteToBeginningOfParagraph:(id)sender;
    779 - (void)deleteToEndOfLine:(id)sender;
    780 - (void)deleteToEndOfParagraph:(id)sender;
    781 - (void)deleteWordBackward:(id)sender;
    782 - (void)deleteWordForward:(id)sender;
    783 - (void)indent:(id)sender;
    784 - (void)insertBacktab:(id)sender;
    785 - (void)insertNewline:(id)sender;
    786 - (void)insertParagraphSeparator:(id)sender;
    787 - (void)insertTab:(id)sender;
    788 - (void)lowercaseWord:(id)sender;
    789 - (void)moveBackward:(id)sender;
    790 - (void)moveBackwardAndModifySelection:(id)sender;
    791 - (void)moveDown:(id)sender;
    792 - (void)moveDownAndModifySelection:(id)sender;
    793 - (void)moveForward:(id)sender;
    794 - (void)moveForwardAndModifySelection:(id)sender;
    795 - (void)moveLeft:(id)sender;
    796 - (void)moveLeftAndModifySelection:(id)sender;
    797 - (void)moveRight:(id)sender;
    798 - (void)moveRightAndModifySelection:(id)sender;
    799 - (void)moveToBeginningOfDocument:(id)sender;
    800 - (void)moveToBeginningOfDocumentAndModifySelection:(id)sender;
    801 - (void)moveToBeginningOfLine:(id)sender;
    802 - (void)moveToBeginningOfLineAndModifySelection:(id)sender;
    803 - (void)moveToBeginningOfParagraph:(id)sender;
    804 - (void)moveToBeginningOfParagraphAndModifySelection:(id)sender;
    805 - (void)moveToEndOfDocument:(id)sender;
    806 - (void)moveToEndOfDocumentAndModifySelection:(id)sender;
    807 - (void)moveToEndOfLine:(id)sender;
    808 - (void)moveToEndOfLineAndModifySelection:(id)sender;
    809 - (void)moveToEndOfParagraph:(id)sender;
    810 - (void)moveToEndOfParagraphAndModifySelection:(id)sender;
    811 - (void)moveUp:(id)sender;
    812 - (void)moveUpAndModifySelection:(id)sender;
    813 - (void)moveWordBackward:(id)sender;
    814 - (void)moveWordBackwardAndModifySelection:(id)sender;
    815 - (void)moveWordForward:(id)sender;
    816 - (void)moveWordForwardAndModifySelection:(id)sender;
    817 - (void)moveWordLeft:(id)sender;
    818 - (void)moveWordLeftAndModifySelection:(id)sender;
    819 - (void)moveWordRight:(id)sender;
    820 - (void)moveWordRightAndModifySelection:(id)sender;
    821 - (void)pageDown:(id)sender;
    822 - (void)pageUp:(id)sender;
    823 - (void)scrollLineDown:(id)sender;
    824 - (void)scrollLineUp:(id)sender;
    825 - (void)scrollPageDown:(id)sender;
    826 - (void)scrollPageUp:(id)sender;
    827 - (void)selectAll:(id)sender;
    828 - (void)selectLine:(id)sender;
    829 - (void)selectParagraph:(id)sender;
    830 - (void)selectWord:(id)sender;
    831 - (void)uppercaseWord:(id)sender;
    832 */
    833 
    834 @end
    835 
    836 #undef WebNSInteger
    837