1/* 2 * Copyright (C) 2006, 2007, 2008 Apple 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 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26cpp_quote("/* identifiers for commands that can be called by the webview's frame */") 27cpp_quote("enum WebViewCmd { Cut = 100, Copy, Paste, ForwardDelete, SelectAll, Undo, Redo };") 28 29cpp_quote("#define WebViewProgressStartedNotification TEXT(\"WebProgressStartedNotification\")") 30cpp_quote("#define WebViewProgressEstimateChangedNotification TEXT(\"WebProgressEstimateChangedNotification\")") 31cpp_quote("#define WebViewProgressFinishedNotification TEXT(\"WebProgressFinishedNotification\")") 32cpp_quote("#define WebViewDidChangeSelectionNotification TEXT(\"WebViewDidChangeSelectionNotification\")") 33 34#ifndef DO_NO_IMPORTS 35import "oaidl.idl"; 36import "ocidl.idl"; 37import "IWebUIDelegate.idl"; 38import "IWebURLResponse.idl"; 39import "IWebResourceLoadDelegate.idl"; 40import "IWebDownload.idl"; 41import "IWebFrameLoadDelegate.idl"; 42import "IWebPolicyDelegate.idl"; 43import "IWebBackForwardList.idl"; 44import "IWebHistoryItem.idl"; 45import "IWebPreferences.idl"; 46import "DOMCSS.idl"; 47import "IWebUndoManager.idl"; 48import "IWebEditingDelegate.idl"; 49import "DOMRange.idl"; 50import "AccessibilityDelegate.idl"; 51#endif 52 53interface IDOMCSSStyleDeclaration; 54interface IDOMDocument; 55interface IDOMElement; 56interface IDOMNode; 57interface IDOMRange; 58 59interface IWebArchive; 60interface IWebBackForwardList; 61interface IWebDataSource; 62interface IWebFrame; 63interface IWebFrameView; 64interface IWebHistoryItem; 65interface IWebPreferences; 66interface IWebScriptObject; 67 68interface IWebUIDelegate; 69interface IWebResourceLoadDelegate; 70interface IWebDownloadDelegate; 71interface IWebEditingDelegate; 72interface IWebFrameLoadDelegate; 73interface IWebPolicyDelegate; 74interface IWebDocumentView; 75interface IWebDocumentRepresentation; 76interface IWebUndoManager; 77 78interface IAccessibilityDelegate; 79 80/* These are the keys for the WebElementPropertyBag */ 81const LPCOLESTR WebElementDOMNodeKey = L"WebElementDOMNodeKey"; 82const LPCOLESTR WebElementFrameKey = L"WebElementFrameKey"; 83const LPCOLESTR WebElementImageAltStringKey = L"WebElementImageAltStringKey"; 84const LPCOLESTR WebElementImageKey = L"WebElementImageKey"; 85const LPCOLESTR WebElementImageRectKey = L"WebElementImageRectKey"; 86const LPCOLESTR WebElementImageURLKey = L"WebElementImageURLKey"; 87const LPCOLESTR WebElementIsSelectedKey = L"WebElementIsSelectedKey"; 88const LPCOLESTR WebElementMediaURLKey = L"WebElementMediaURLKey"; 89const LPCOLESTR WebElementSpellingToolTipKey = L"WebElementSpellingToolTipKey"; 90const LPCOLESTR WebElementTitleKey = L"WebElementTitleKey"; 91const LPCOLESTR WebElementLinkURLKey = L"WebElementLinkURLKey"; 92const LPCOLESTR WebElementLinkTargetFrameKey = L"WebElementLinkTargetFrameKey"; 93const LPCOLESTR WebElementLinkTitleKey = L"WebElementLinkTitleKey"; 94const LPCOLESTR WebElementLinkLabelKey = L"WebElementLinkLabelKey"; 95const LPCOLESTR WebElementIsContentEditableKey = L"WebElementIsContentEditableKey"; 96 97/*! 98 @class IEnumTextMatches 99*/ 100[ 101 object, 102 oleautomation, 103 uuid(C0CDE63A-5ED1-453f-B937-93B1A61AD3B3), 104 pointer_default(unique) 105] 106interface IEnumTextMatches : IUnknown 107{ 108 HRESULT Next(ULONG celt, RECT* rect, ULONG* pceltFetched); 109 HRESULT Skip(ULONG celt); 110 HRESULT Reset(void); 111 HRESULT Clone(IEnumTextMatches** ppenum); 112}; 113 114/*! 115 @class WebView 116 WebView manages the interaction between WebFrameViews and WebDataSources. Modification 117 of the policies and behavior of the WebKit is largely managed by WebViews and their 118 delegates. 119 120 <p> 121 Typical usage: 122 </p> 123 <pre> 124 WebView *webView; 125 WebFrame *mainFrame; 126 127 webView = [[WebView alloc] initWithFrame: NSMakeRect (0,0,640,480)]; 128 mainFrame = [webView mainFrame]; 129 [mainFrame loadRequest:request]; 130 </pre> 131 132 WebViews have the following delegates: WebUIDelegate, WebResourceLoadDelegate, 133 WebFrameLoadDelegate, and WebPolicyDelegate. 134 135 WebKit depends on the WebView's WebUIDelegate for all window 136 related management, including opening new windows and controlling the user interface 137 elements in those windows. 138 139 WebResourceLoadDelegate is used to monitor the progress of resources as they are 140 loaded. This delegate may be used to present users with a progress monitor. 141 142 The WebFrameLoadDelegate receives messages when the URL in a WebFrame is 143 changed. 144 145 WebView's WebPolicyDelegate can make determinations about how 146 content should be handled, based on the resource's URL and MIME type. 147 148 @interface WebView : NSView 149*/ 150[ 151 object, 152 oleautomation, 153 hidden, 154 uuid(174BBEFD-058E-49c7-91DF-6F110AA4AC28), 155 pointer_default(unique) 156] 157interface IWebView : IUnknown 158{ 159 /*! 160 @method canShowMIMEType: 161 @abstract Checks if the WebKit can show content of a certain MIME type. 162 @param MIMEType The MIME type to check. 163 @result YES if the WebKit can show content with MIMEtype. 164 + (BOOL)canShowMIMEType:(NSString *)MIMEType; 165 */ 166 HRESULT canShowMIMEType([in] BSTR mimeType, [out, retval] BOOL* canShow); 167 168 /*! 169 @method canShowMIMETypeAsHTML: 170 @abstract Checks if the the MIME type is a type that the WebKit will interpret as HTML. 171 @param MIMEType The MIME type to check. 172 @result YES if the MIMEtype in an HTML type. 173 + (BOOL)canShowMIMETypeAsHTML:(NSString *)MIMEType; 174 */ 175 HRESULT canShowMIMETypeAsHTML([in] BSTR mimeType, [out, retval] BOOL* canShow); 176 177 /*! 178 @method MIMETypesShownAsHTML 179 @result Returns an array of NSStrings that describe the MIME types 180 WebKit will attempt to render as HTML. 181 + (NSArray *)MIMETypesShownAsHTML; 182 */ 183 HRESULT MIMETypesShownAsHTML([out, retval] IEnumVARIANT** enumVariant); 184 185 /*! 186 @method setMIMETypesShownAsHTML: 187 @discussion Sets the array of NSString MIME types that WebKit will 188 attempt to render as HTML. Typically you will retrieve the built-in 189 array using MIMETypesShownAsHTML and add additional MIME types to that 190 array. 191 + (void)setMIMETypesShownAsHTML:(NSArray *)MIMETypes; 192 */ 193 HRESULT setMIMETypesShownAsHTML([in, size_is(cMimeTypes)] BSTR* mimeTypes, [in] int cMimeTypes); 194 195 /*! 196 @method URLFromPasteboard: 197 @abstract Returns a URL from a pasteboard 198 @param pasteboard The pasteboard with a URL 199 @result A URL if the pasteboard has one. Nil if it does not. 200 @discussion This method differs than NSURL's URLFromPasteboard method in that it tries multiple pasteboard types 201 including NSURLPboardType to find a URL on the pasteboard. 202 + (NSURL *)URLFromPasteboard:(NSPasteboard *)pasteboard; 203 */ 204 HRESULT URLFromPasteboard([in] IDataObject* pasteboard, [out, retval] BSTR* url); 205 206 /*! 207 @method URLTitleFromPasteboard: 208 @abstract Returns a URL title from a pasteboard 209 @param pasteboard The pasteboard with a URL title 210 @result A URL title if the pasteboard has one. Nil if it does not. 211 @discussion This method returns a title that refers a URL on the pasteboard. An example of this is the link label 212 which is the text inside the anchor tag. 213 + (NSString *)URLTitleFromPasteboard:(NSPasteboard *)pasteboard; 214 */ 215 HRESULT URLTitleFromPasteboard([in] IDataObject* pasteboard, [out, retval] BSTR* urlTitle); 216 217 /*! 218 @method initWithFrame:frameName:groupName: 219 @abstract The designated initializer for WebView. 220 @discussion Initialize a WebView with the supplied parameters. This method will 221 create a main WebFrame with the view. Passing a top level frame name is useful if you 222 handle a targetted frame navigation that would normally open a window in some other 223 way that still ends up creating a new WebView. 224 @param frame The frame used to create the view. 225 @param frameName The name to use for the top level frame. May be nil. 226 @param groupName The name of the webView set to which this webView will be added. May be nil. 227 @result Returns an initialized WebView. 228 - (id)initWithFrame:(NSRect)frame frameName:(NSString *)frameName groupName:(NSString *)groupName; 229 */ 230 HRESULT initWithFrame([in] RECT frame, [in] BSTR frameName, [in] BSTR groupName); 231 232 /*! 233 @method accessibilityDelegate: 234 @abstract Return the WebView's accessibilityDelegate. 235 @param delegate The WebUIDelegate to set as the delegate. 236 - (void)setUIDelegate:(id)delegate; 237 */ 238 HRESULT setAccessibilityDelegate([in] IAccessibilityDelegate *d); 239 240 /*! 241 @method setAccessibilityDelegate: 242 @abstract Set the WebView's accessibilityDelegate. 243 @result The WebView's WebUIDelegate. 244 - (id)UIDelegate; 245 */ 246 HRESULT accessibilityDelegate([out][retval] IAccessibilityDelegate **d); 247 248 /*! 249 @method setUIDelegate: 250 @abstract Set the WebView's WebUIDelegate. 251 @param delegate The WebUIDelegate to set as the delegate. 252 - (void)setUIDelegate:(id)delegate; 253 */ 254 HRESULT setUIDelegate([in] IWebUIDelegate* d); 255 256 /*! 257 @method UIDelegate 258 @abstract Return the WebView's WebUIDelegate. 259 @result The WebView's WebUIDelegate. 260 - (id)UIDelegate; 261 */ 262 HRESULT uiDelegate([retval, out] IWebUIDelegate** d); 263 264 /*! 265 @method setResourceLoadDelegate: 266 @abstract Set the WebView's WebResourceLoadDelegate load delegate. 267 @param delegate The WebResourceLoadDelegate to set as the load delegate. 268 - (void)setResourceLoadDelegate:(id)delegate; 269 */ 270 HRESULT setResourceLoadDelegate([in] IWebResourceLoadDelegate* d); 271 272 /*! 273 @method resourceLoadDelegate 274 @result Return the WebView's WebResourceLoadDelegate. 275 - (id)resourceLoadDelegate; 276 */ 277 HRESULT resourceLoadDelegate([retval, out] IWebResourceLoadDelegate** d); 278 279 /*! 280 @method setDownloadDelegate: 281 @abstract Set the WebView's WebDownloadDelegate. 282 @discussion The download delegate is retained by WebDownload when any downloads are in progress. 283 @param delegate The WebDownloadDelegate to set as the download delegate. 284 - (void)setDownloadDelegate:(id)delegate; 285 */ 286 HRESULT setDownloadDelegate([in] IWebDownloadDelegate* d); 287 288 /*! 289 @method downloadDelegate 290 @abstract Return the WebView's WebDownloadDelegate. 291 @result The WebView's WebDownloadDelegate. 292 - (id)downloadDelegate; 293 */ 294 HRESULT downloadDelegate([retval, out] IWebDownloadDelegate** d); 295 296 /*! 297 @method setFrameLoadDelegate: 298 @abstract Set the WebView's WebFrameLoadDelegate delegate. 299 @param delegate The WebFrameLoadDelegate to set as the delegate. 300 - (void)setFrameLoadDelegate:(id)delegate; 301 */ 302 HRESULT setFrameLoadDelegate([in] IWebFrameLoadDelegate* d); 303 304 /*! 305 @method frameLoadDelegate 306 @abstract Return the WebView's WebFrameLoadDelegate delegate. 307 @result The WebView's WebFrameLoadDelegate delegate. 308 - (id)frameLoadDelegate; 309 */ 310 HRESULT frameLoadDelegate([retval, out] IWebFrameLoadDelegate** d); 311 312 /*! 313 @method setPolicyDelegate: 314 @abstract Set the WebView's WebPolicyDelegate delegate. 315 @param delegate The WebPolicyDelegate to set as the delegate. 316 - (void)setPolicyDelegate:(id)delegate; 317 */ 318 HRESULT setPolicyDelegate([in] IWebPolicyDelegate* d); 319 320 /*! 321 @method policyDelegate 322 @abstract Return the WebView's WebPolicyDelegate. 323 @result The WebView's WebPolicyDelegate. 324 - (id)policyDelegate; 325 */ 326 HRESULT policyDelegate([retval, out] IWebPolicyDelegate** d); 327 328 /*! 329 @method mainFrame 330 @abstract Return the top level frame. 331 @discussion Note that even document that are not framesets will have a 332 mainFrame. 333 @result The main frame. 334 - (WebFrame *)mainFrame; 335 */ 336 HRESULT mainFrame([retval, out] IWebFrame** frame); 337 338 /*! 339 @method focusedFrame 340 @abstract Return the frame that has the current focus. 341 */ 342 HRESULT focusedFrame([retval, out] IWebFrame** frame); 343 344 /*! 345 @method backForwardList 346 @result The backforward list for this webView. 347 - (WebBackForwardList *)backForwardList; 348 */ 349 HRESULT backForwardList([retval, out] IWebBackForwardList** list); 350 351 /*! 352 @method setMaintainsBackForwardList: 353 @abstract Enable or disable the use of a backforward list for this webView. 354 @param flag Turns use of the back forward list on or off 355 - (void)setMaintainsBackForwardList:(BOOL)flag; 356 */ 357 HRESULT setMaintainsBackForwardList([in] BOOL flag); 358 359 /*! 360 @method goBack 361 @abstract Go back to the previous URL in the backforward list. 362 @result YES if able to go back in the backforward list, NO otherwise. 363 - (BOOL)goBack; 364 */ 365 HRESULT goBack([out, retval] BOOL* succeeded); 366 367 /*! 368 @method goForward 369 @abstract Go forward to the next URL in the backforward list. 370 @result YES if able to go forward in the backforward list, NO otherwise. 371 - (BOOL)goForward; 372 */ 373 HRESULT goForward([out, retval] BOOL* succeeded); 374 375 /*! 376 @method goToBackForwardItem: 377 @abstract Go back or forward to an item in the backforward list. 378 @result YES if able to go to the item, NO otherwise. 379 - (BOOL)goToBackForwardItem:(WebHistoryItem *)item; 380 */ 381 HRESULT goToBackForwardItem([in] IWebHistoryItem* item, [out, retval] BOOL* succeeded); 382 383 /*! 384 @method setTextSizeMultiplier: 385 @abstract Change the size of the text rendering in views managed by this webView. 386 @param multiplier A fractional percentage value, 1.0 is 100%. 387 - (void)setTextSizeMultiplier:(float)multiplier; 388 */ 389 HRESULT setTextSizeMultiplier([in] float multiplier); 390 391 /*! 392 @method textSizeMultiplier 393 @result The text size multipler. 394 - (float)textSizeMultiplier; 395 */ 396 HRESULT textSizeMultiplier([out, retval] float* multiplier); 397 398 /*! 399 @method setApplicationNameForUserAgent: 400 @abstract Set the application name. 401 @discussion This name will be used in user-agent strings 402 that are chosen for best results in rendering web pages. 403 @param applicationName The application name 404 - (void)setApplicationNameForUserAgent:(NSString *)applicationName; 405 */ 406 HRESULT setApplicationNameForUserAgent([in] BSTR applicationName); 407 408 /*! 409 @method applicationNameForUserAgent 410 @result The name of the application as used in the user-agent string. 411 - (NSString *)applicationNameForUserAgent; 412 */ 413 HRESULT applicationNameForUserAgent([out, retval] BSTR* applicationName); 414 415 /*! 416 @method setCustomUserAgent: 417 @abstract Set the user agent. 418 @discussion Setting this means that the webView should use this user-agent string 419 instead of constructing a user-agent string for each URL. Setting it to nil 420 causes the webView to construct the user-agent string for each URL 421 for best results rendering web pages. 422 @param userAgentString The user agent description 423 - (void)setCustomUserAgent:(NSString *)userAgentString; 424 */ 425 HRESULT setCustomUserAgent([in] BSTR userAgentString); 426 427 /*! 428 @method customUserAgent 429 @result The custom user-agent string or nil if no custom user-agent string has been set. 430 - (NSString *)customUserAgent; 431 */ 432 HRESULT customUserAgent([out, retval] BSTR* userAgentString); 433 434 /*! 435 @method userAgentForURL: 436 @abstract Get the appropriate user-agent string for a particular URL. 437 @param URL The URL. 438 @result The user-agent string for the supplied URL. 439 - (NSString *)userAgentForURL:(NSURL *)URL; 440 */ 441 HRESULT userAgentForURL([in] BSTR url, [out, retval] BSTR* userAgent); 442 443 /*! 444 @method supportsTextEncoding 445 @abstract Find out if the current web page supports text encodings. 446 @result YES if the document view of the current web page can 447 support different text encodings. 448 - (BOOL)supportsTextEncoding; 449 */ 450 HRESULT supportsTextEncoding([out, retval] BOOL* supports); 451 452 /*! 453 @method setCustomTextEncodingName: 454 @discussion Make the page display with a different text encoding; stops any load in progress. 455 The text encoding passed in overrides the normal text encoding smarts including 456 what's specified in a web page's header or HTTP response. 457 The text encoding automatically goes back to the default when the top level frame 458 changes to a new location. 459 Setting the text encoding name to nil makes the webView use default encoding rules. 460 @param encoding The text encoding name to use to display a page or nil. 461 - (void)setCustomTextEncodingName:(NSString *)encodingName; 462 */ 463 HRESULT setCustomTextEncodingName([in] BSTR encodingName); 464 465 /*! 466 @method customTextEncodingName 467 @result The custom text encoding name or nil if no custom text encoding name has been set. 468 - (NSString *)customTextEncodingName; 469 */ 470 HRESULT customTextEncodingName([out, retval] BSTR* encodingName); 471 472 /*! 473 @method setMediaStyle: 474 @discussion Set the media style for the WebView. The mediaStyle will override the normal value 475 of the CSS media property. Setting the value to nil will restore the normal value. 476 @param mediaStyle The value to use for the CSS media property. 477 - (void)setMediaStyle:(NSString *)mediaStyle; 478 */ 479 HRESULT setMediaStyle([in] BSTR media); 480 481 /*! 482 @method mediaStyle 483 @result mediaStyle The value to use for the CSS media property, as set by setMediaStyle:. It 484 will be nil unless set by that method. 485 - (NSString *)mediaStyle; 486 */ 487 HRESULT mediaStyle([out, retval] BSTR* media); 488 489 /*! 490 @method stringByEvaluatingJavaScriptFromString: 491 @param script The text of the JavaScript. 492 @result The result of the script, converted to a string, or nil for failure. 493 - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script; 494 */ 495 HRESULT stringByEvaluatingJavaScriptFromString([in] BSTR script, [out, retval] BSTR* result); 496 497 /*! 498 @method windowScriptObject 499 @discussion windowScriptObject return a WebScriptObject that represents the 500 window object from the script environment. 501 @result Returns the window object from the script environment. 502 - (WebScriptObject *)windowScriptObject; 503 */ 504 HRESULT windowScriptObject([out, retval] IWebScriptObject** webScriptObject); 505 506 /*! 507 @method setPreferences: 508 @param preferences The preferences to use for the webView. 509 @abstract Override the standard setting for the webView. 510 - (void)setPreferences: (WebPreferences *)prefs; 511 */ 512 HRESULT setPreferences([in] IWebPreferences* prefs); 513 514 /*! 515 @method preferences 516 @result Returns the preferences used by this webView. 517 @discussion This method will return [WebPreferences standardPreferences] if no 518 other instance of WebPreferences has been set. 519 - (WebPreferences *)preferences; 520 */ 521 HRESULT preferences([out, retval] IWebPreferences** prefs); 522 523 /*! 524 @method setPreferencesIdentifier: 525 @param anIdentifier The string to use a prefix for storing values for this WebView in the user 526 defaults database. 527 @discussion If the WebPreferences for this WebView are stored in the user defaults database, the 528 string set in this method will be used a key prefix. 529 - (void)setPreferencesIdentifier:(NSString *)anIdentifier; 530 */ 531 HRESULT setPreferencesIdentifier([in] BSTR anIdentifier); 532 533 /*! 534 @method preferencesIdentifier 535 @result Returns the WebPreferences key prefix. 536 - (NSString *)preferencesIdentifier; 537 */ 538 HRESULT preferencesIdentifier([out, retval] BSTR* anIdentifier); 539 540 /*! 541 @method setHostWindow: 542 @param hostWindow The host window for the web view. 543 @discussion Parts of WebKit (such as plug-ins and JavaScript) depend on a window to function 544 properly. Set a host window so these parts continue to function even when the web view is 545 not in an actual window. 546 - (void)setHostWindow:(NSWindow *)hostWindow; 547 */ 548 HRESULT setHostWindow([in] HWND window); 549 550 /*! 551 @method hostWindow 552 @result The host window for the web view. 553 - (NSWindow *)hostWindow; 554 */ 555 HRESULT hostWindow([out, retval] HWND* window); 556 557 /*! 558 @method searchFor:direction:caseSensitive: 559 @abstract Searches a document view for a string and highlights the string if it is found. 560 Starts the search from the current selection. Will search across all frames. 561 @param string The string to search for. 562 @param forward YES to search forward, NO to seach backwards. 563 @param caseFlag YES to for case-sensitive search, NO for case-insensitive search. 564 @result YES if found, NO if not found. 565 - (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag; 566 */ 567 HRESULT searchFor([in] BSTR str, [in] BOOL forward, [in] BOOL caseFlag, [in] BOOL wrapFlag, [out, retval] BOOL* found); 568 569 /*! 570 @method registerViewClass:representationClass:forMIMEType: 571 @discussion Register classes that implement WebDocumentView and WebDocumentRepresentation respectively. 572 A document class may register for a primary MIME type by excluding 573 a subtype, i.e. "video/" will match the document class with 574 all video types. More specific matching takes precedence 575 over general matching. 576 @param viewClass The WebDocumentView class to use to render data for a given MIME type. 577 @param representationClass The WebDocumentRepresentation class to use to represent data of the given MIME type. 578 @param MIMEType The MIME type to represent with an object of the given class. 579 + (void)registerViewClass:(Class)viewClass representationClass:(Class)representationClass forMIMEType:(NSString *)MIMEType; 580 */ 581 HRESULT registerViewClass([in] IWebDocumentView* view, [in] IWebDocumentRepresentation* representation, [in] BSTR forMIMEType); 582 583 /*! 584 @method setGroupName: 585 @param groupName The name of the group for this WebView. 586 @discussion JavaScript may access named frames within the same group. 587 - (void)setGroupName:(NSString *)groupName; 588 */ 589 HRESULT setGroupName([in] BSTR groupName); 590 591 /*! 592 @method groupName 593 @discussion The group name for this WebView. 594 - (NSString *)groupName; 595 */ 596 HRESULT groupName([out, retval] BSTR* groupName); 597 598 /*! 599 @method estimatedProgress 600 @discussion An estimate of the percent complete for a document load. This 601 value will range from 0 to 1.0 and, once a load completes, will remain at 1.0 602 until a new load starts, at which point it will be reset to 0. The value is an 603 estimate based on the total number of bytes expected to be received 604 for a document, including all it's possible subresources. For more accurate progress 605 indication it is recommended that you implement a WebFrameLoadDelegate and a 606 WebResourceLoadDelegate. 607 - (double)estimatedProgress; 608 */ 609 HRESULT estimatedProgress([out, retval] double* estimatedProgress); 610 611 /*! 612 @method isLoading 613 @discussion Returns YES if there are any pending loads. 614 - (BOOL)isLoading; 615 */ 616 HRESULT isLoading([out, retval] BOOL* isLoading); 617 618 /*! 619 @method elementAtPoint: 620 @param point A point in the coordinates of the WebView 621 @result An element dictionary describing the point 622 - (NSDictionary *)elementAtPoint:(NSPoint)point; 623 */ 624 HRESULT elementAtPoint([in] LPPOINT point, [out, retval] IPropertyBag** elementDictionary); 625 626 /*! 627 @method pasteboardTypesForSelection 628 @abstract Returns the pasteboard types that WebView can use for the current selection 629 - (NSArray *)pasteboardTypesForSelection; 630 */ 631 HRESULT pasteboardTypesForSelection([out, retval] IEnumVARIANT** enumVariant); 632 633 /*! 634 @method writeSelectionWithPasteboardTypes:toPasteboard: 635 @abstract Writes the current selection to the pasteboard 636 @param types The types that WebView will write to the pasteboard 637 @param pasteboard The pasteboard to write to 638 - (void)writeSelectionWithPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard; 639 */ 640 HRESULT writeSelectionWithPasteboardTypes([in, size_is(cTypes)] BSTR* types, [in] int cTypes, [in] IDataObject* pasteboard); 641 642 /*! 643 @method pasteboardTypesForElement: 644 @abstract Returns the pasteboard types that WebView can use for an element 645 @param element The element 646 - (NSArray *)pasteboardTypesForElement:(NSDictionary *)element; 647 */ 648 HRESULT pasteboardTypesForElement([in] IPropertyBag* elementDictionary, [out, retval] IEnumVARIANT** enumVariant); 649 650 /*! 651 @method writeElement:withPasteboardTypes:toPasteboard: 652 @abstract Writes an element to the pasteboard 653 @param element The element to write to the pasteboard 654 @param types The types that WebView will write to the pasteboard 655 @param pasteboard The pasteboard to write to 656 - (void)writeElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard; 657 */ 658 HRESULT writeElement([in] IPropertyBag* elementDictionary, [in, size_is(cWithPasteboardTypes)] BSTR* withPasteboardTypes, [in] int cWithPasteboardTypes, [in] IDataObject* pasteboard); 659 660 /*! 661 @method selectedText 662 @abstract Returns the selection as a string 663 */ 664 HRESULT selectedText([out, retval] BSTR* text); 665 666 /*! 667 @method centerSelectionInVisibleArea 668 @abstract Centers the selected text in the WebView 669 - (void)centerSelectionInVisibleArea:(id)sender; 670 */ 671 HRESULT centerSelectionInVisibleArea([in] IUnknown* sender); 672 673 /*! 674 @method moveDragCaretToPoint: 675 @param point A point in the coordinates of the WebView 676 @discussion This method moves the caret that shows where something being dragged will be dropped. It may cause the WebView to scroll 677 to make the new position of the drag caret visible. 678 - (void)moveDragCaretToPoint:(NSPoint)point; 679 */ 680 HRESULT moveDragCaretToPoint([in] LPPOINT point); 681 682 /*! 683 @method removeDragCaret 684 @abstract Removes the drag caret from the WebView 685 - (void)removeDragCaret; 686 */ 687 HRESULT removeDragCaret(); 688 689 /*! 690 @method setDrawsBackground: 691 @param drawsBackround YES to cause the receiver to draw a default white background, NO otherwise. 692 @abstract Sets whether the receiver draws a default white background when the loaded page has no background specified. 693 - (void)setDrawsBackground:(BOOL)drawsBackround; 694 */ 695 HRESULT setDrawsBackground([in] BOOL drawsBackground); 696 697 /*! 698 @method drawsBackground 699 @result Returns YES if the receiver draws a default white background, NO otherwise. 700 - (BOOL)drawsBackground; 701 */ 702 HRESULT drawsBackground([out, retval] BOOL* drawsBackground); 703 704 /*! 705 @method setMainFrameURL: 706 @param URLString The URL to load in the mainFrame. 707 - (void)setMainFrameURL:(NSString *)URLString; 708 */ 709 HRESULT setMainFrameURL([in] BSTR urlString); 710 711 /*! 712 @method mainFrameURL 713 @result Returns the main frame's current URL. 714 - (NSString *)mainFrameURL; 715 */ 716 HRESULT mainFrameURL([out, retval] BSTR* urlString); 717 718 /*! 719 @method mainFrameDocument 720 @result Returns the main frame's DOMDocument. 721 - (DOMDocument *)mainFrameDocument; 722 */ 723 HRESULT mainFrameDocument([out, retval] IDOMDocument** document); 724 725 /*! 726 @method mainFrameTitle 727 @result Returns the main frame's title if any, otherwise an empty string. 728 - (NSString *)mainFrameTitle; 729 */ 730 HRESULT mainFrameTitle([out, retval] BSTR* title); 731 732 /*! 733 @method mainFrameIcon 734 @discussion The methods returns the site icon for the current page loaded in the mainFrame. 735 @result Returns the main frame's icon if any, otherwise nil. 736 - (NSImage *)mainFrameIcon; 737 */ 738 HRESULT mainFrameIcon([out, retval] HBITMAP* hBitmap); 739 740 /*! 741 @method registerURLSchemeAsLocal 742 @discussion Adds the scheme to the list of schemes to be treated as local. 743 @param scheme The scheme to register. 744 + (void)registerURLSchemeAsLocal:(NSString *)scheme; 745 */ 746 HRESULT registerURLSchemeAsLocal([in] BSTR scheme); 747 748 /*! 749 @method close 750 @abstract Closes the receiver, unloading its web page and canceling any pending loads. 751 Once the receiver has closed, it will no longer respond to requests or fire delegate methods. 752 (However, the -close method itself may fire delegate methods.) 753 @discussion A garbage collected application is required to call close when the receiver is no longer needed. 754 The close method will be called automatically when the window or hostWindow closes and shouldCloseWithWindow returns YES. 755 A non-garbage collected application can still call close, providing a convenient way to prevent receiver 756 from doing any more loading and firing any future delegate methods. 757 */ 758 HRESULT close(); 759} 760 761/* 762 @interface WebView (WebIBActions) <NSUserInterfaceValidations> 763*/ 764[ 765 object, 766 oleautomation, 767 uuid(8F0E3A30-B924-44f8-990A-1AE61ED6C632), 768 pointer_default(unique) 769] 770interface IWebIBActions : IUnknown 771{ 772 /* 773 - (IBAction)takeStringURLFrom:(id)sender; 774 */ 775 HRESULT takeStringURLFrom([in] IUnknown* sender); 776 777 /* 778 - (IBAction)stopLoading:(id)sender; 779 */ 780 HRESULT stopLoading([in] IUnknown* sender); 781 782 /* 783 - (IBAction)reload:(id)sender; 784 */ 785 HRESULT reload([in] IUnknown* sender); 786 787 /* 788 - (BOOL)canGoBack; 789 */ 790 HRESULT canGoBack([in] IUnknown* sender, [out, retval] BOOL* result); 791 792 /* 793 - (IBAction)goBack:(id)sender; 794 */ 795 HRESULT goBack([in] IUnknown* sender); 796 797 /* 798 - (BOOL)canGoForward; 799 */ 800 HRESULT canGoForward([in] IUnknown* sender, [out, retval] BOOL* result); 801 802 /* 803 - (IBAction)goForward:(id)sender; 804 */ 805 HRESULT goForward([in] IUnknown* sender); 806 807 /* 808 - (BOOL)canMakeTextLarger; 809 */ 810 HRESULT canMakeTextLarger([in] IUnknown* sender, [out, retval] BOOL* result); 811 812 /* 813 - (IBAction)makeTextLarger:(id)sender; 814 */ 815 HRESULT makeTextLarger([in] IUnknown* sender); 816 817 /* 818 - (BOOL)canMakeTextSmaller; 819 */ 820 HRESULT canMakeTextSmaller([in] IUnknown* sender, [out, retval] BOOL* result); 821 822 /* 823 - (IBAction)makeTextSmaller:(id)sender; 824 */ 825 HRESULT makeTextSmaller([in] IUnknown* sender); 826 827 /* 828 - (BOOL)canMakeTextStandardSize; 829 */ 830 HRESULT canMakeTextStandardSize([in] IUnknown* sender, [out, retval] BOOL* result); 831 832 /* 833 - (IBAction)makeTextStandardSize:(id)sender; 834 */ 835 HRESULT makeTextStandardSize([in] IUnknown* sender); 836 837 /* 838 - (IBAction)toggleContinuousSpellChecking:(id)sender; 839 */ 840 HRESULT toggleContinuousSpellChecking([in] IUnknown* sender); 841 842 /* 843 - (IBAction)toggleSmartInsertDelete:(id)sender; 844 */ 845 HRESULT toggleSmartInsertDelete([in] IUnknown* sender); 846 847 /* 848 - (void)toggleGrammarChecking:(id)sender 849 */ 850 HRESULT toggleGrammarChecking([in] IUnknown* sender); 851 852 /*! 853 @method setPageSizeMultiplier: 854 @abstract Set a zoom factor for all views managed by this webView. 855 @param multiplier A fractional percentage value, 1.0 is 100%. 856 - (void)setPageSizeMultiplier:(float)multiplier; 857 */ 858 HRESULT setPageSizeMultiplier([in] float multiplier); 859 860 /*! 861 @method pageSizeMultiplier 862 @result The page size multipler. 863 - (float)pageSizeMultiplier; 864 */ 865 HRESULT pageSizeMultiplier([out, retval] float* multiplier); 866 867 /* 868 - (BOOL)canZoomPageIn; 869 */ 870 HRESULT canZoomPageIn([in] IUnknown* sender, [out, retval] BOOL* result); 871 872 /* 873 - (IBAction)zoomPageIn:(id)sender; 874 */ 875 HRESULT zoomPageIn([in] IUnknown* sender); 876 877 /* 878 - (BOOL)canZoomPageOut; 879 */ 880 HRESULT canZoomPageOut([in] IUnknown* sender, [out, retval] BOOL* result); 881 882 /* 883 - (IBAction)zoomPageOut:(id)sender; 884 */ 885 HRESULT zoomPageOut([in] IUnknown* sender); 886 887 /* 888 - (BOOL)canResetPageZoom; 889 */ 890 HRESULT canResetPageZoom([in] IUnknown* sender, [out, retval] BOOL* result); 891 892 /* 893 - (IBAction)resetPageZoom:(id)sender; 894 */ 895 HRESULT resetPageZoom([in] IUnknown* sender); 896 897 /* 898 - (IBAction)reloadFromOrigin:(id)sender; 899 */ 900 HRESULT reloadFromOrigin([in] IUnknown* sender); 901} 902 903/* 904 @interface WebView (WebViewCSS) 905*/ 906[ 907 object, 908 oleautomation, 909 uuid(ADF68A8C-336F-405c-A053-3D11A9D5B092), 910 pointer_default(unique) 911] 912interface IWebViewCSS : IUnknown 913{ 914 /* 915 - (DOMCSSStyleDeclaration *)computedStyleForElement:(DOMElement *)element pseudoElement:(NSString *)pseudoElement; 916 */ 917 HRESULT computedStyleForElement([in] IDOMElement* element, [in] BSTR pseudoElement, [out, retval] IDOMCSSStyleDeclaration** style); 918} 919 920/* 921 @interface WebView (WebViewEditing) 922*/ 923[ 924 object, 925 oleautomation, 926 uuid(07BDAC9A-19A1-4086-864D-BAD9E0F00D5C), 927 pointer_default(unique) 928] 929interface IWebViewEditing : IUnknown 930{ 931 /* 932 - (DOMRange *)editableDOMRangeForPoint:(NSPoint)point; 933 */ 934 HRESULT editableDOMRangeForPoint([in] LPPOINT point, [out, retval] IDOMRange** range); 935 936 /* 937 - (void)setSelectedDOMRange:(DOMRange *)range affinity:(NSSelectionAffinity)selectionAffinity; 938 */ 939 HRESULT setSelectedDOMRange([in] IDOMRange* range, [in] WebSelectionAffinity affinity); 940 941 /* 942 - (DOMRange *)selectedDOMRange; 943 */ 944 HRESULT selectedDOMRange([out, retval] IDOMRange** range); 945 946 /* 947 - (NSSelectionAffinity)selectionAffinity; 948 */ 949 HRESULT selectionAffinity([out, retval] [out, retval] WebSelectionAffinity* affinity); 950 951 /* 952 - (void)setEditable:(BOOL)flag; 953 */ 954 HRESULT setEditable([in] BOOL flag); 955 956 /* 957 - (BOOL)isEditable; 958 */ 959 HRESULT isEditable([out, retval] BOOL* isEditable); 960 961 /* 962 - (void)setTypingStyle:(DOMCSSStyleDeclaration *)style; 963 */ 964 HRESULT setTypingStyle([in] IDOMCSSStyleDeclaration* style); 965 966 /* 967 - (DOMCSSStyleDeclaration *)typingStyle; 968 */ 969 HRESULT typingStyle([out, retval] IDOMCSSStyleDeclaration** style); 970 971 /* 972 - (void)setSmartInsertDeleteEnabled:(BOOL)flag; 973 */ 974 HRESULT setSmartInsertDeleteEnabled([in] BOOL flag); 975 976 /* 977 - (BOOL)smartInsertDeleteEnabled; 978 */ 979 HRESULT smartInsertDeleteEnabled([out, retval] BOOL* enabled); 980 981 /* 982 - (void)setContinuousSpellCheckingEnabled:(BOOL)flag; 983 */ 984 HRESULT setContinuousSpellCheckingEnabled([in] BOOL flag); 985 986 /* 987 - (BOOL)isContinuousSpellCheckingEnabled; 988 */ 989 HRESULT isContinuousSpellCheckingEnabled([out, retval] BOOL* enabled); 990 991 /* 992 - (WebNSInt)spellCheckerDocumentTag; 993 */ 994 HRESULT spellCheckerDocumentTag([out, retval] int* tag); 995 996 /* 997 - (NSUndoManager *)undoManager; 998 */ 999 HRESULT undoManager([out, retval] IWebUndoManager** manager); 1000 1001 /* 1002 - (void)setEditingDelegate:(id)delegate; 1003 */ 1004 HRESULT setEditingDelegate([in] IWebEditingDelegate* d); 1005 1006 /* 1007 - (id)editingDelegate; 1008 */ 1009 HRESULT editingDelegate([out, retval] IWebEditingDelegate** d); 1010 1011 /* 1012 - (DOMCSSStyleDeclaration *)styleDeclarationWithText:(NSString *)text; 1013 */ 1014 HRESULT styleDeclarationWithText([in] BSTR text, [out, retval] IDOMCSSStyleDeclaration** style); 1015 1016 /* 1017 - (BOOL)hasSelectedRange; 1018 */ 1019 HRESULT hasSelectedRange([out, retval] BOOL* hasSelectedRange); 1020 1021 /* 1022 - (BOOL)cutEnabled; 1023 */ 1024 HRESULT cutEnabled([out, retval] BOOL* enabled); 1025 1026 /* 1027 - (BOOL)copyEnabled; 1028 */ 1029 HRESULT copyEnabled([out, retval] BOOL* enabled); 1030 1031 /* 1032 - (BOOL)pasteEnabled; 1033 */ 1034 HRESULT pasteEnabled([out, retval] BOOL* enabled); 1035 1036 /* 1037 - (BOOL)deleteEnabled; 1038 */ 1039 HRESULT deleteEnabled([out, retval] BOOL* enabled); 1040 1041 /* 1042 - (BOOL)editingEnabled; 1043 */ 1044 HRESULT editingEnabled([out, retval] BOOL* enabled); 1045 1046 /* 1047 - (BOOL)isGrammarCheckingEnabled 1048 */ 1049 HRESULT isGrammarCheckingEnabled([out, retval] BOOL* enabled); 1050 1051 /* 1052 - (void)setGrammarCheckingEnabled:(BOOL)flag 1053 */ 1054 HRESULT setGrammarCheckingEnabled(BOOL enabled); 1055 1056 /* 1057 - (void)setSelectTrailingWhitespaceEnabled:(BOOL)flag; 1058 */ 1059 HRESULT setSelectTrailingWhitespaceEnabled([in] BOOL flag); 1060 1061 /* 1062 - (BOOL)selectTrailingWhitespaceEnabled; 1063 */ 1064 HRESULT isSelectTrailingWhitespaceEnabled([out, retval] BOOL* enabled); 1065} 1066 1067/* 1068 @interface WebView (WebViewUndoableEditing) 1069*/ 1070[ 1071 object, 1072 oleautomation, 1073 uuid(639E7121-13C8-4a12-BC18-6E1F3D68F3C3), 1074 pointer_default(unique) 1075] 1076interface IWebViewUndoableEditing : IUnknown 1077{ 1078 /* 1079 - (void)replaceSelectionWithNode:(DOMNode *)node; 1080 */ 1081 HRESULT replaceSelectionWithNode([in] IDOMNode* node); 1082 1083 /* 1084 - (void)replaceSelectionWithText:(NSString *)text; 1085 */ 1086 HRESULT replaceSelectionWithText([in] BSTR text); 1087 1088 /* 1089 - (void)replaceSelectionWithMarkupString:(NSString *)markupString; 1090 */ 1091 HRESULT replaceSelectionWithMarkupString([in] BSTR markupString); 1092 1093 /* 1094 - (void)replaceSelectionWithArchive:(WebArchive *)archive; 1095 */ 1096 HRESULT replaceSelectionWithArchive([in] IWebArchive* archive); 1097 1098 /* 1099 - (void)deleteSelection; 1100 */ 1101 HRESULT deleteSelection(); 1102 1103 /* 1104 - (void)clearSelection; 1105 */ 1106 HRESULT clearSelection(); 1107 1108 /* 1109 - (void)applyStyle:(DOMCSSStyleDeclaration *)style; 1110 */ 1111 HRESULT applyStyle([in] IDOMCSSStyleDeclaration* style); 1112} 1113 1114/* 1115 @interface WebView (WebViewEditingActions) 1116*/ 1117[ 1118 object, 1119 oleautomation, 1120 uuid(7E066C42-8E81-4778-888D-D6CC93E27D4C), 1121 pointer_default(unique) 1122] 1123interface IWebViewEditingActions : IUnknown 1124{ 1125 /* 1126 - (void)copy:(id)sender; 1127 */ 1128 HRESULT copy([in] IUnknown* sender); 1129 1130 /* 1131 - (void)cut:(id)sender; 1132 */ 1133 HRESULT cut([in] IUnknown* sender); 1134 1135 /* 1136 - (void)paste:(id)sender; 1137 */ 1138 HRESULT paste([in] IUnknown* sender); 1139 1140 /* 1141 - (void)copyURL:(id)sender; 1142 */ 1143 HRESULT copyURL([in] BSTR url); 1144 1145 /* 1146 - (void)copyFont:(id)sender; 1147 */ 1148 HRESULT copyFont([in] IUnknown* sender); 1149 1150 /* 1151 - (void)pasteFont:(id)sender; 1152 */ 1153 HRESULT pasteFont([in] IUnknown* sender); 1154 1155 /* 1156 - (void)delete:(id)sender; 1157 */ 1158 HRESULT delete_([in] IUnknown* sender); 1159 1160 /* 1161 - (void)pasteAsPlainText:(id)sender; 1162 */ 1163 HRESULT pasteAsPlainText([in] IUnknown* sender); 1164 1165 /* 1166 - (void)pasteAsRichText:(id)sender; 1167 */ 1168 HRESULT pasteAsRichText([in] IUnknown* sender); 1169 1170 1171 /* 1172 - (void)changeFont:(id)sender; 1173 */ 1174 HRESULT changeFont([in] IUnknown* sender); 1175 1176 /* 1177 - (void)changeAttributes:(id)sender; 1178 */ 1179 HRESULT changeAttributes([in] IUnknown* sender); 1180 1181 /* 1182 - (void)changeDocumentBackgroundColor:(id)sender; 1183 */ 1184 HRESULT changeDocumentBackgroundColor([in] IUnknown* sender); 1185 1186 /* 1187 - (void)changeColor:(id)sender; 1188 */ 1189 HRESULT changeColor([in] IUnknown* sender); 1190 1191 1192 /* 1193 - (void)alignCenter:(id)sender; 1194 */ 1195 HRESULT alignCenter([in] IUnknown* sender); 1196 1197 /* 1198 - (void)alignJustified:(id)sender; 1199 */ 1200 HRESULT alignJustified([in] IUnknown* sender); 1201 1202 /* 1203 - (void)alignLeft:(id)sender; 1204 */ 1205 HRESULT alignLeft([in] IUnknown* sender); 1206 1207 /* 1208 - (void)alignRight:(id)sender; 1209 */ 1210 HRESULT alignRight([in] IUnknown* sender); 1211 1212 1213 /* 1214 - (void)checkSpelling:(id)sender; 1215 */ 1216 HRESULT checkSpelling([in] IUnknown* sender); 1217 1218 /* 1219 - (void)showGuessPanel:(id)sender; 1220 */ 1221 HRESULT showGuessPanel([in] IUnknown* sender); 1222 1223 /* 1224 - (void)performFindPanelAction:(id)sender; 1225 */ 1226 HRESULT performFindPanelAction([in] IUnknown* sender); 1227 1228 1229 /* 1230 - (void)startSpeaking:(id)sender; 1231 */ 1232 HRESULT startSpeaking([in] IUnknown* sender); 1233 1234 /* 1235 - (void)stopSpeaking:(id)sender; 1236 */ 1237 HRESULT stopSpeaking([in] IUnknown* sender); 1238} 1239 1240 1241 1242