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