|
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 #import <Foundation/NSURLRequest.h> |
|
31 |
|
32 #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 |
|
33 #define WebNSUInteger unsigned int |
|
34 #else |
|
35 #define WebNSUInteger NSUInteger |
|
36 #endif |
|
37 |
|
38 /*! |
|
39 @enum WebMenuItemTag |
|
40 @discussion Each menu item in the default menu items array passed in |
|
41 contextMenuItemsForElement:defaultMenuItems: has its tag set to one of the WebMenuItemTags. |
|
42 When iterating through the default menu items array, use the tag to differentiate between them. |
|
43 */ |
|
44 |
|
45 enum { |
|
46 WebMenuItemTagOpenLinkInNewWindow=1, |
|
47 WebMenuItemTagDownloadLinkToDisk, |
|
48 WebMenuItemTagCopyLinkToClipboard, |
|
49 WebMenuItemTagOpenImageInNewWindow, |
|
50 WebMenuItemTagDownloadImageToDisk, |
|
51 WebMenuItemTagCopyImageToClipboard, |
|
52 WebMenuItemTagOpenFrameInNewWindow, |
|
53 WebMenuItemTagCopy, |
|
54 WebMenuItemTagGoBack, |
|
55 WebMenuItemTagGoForward, |
|
56 WebMenuItemTagStop, |
|
57 WebMenuItemTagReload, |
|
58 WebMenuItemTagCut, |
|
59 WebMenuItemTagPaste, |
|
60 WebMenuItemTagSpellingGuess, |
|
61 WebMenuItemTagNoGuessesFound, |
|
62 WebMenuItemTagIgnoreSpelling, |
|
63 WebMenuItemTagLearnSpelling, |
|
64 WebMenuItemTagOther, |
|
65 WebMenuItemTagSearchInSpotlight, |
|
66 WebMenuItemTagSearchWeb, |
|
67 WebMenuItemTagLookUpInDictionary, |
|
68 WebMenuItemTagOpenWithDefaultApplication, |
|
69 WebMenuItemPDFActualSize, |
|
70 WebMenuItemPDFZoomIn, |
|
71 WebMenuItemPDFZoomOut, |
|
72 WebMenuItemPDFAutoSize, |
|
73 WebMenuItemPDFSinglePage, |
|
74 WebMenuItemPDFFacingPages, |
|
75 WebMenuItemPDFContinuous, |
|
76 WebMenuItemPDFNextPage, |
|
77 WebMenuItemPDFPreviousPage, |
|
78 }; |
|
79 |
|
80 /*! |
|
81 @enum WebDragDestinationAction |
|
82 @abstract Actions that the destination of a drag can perform. |
|
83 @constant WebDragDestinationActionNone No action |
|
84 @constant WebDragDestinationActionDHTML Allows DHTML (such as JavaScript) to handle the drag |
|
85 @constant WebDragDestinationActionEdit Allows editable documents to be edited from the drag |
|
86 @constant WebDragDestinationActionLoad Allows a location change from the drag |
|
87 @constant WebDragDestinationActionAny Allows any of the above to occur |
|
88 */ |
|
89 typedef enum { |
|
90 WebDragDestinationActionNone = 0, |
|
91 WebDragDestinationActionDHTML = 1, |
|
92 WebDragDestinationActionEdit = 2, |
|
93 WebDragDestinationActionLoad = 4, |
|
94 WebDragDestinationActionAny = UINT_MAX |
|
95 } WebDragDestinationAction; |
|
96 |
|
97 /*! |
|
98 @enum WebDragSourceAction |
|
99 @abstract Actions that the source of a drag can perform. |
|
100 @constant WebDragSourceActionNone No action |
|
101 @constant WebDragSourceActionDHTML Allows DHTML (such as JavaScript) to start a drag |
|
102 @constant WebDragSourceActionImage Allows an image drag to occur |
|
103 @constant WebDragSourceActionLink Allows a link drag to occur |
|
104 @constant WebDragSourceActionSelection Allows a selection drag to occur |
|
105 @constant WebDragSourceActionAny Allows any of the above to occur |
|
106 */ |
|
107 typedef enum { |
|
108 WebDragSourceActionNone = 0, |
|
109 WebDragSourceActionDHTML = 1, |
|
110 WebDragSourceActionImage = 2, |
|
111 WebDragSourceActionLink = 4, |
|
112 WebDragSourceActionSelection = 8, |
|
113 WebDragSourceActionAny = UINT_MAX |
|
114 } WebDragSourceAction; |
|
115 |
|
116 /*! |
|
117 @protocol WebOpenPanelResultListener |
|
118 @discussion This protocol is used to call back with the results of |
|
119 the file open panel requested by runOpenPanelForFileButtonWithResultListener: |
|
120 */ |
|
121 @protocol WebOpenPanelResultListener <NSObject> |
|
122 |
|
123 /*! |
|
124 @method chooseFilename: |
|
125 @abstract Call this method to return a filename from the file open panel. |
|
126 @param fileName |
|
127 */ |
|
128 - (void)chooseFilename:(NSString *)fileName; |
|
129 |
|
130 /*! |
|
131 @method cancel |
|
132 @abstract Call this method to indicate that the file open panel was cancelled. |
|
133 */ |
|
134 - (void)cancel; |
|
135 |
|
136 @end |
|
137 |
|
138 @class WebView; |
|
139 |
|
140 /*! |
|
141 @category WebUIDelegate |
|
142 @discussion A class that implements WebUIDelegate provides |
|
143 window-related methods that may be used by Javascript, plugins and |
|
144 other aspects of web pages. These methods are used to open new |
|
145 windows and control aspects of existing windows. |
|
146 */ |
|
147 @interface NSObject (WebUIDelegate) |
|
148 |
|
149 /*! |
|
150 @method webView:createWebViewWithRequest: |
|
151 @abstract Create a new window and begin to load the specified request. |
|
152 @discussion The newly created window is hidden, and the window operations delegate on the |
|
153 new WebViews will get a webViewShow: call. |
|
154 @param sender The WebView sending the delegate method. |
|
155 @param request The request to load. |
|
156 @result The WebView for the new window. |
|
157 */ |
|
158 - (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request; |
|
159 |
|
160 /*! |
|
161 @method webViewShow: |
|
162 @param sender The WebView sending the delegate method. |
|
163 @abstract Show the window that contains the top level view of the WebView, |
|
164 ordering it frontmost. |
|
165 @discussion This will only be called just after createWindowWithRequest: |
|
166 is used to create a new window. |
|
167 */ |
|
168 - (void)webViewShow:(WebView *)sender; |
|
169 |
|
170 /*! |
|
171 @method webView:createWebViewModalDialogWithRequest: |
|
172 @abstract Create a new window and begin to load the specified request. |
|
173 @discussion The newly created window is hidden, and the window operations delegate on the |
|
174 new WebViews will get a webViewShow: call. |
|
175 @param sender The WebView sending the delegate method. |
|
176 @param request The request to load. |
|
177 @result The WebView for the new window. |
|
178 */ |
|
179 - (WebView *)webView:(WebView *)sender createWebViewModalDialogWithRequest:(NSURLRequest *)request; |
|
180 |
|
181 /*! |
|
182 @method webViewRunModal: |
|
183 @param sender The WebView sending the delegate method. |
|
184 @abstract Show the window that contains the top level view of the WebView, |
|
185 ordering it frontmost. The window should be run modal in the application. |
|
186 @discussion This will only be called just after createWebViewModalDialogWithRequest: |
|
187 is used to create a new window. |
|
188 */ |
|
189 - (void)webViewRunModal:(WebView *)sender; |
|
190 |
|
191 /*! |
|
192 @method webViewClose: |
|
193 @abstract Close the current window. |
|
194 @param sender The WebView sending the delegate method. |
|
195 @discussion Clients showing multiple views in one window may |
|
196 choose to close only the one corresponding to this |
|
197 WebView. Other clients may choose to ignore this method |
|
198 entirely. |
|
199 */ |
|
200 - (void)webViewClose:(WebView *)sender; |
|
201 |
|
202 /*! |
|
203 @method webViewFocus: |
|
204 @abstract Focus the current window (i.e. makeKeyAndOrderFront:). |
|
205 @param The WebView sending the delegate method. |
|
206 @discussion Clients showing multiple views in one window may want to |
|
207 also do something to focus the one corresponding to this WebView. |
|
208 */ |
|
209 - (void)webViewFocus:(WebView *)sender; |
|
210 |
|
211 /*! |
|
212 @method webViewUnfocus: |
|
213 @abstract Unfocus the current window. |
|
214 @param sender The WebView sending the delegate method. |
|
215 @discussion Clients showing multiple views in one window may want to |
|
216 also do something to unfocus the one corresponding to this WebView. |
|
217 */ |
|
218 - (void)webViewUnfocus:(WebView *)sender; |
|
219 |
|
220 /*! |
|
221 @method webViewFirstResponder: |
|
222 @abstract Get the first responder for this window. |
|
223 @param sender The WebView sending the delegate method. |
|
224 @discussion This method should return the focused control in the |
|
225 WebView's view, if any. If the view is out of the window |
|
226 hierarchy, this might return something than calling firstResponder |
|
227 on the real NSWindow would. It's OK to return either nil or the |
|
228 real first responder if some control not in the window has focus. |
|
229 */ |
|
230 - (NSResponder *)webViewFirstResponder:(WebView *)sender; |
|
231 |
|
232 /*! |
|
233 @method webView:makeFirstResponder: |
|
234 @abstract Set the first responder for this window. |
|
235 @param sender The WebView sending the delegate method. |
|
236 @param responder The responder to make first (will always be a view) |
|
237 @discussion responder will always be a view that is in the view |
|
238 subhierarchy of the top-level web view for this WebView. If the |
|
239 WebView's top level view is currently out of the view |
|
240 hierarchy, it may be desirable to save the first responder |
|
241 elsewhere, or possibly ignore this call. |
|
242 */ |
|
243 - (void)webView:(WebView *)sender makeFirstResponder:(NSResponder *)responder; |
|
244 |
|
245 /*! |
|
246 @method webView:setStatusText: |
|
247 @abstract Set the window's status display, if any, to the specified string. |
|
248 @param sender The WebView sending the delegate method. |
|
249 @param text The status text to set |
|
250 */ |
|
251 - (void)webView:(WebView *)sender setStatusText:(NSString *)text; |
|
252 |
|
253 /*! |
|
254 @method webViewStatusText: |
|
255 @abstract Get the currently displayed status text. |
|
256 @param sender The WebView sending the delegate method. |
|
257 @result The status text |
|
258 */ |
|
259 - (NSString *)webViewStatusText:(WebView *)sender; |
|
260 |
|
261 /*! |
|
262 @method webViewAreToolbarsVisible: |
|
263 @abstract Determine whether the window's toolbars are currently visible |
|
264 @param sender The WebView sending the delegate method. |
|
265 @discussion This method should return YES if the window has any |
|
266 toolbars that are currently on, besides the status bar. If the app |
|
267 has more than one toolbar per window, for example a regular |
|
268 command toolbar and a favorites bar, it should return YES from |
|
269 this method if at least one is on. |
|
270 @result YES if at least one toolbar is visible, otherwise NO. |
|
271 */ |
|
272 - (BOOL)webViewAreToolbarsVisible:(WebView *)sender; |
|
273 |
|
274 /*! |
|
275 @method webView:setToolbarsVisible: |
|
276 @param sender The WebView sending the delegate method. |
|
277 @abstract Set whether the window's toolbars are currently visible. |
|
278 @param visible New value for toolbar visibility |
|
279 @discussion Setting this to YES should turn on all toolbars |
|
280 (except for a possible status bar). Setting it to NO should turn |
|
281 off all toolbars (with the same exception). |
|
282 */ |
|
283 - (void)webView:(WebView *)sender setToolbarsVisible:(BOOL)visible; |
|
284 |
|
285 /*! |
|
286 @method webViewIsStatusBarVisible: |
|
287 @abstract Determine whether the status bar is visible. |
|
288 @param sender The WebView sending the delegate method. |
|
289 @result YES if the status bar is visible, otherwise NO. |
|
290 */ |
|
291 - (BOOL)webViewIsStatusBarVisible:(WebView *)sender; |
|
292 |
|
293 /*! |
|
294 @method webView:setStatusBarVisible: |
|
295 @abstract Set whether the status bar is currently visible. |
|
296 @param visible The new visibility value |
|
297 @discussion Setting this to YES should show the status bar, |
|
298 setting it to NO should hide it. |
|
299 */ |
|
300 - (void)webView:(WebView *)sender setStatusBarVisible:(BOOL)visible; |
|
301 |
|
302 /*! |
|
303 @method webViewIsResizable: |
|
304 @abstract Determine whether the window is resizable or not. |
|
305 @param sender The WebView sending the delegate method. |
|
306 @result YES if resizable, NO if not. |
|
307 @discussion If there are multiple views in the same window, they |
|
308 have have their own separate resize controls and this may need to |
|
309 be handled specially. |
|
310 */ |
|
311 - (BOOL)webViewIsResizable:(WebView *)sender; |
|
312 |
|
313 /*! |
|
314 @method webView:setResizable: |
|
315 @abstract Set the window to resizable or not |
|
316 @param sender The WebView sending the delegate method. |
|
317 @param resizable YES if the window should be made resizable, NO if not. |
|
318 @discussion If there are multiple views in the same window, they |
|
319 have have their own separate resize controls and this may need to |
|
320 be handled specially. |
|
321 */ |
|
322 - (void)webView:(WebView *)sender setResizable:(BOOL)resizable; |
|
323 |
|
324 /*! |
|
325 @method webView:setFrame: |
|
326 @abstract Set the window's frame rect |
|
327 @param sender The WebView sending the delegate method. |
|
328 @param frame The new window frame size |
|
329 @discussion Even though a caller could set the frame directly using the NSWindow, |
|
330 this method is provided so implementors of this protocol can do special |
|
331 things on programmatic move/resize, like avoiding autosaving of the size. |
|
332 */ |
|
333 - (void)webView:(WebView *)sender setFrame:(NSRect)frame; |
|
334 |
|
335 /*! |
|
336 @method webViewFrame: |
|
337 @param sender The WebView sending the delegate method. |
|
338 @abstract REturn the window's frame rect |
|
339 @discussion |
|
340 */ |
|
341 - (NSRect)webViewFrame:(WebView *)sender; |
|
342 |
|
343 /*! |
|
344 @method webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame: |
|
345 @abstract Display a JavaScript alert panel. |
|
346 @param sender The WebView sending the delegate method. |
|
347 @param message The message to display. |
|
348 @param frame The WebFrame whose JavaScript initiated this call. |
|
349 @discussion Clients should visually indicate that this panel comes |
|
350 from JavaScript initiated by the specified frame. The panel should have |
|
351 a single OK button. |
|
352 */ |
|
353 - (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame; |
|
354 |
|
355 /*! |
|
356 @method webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame: |
|
357 @abstract Display a JavaScript confirm panel. |
|
358 @param sender The WebView sending the delegate method. |
|
359 @param message The message to display. |
|
360 @param frame The WebFrame whose JavaScript initiated this call. |
|
361 @result YES if the user hit OK, NO if the user chose Cancel. |
|
362 @discussion Clients should visually indicate that this panel comes |
|
363 from JavaScript initiated by the specified frame. The panel should have |
|
364 two buttons, e.g. "OK" and "Cancel". |
|
365 */ |
|
366 - (BOOL)webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame; |
|
367 |
|
368 /*! |
|
369 @method webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame: |
|
370 @abstract Display a JavaScript text input panel. |
|
371 @param sender The WebView sending the delegate method. |
|
372 @param message The message to display. |
|
373 @param defaultText The initial text for the text entry area. |
|
374 @param frame The WebFrame whose JavaScript initiated this call. |
|
375 @result The typed text if the user hit OK, otherwise nil. |
|
376 @discussion Clients should visually indicate that this panel comes |
|
377 from JavaScript initiated by the specified frame. The panel should have |
|
378 two buttons, e.g. "OK" and "Cancel", and an area to type text. |
|
379 */ |
|
380 - (NSString *)webView:(WebView *)sender runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText initiatedByFrame:(WebFrame *)frame; |
|
381 |
|
382 /*! |
|
383 @method webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame: |
|
384 @abstract Display a confirm panel by an "before unload" event handler. |
|
385 @param sender The WebView sending the delegate method. |
|
386 @param message The message to display. |
|
387 @param frame The WebFrame whose JavaScript initiated this call. |
|
388 @result YES if the user hit OK, NO if the user chose Cancel. |
|
389 @discussion Clients should include a message in addition to the one |
|
390 supplied by the web page that indicates. The panel should have |
|
391 two buttons, e.g. "OK" and "Cancel". |
|
392 */ |
|
393 - (BOOL)webView:(WebView *)sender runBeforeUnloadConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame; |
|
394 |
|
395 /*! |
|
396 @method webView:runOpenPanelForFileButtonWithResultListener: |
|
397 @abstract Display a file open panel for a file input control. |
|
398 @param sender The WebView sending the delegate method. |
|
399 @param resultListener The object to call back with the results. |
|
400 @discussion This method is passed a callback object instead of giving a return |
|
401 value so that it can be handled with a sheet. |
|
402 */ |
|
403 - (void)webView:(WebView *)sender runOpenPanelForFileButtonWithResultListener:(id<WebOpenPanelResultListener>)resultListener; |
|
404 |
|
405 /*! |
|
406 @method webView:mouseDidMoveOverElement:modifierFlags: |
|
407 @abstract Update the window's feedback for mousing over links to reflect a new item the mouse is over |
|
408 or new modifier flags. |
|
409 @param sender The WebView sending the delegate method. |
|
410 @param elementInformation Dictionary that describes the element that the mouse is over, or nil. |
|
411 @param modifierFlags The modifier flags as in NSEvent. |
|
412 */ |
|
413 - (void)webView:(WebView *)sender mouseDidMoveOverElement:(NSDictionary *)elementInformation modifierFlags:(WebNSUInteger)modifierFlags; |
|
414 |
|
415 /*! |
|
416 @method webView:contextMenuItemsForElement:defaultMenuItems: |
|
417 @abstract Returns the menu items to display in an element's contextual menu. |
|
418 @param sender The WebView sending the delegate method. |
|
419 @param element A dictionary representation of the clicked element. |
|
420 @param defaultMenuItems An array of default NSMenuItems to include in all contextual menus. |
|
421 @result An array of NSMenuItems to include in the contextual menu. |
|
422 */ |
|
423 - (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems; |
|
424 |
|
425 /*! |
|
426 @method webView:validateUserInterfaceItem:defaultValidation: |
|
427 @abstract Controls UI validation |
|
428 @param webView The WebView sending the delegate method |
|
429 @param item The user interface item being validated |
|
430 @pararm defaultValidation Whether or not the WebView thinks the item is valid |
|
431 @discussion This method allows the UI delegate to control WebView's validation of user interface items. |
|
432 See WebView.h to see the methods to that WebView can currently validate. See NSUserInterfaceValidations and |
|
433 NSValidatedUserInterfaceItem for information about UI validation. |
|
434 */ |
|
435 - (BOOL)webView:(WebView *)webView validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item defaultValidation:(BOOL)defaultValidation; |
|
436 |
|
437 /*! |
|
438 @method webView:shouldPerformAction:fromSender: |
|
439 @abstract Controls actions |
|
440 @param webView The WebView sending the delegate method |
|
441 @param action The action being sent |
|
442 @param sender The sender of the action |
|
443 @discussion This method allows the UI delegate to control WebView's behavior when an action is being sent. |
|
444 For example, if the action is copy:, the delegate can return YES to allow WebView to perform its default |
|
445 copy behavior or return NO and perform copy: in some other way. See WebView.h to see the actions that |
|
446 WebView can perform. |
|
447 */ |
|
448 - (BOOL)webView:(WebView *)webView shouldPerformAction:(SEL)action fromSender:(id)sender; |
|
449 |
|
450 /*! |
|
451 @method webView:dragDestinationActionMaskForDraggingInfo: |
|
452 @abstract Controls behavior when dragging to a WebView |
|
453 @param webView The WebView sending the delegate method |
|
454 @param draggingInfo The dragging info of the drag |
|
455 @discussion This method is called periodically as something is dragged over a WebView. The UI delegate can return a mask |
|
456 indicating which drag destination actions can occur, WebDragDestinationActionAny to allow any kind of action or |
|
457 WebDragDestinationActionNone to not accept the drag. |
|
458 */ |
|
459 - (WebNSUInteger)webView:(WebView *)webView dragDestinationActionMaskForDraggingInfo:(id <NSDraggingInfo>)draggingInfo; |
|
460 |
|
461 /*! |
|
462 @method webView:willPerformDragDestinationAction:forDraggingInfo: |
|
463 @abstract Informs that WebView will perform a drag destination action |
|
464 @param webView The WebView sending the delegate method |
|
465 @param action The drag destination action |
|
466 @param draggingInfo The dragging info of the drag |
|
467 @discussion This method is called after the last call to webView:dragDestinationActionMaskForDraggingInfo: after something is dropped on a WebView. |
|
468 This method informs the UI delegate of the drag destination action that WebView will perform. |
|
469 */ |
|
470 - (void)webView:(WebView *)webView willPerformDragDestinationAction:(WebDragDestinationAction)action forDraggingInfo:(id <NSDraggingInfo>)draggingInfo; |
|
471 |
|
472 /*! |
|
473 @method webView:dragSourceActionMaskForPoint: |
|
474 @abstract Controls behavior when dragging from a WebView |
|
475 @param webView The WebView sending the delegate method |
|
476 @param point The point where the drag started in the coordinates of the WebView |
|
477 @discussion This method is called after the user has begun a drag from a WebView. The UI delegate can return a mask indicating |
|
478 which drag source actions can occur, WebDragSourceActionAny to allow any kind of action or WebDragSourceActionNone to not begin a drag. |
|
479 */ |
|
480 - (WebNSUInteger)webView:(WebView *)webView dragSourceActionMaskForPoint:(NSPoint)point; |
|
481 |
|
482 /*! |
|
483 @method webView:willPerformDragSourceAction:fromPoint:withPasteboard: |
|
484 @abstract Informs that a drag a has begun from a WebView |
|
485 @param webView The WebView sending the delegate method |
|
486 @param action The drag source action |
|
487 @param point The point where the drag started in the coordinates of the WebView |
|
488 @param pasteboard The drag pasteboard |
|
489 @discussion This method is called after webView:dragSourceActionMaskForPoint: is called after the user has begun a drag from a WebView. |
|
490 This method informs the UI delegate of the drag source action that will be performed and gives the delegate an opportunity to modify |
|
491 the contents of the dragging pasteboard. |
|
492 */ |
|
493 - (void)webView:(WebView *)webView willPerformDragSourceAction:(WebDragSourceAction)action fromPoint:(NSPoint)point withPasteboard:(NSPasteboard *)pasteboard; |
|
494 |
|
495 /*! |
|
496 @method webView:printFrameView: |
|
497 @abstract Informs that a WebFrameView needs to be printed |
|
498 @param webView The WebView sending the delegate method |
|
499 @param frameView The WebFrameView needing to be printed |
|
500 @discussion This method is called when a script or user requests the page to be printed. |
|
501 In this method the delegate can prepare the WebFrameView to be printed. Some content that WebKit |
|
502 displays can be printed directly by the WebFrameView, other content will need to be handled by |
|
503 the delegate. To determine if the WebFrameView can handle printing the delegate should check |
|
504 WebFrameView's documentViewShouldHandlePrint, if YES then the delegate can call printDocumentView |
|
505 on the WebFrameView. Otherwise the delegate will need to request a NSPrintOperation from |
|
506 the WebFrameView's printOperationWithPrintInfo to handle the printing. |
|
507 */ |
|
508 - (void)webView:(WebView *)sender printFrameView:(WebFrameView *)frameView; |
|
509 |
|
510 /*! |
|
511 @method webViewHeaderHeight: |
|
512 @param webView The WebView sending the delegate method |
|
513 @abstract Reserve a height for the printed page header. |
|
514 @result The height to reserve for the printed page header, return 0.0 to not reserve any space for a header. |
|
515 @discussion The height returned will be used to calculate the rect passed to webView:drawHeaderInRect:. |
|
516 */ |
|
517 - (float)webViewHeaderHeight:(WebView *)sender; |
|
518 |
|
519 /*! |
|
520 @method webViewFooterHeight: |
|
521 @param webView The WebView sending the delegate method |
|
522 @abstract Reserve a height for the printed page footer. |
|
523 @result The height to reserve for the printed page footer, return 0.0 to not reserve any space for a footer. |
|
524 @discussion The height returned will be used to calculate the rect passed to webView:drawFooterInRect:. |
|
525 */ |
|
526 - (float)webViewFooterHeight:(WebView *)sender; |
|
527 |
|
528 /*! |
|
529 @method webView:drawHeaderInRect: |
|
530 @param webView The WebView sending the delegate method |
|
531 @param rect The NSRect reserved for the header of the page |
|
532 @abstract The delegate should draw a header for the sender in the supplied rect. |
|
533 */ |
|
534 - (void)webView:(WebView *)sender drawHeaderInRect:(NSRect)rect; |
|
535 |
|
536 /*! |
|
537 @method webView:drawFooterInRect: |
|
538 @param webView The WebView sending the delegate method |
|
539 @param rect The NSRect reserved for the footer of the page |
|
540 @abstract The delegate should draw a footer for the sender in the supplied rect. |
|
541 */ |
|
542 - (void)webView:(WebView *)sender drawFooterInRect:(NSRect)rect; |
|
543 |
|
544 // The following delegate methods are deprecated in favor of the ones above that specify |
|
545 // the WebFrame whose JavaScript initiated this call. |
|
546 - (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message; |
|
547 - (BOOL)webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message; |
|
548 - (NSString *)webView:(WebView *)sender runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText; |
|
549 |
|
550 // The following delegate methods are deprecated. Content rect calculations are now done automatically. |
|
551 - (void)webView:(WebView *)sender setContentRect:(NSRect)frame; |
|
552 - (NSRect)webViewContentRect:(WebView *)sender; |
|
553 |
|
554 @end |
|
555 |
|
556 #undef WebNSUInteger |