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