Home | History | Annotate | Download | only in Interfaces
      1 /*
      2  * Copyright (C) 2006, 2007, 2008, 2009 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 COMPUTER, 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 COMPUTER, 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 
     26 #ifndef DO_NO_IMPORTS
     27 import "oaidl.idl";
     28 import "ocidl.idl";
     29 import "IWebUndoTarget.idl";
     30 import "IWebURLRequest.idl";
     31 import "IWebFrame.idl";
     32 #endif
     33 
     34 interface IWebFrame;
     35 interface IWebView;
     36 interface IWebURLRequest;
     37 interface IWebUndoTarget;
     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 typedef enum WebMenuItemTag {
     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     // FIXME: Review these names before release!
     79     WebMenuItemTagOpenLink = 2000,
     80     WebMenuItemTagIgnoreGrammar,
     81     WebtMenuItemTagSpellingMenu,
     82     WebMenuItemTagShowSpellingPanel,
     83     WebMenuItemTagCheckSpelling,
     84     WebMenuItemTagCheckSpellingWhileTyping,
     85     WebMenuItemTagCheckGrammarWithSpelling,
     86     WebMenuItemTagFontMenu,
     87     WebMenuItemTagShowFonts,
     88     WebMenuItemTagBold,
     89     WebMenuItemTagItalic,
     90     WebMenuItemTagUnderline,
     91     WebMenuItemTagOutline,
     92     WebMenuItemTagStyles,
     93     WebMenuItemTagShowColors,
     94     WebMenuItemTagSpeechMenu,
     95     WebMenuItemTagStartSpeaking,
     96     WebMenuItemTagStopSpeaking,
     97     WebMenuItemTagWritingDirectionMenu,
     98     WebMenuItemTagDefaultDirection,
     99     WebMenuItemTagLeftToRight,
    100     WebMenuItemTagRightToLeft,
    101     WebMenuItemTagPDFSinglePageScrolling,
    102     WebMenuItemTagPDFFacingPagesScrolling,
    103     WebMenuItemTagInspectElement,
    104     WebMenuItemBaseApplicationTag=10000
    105 } WebMenuItemTag;
    106 
    107 /*!
    108     @enum WebDragDestinationAction
    109     @abstract Actions that the destination of a drag can perform.
    110     @constant WebDragDestinationActionNone No action
    111     @constant WebDragDestinationActionDHTML Allows DHTML (such as JavaScript) to handle the drag
    112     @constant WebDragDestinationActionEdit Allows editable documents to be edited from the drag
    113     @constant WebDragDestinationActionLoad Allows a location change from the drag
    114     @constant WebDragDestinationActionAny Allows any of the above to occur
    115 */
    116 typedef enum WebDragDestinationAction {
    117     WebDragDestinationActionNone    = 0,
    118     WebDragDestinationActionDHTML   = 1,
    119     WebDragDestinationActionEdit    = 2,
    120     WebDragDestinationActionLoad    = 4,
    121     WebDragDestinationActionAny     = (unsigned long)-1
    122 } WebDragDestinationAction;
    123 
    124 /*!
    125     @enum WebDragSourceAction
    126     @abstract Actions that the source of a drag can perform.
    127     @constant WebDragSourceActionNone No action
    128     @constant WebDragSourceActionDHTML Allows DHTML (such as JavaScript) to start a drag
    129     @constant WebDragSourceActionImage Allows an image drag to occur
    130     @constant WebDragSourceActionLink Allows a link drag to occur
    131     @constant WebDragSourceActionSelection Allows a selection drag to occur
    132     @constant WebDragSourceActionAny Allows any of the above to occur
    133 */
    134 typedef enum WebDragSourceAction {
    135     WebDragSourceActionNone         = 0,
    136     WebDragSourceActionDHTML        = 1,
    137     WebDragSourceActionImage        = 2,
    138     WebDragSourceActionLink         = 4,
    139     WebDragSourceActionSelection    = 8,
    140     WebDragSourceActionAny          = (unsigned long)-1
    141 } WebDragSourceAction;
    142 
    143 
    144 /*!
    145     @protocol WebOpenPanelResultListener
    146     @discussion This protocol is used to call back with the results of
    147     the file open panel requested by runOpenPanelForFileButtonWithResultListener:
    148     @protocol WebOpenPanelResultListener <NSObject>
    149 */
    150 [
    151     object,
    152     oleautomation,
    153     uuid(634198C7-9DFC-4aba-9E8C-90AEEA7A4144),
    154     pointer_default(unique)
    155 ]
    156 interface IWebOpenPanelResultListener : IUnknown
    157 {
    158     /*!
    159         @method chooseFilename:
    160         @abstract Call this method to return a filename from the file open panel.
    161         @param fileName
    162         - (void)chooseFilename:(NSString *)fileName;
    163     */
    164     HRESULT chooseFilename([out, retval] BSTR* fileName);
    165 
    166     /*!
    167         @method cancel
    168         @abstract Call this method to indicate that the file open panel was cancelled.
    169         - (void)cancel;
    170     */
    171     HRESULT cancel();
    172 }
    173 
    174 /*!
    175     @category WebUIDelegate
    176     @discussion A class that implements WebUIDelegate provides
    177     window-related methods that may be used by Javascript, plugins and
    178     other aspects of web pages. These methods are used to open new
    179     windows and control aspects of existing windows.
    180     @interface NSObject (WebUIDelegate)
    181 */
    182 [
    183     object,
    184     oleautomation,
    185     uuid(042B7EE3-A5A4-4a8f-8C33-775CD9E89C7C),
    186     pointer_default(unique)
    187 ]
    188 interface IWebUIDelegate : IUnknown
    189 {
    190     /*!
    191         @method webView:createWebViewWithRequest:
    192         @abstract Create a new window and begin to load the specified request.
    193         @discussion The newly created window is hidden, and the window operations delegate on the
    194         new WebViews will get a webViewShow: call.
    195         @param sender The WebView sending the delegate method.
    196         @param request The request to load.
    197         @result The WebView for the new window.
    198         - (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request;
    199     */
    200     HRESULT createWebViewWithRequest([in] IWebView* sender, [in] IWebURLRequest* request, [out, retval] IWebView** newWebView);
    201 
    202     /*!
    203         @method webViewShow:
    204         @param sender The WebView sending the delegate method.
    205         @abstract Show the window that contains the top level view of the WebView,
    206         ordering it frontmost.
    207         @discussion This will only be called just after createWindowWithRequest:
    208         is used to create a new window.
    209         - (void)webViewShow:(WebView *)sender;
    210     */
    211     HRESULT webViewShow([in] IWebView* sender);
    212 
    213     /*!
    214         @method webViewClose:
    215         @abstract Close the current window.
    216         @param sender The WebView sending the delegate method.
    217         @discussion Clients showing multiple views in one window may
    218         choose to close only the one corresponding to this
    219         WebView. Other clients may choose to ignore this method
    220         entirely.
    221         - (void)webViewClose:(WebView *)sender;
    222     */
    223     HRESULT webViewClose([in] IWebView* sender);
    224 
    225     /*!
    226         @method webViewFocus:
    227         @abstract Focus the current window (i.e. makeKeyAndOrderFront:).
    228         @param The WebView sending the delegate method.
    229         @discussion Clients showing multiple views in one window may want to
    230         also do something to focus the one corresponding to this WebView.
    231         - (void)webViewFocus:(WebView *)sender;
    232     */
    233     HRESULT webViewFocus([in] IWebView* sender);
    234 
    235     /*!
    236         @method webViewUnfocus:
    237         @abstract Unfocus the current window.
    238         @param sender The WebView sending the delegate method.
    239         @discussion Clients showing multiple views in one window may want to
    240         also do something to unfocus the one corresponding to this WebView.
    241         - (void)webViewUnfocus:(WebView *)sender;
    242     */
    243     HRESULT webViewUnfocus([in] IWebView* sender);
    244 
    245     /*!
    246         @method webViewFirstResponder:
    247         @abstract Get the first responder for this window.
    248         @param sender The WebView sending the delegate method.
    249         @discussion This method should return the focused control in the
    250         WebView's view, if any. If the view is out of the window
    251         hierarchy, this might return something than calling firstResponder
    252         on the real NSWindow would. It's OK to return either nil or the
    253         real first responder if some control not in the window has focus.
    254         - (NSResponder *)webViewFirstResponder:(WebView *)sender;
    255     */
    256     HRESULT webViewFirstResponder([in] IWebView* sender, [out, retval] OLE_HANDLE* responderHWnd);
    257 
    258     /*!
    259         @method webView:makeFirstResponder:
    260         @abstract Set the first responder for this window.
    261         @param sender The WebView sending the delegate method.
    262         @param responder The responder to make first (will always be a view)
    263         @discussion responder will always be a view that is in the view
    264         subhierarchy of the top-level web view for this WebView. If the
    265         WebView's top level view is currently out of the view
    266         hierarchy, it may be desirable to save the first responder
    267         elsewhere, or possibly ignore this call.
    268         - (void)webView:(WebView *)sender makeFirstResponder:(NSResponder *)responder;
    269     */
    270     HRESULT makeFirstResponder([in] IWebView* sender, [in] OLE_HANDLE responderHWnd);
    271 
    272     /*!
    273         @method webView:setStatusText:
    274         @abstract Set the window's status display, if any, to the specified string.
    275         @param sender The WebView sending the delegate method.
    276         @param text The status text to set
    277         - (void)webView:(WebView *)sender setStatusText:(NSString *)text;
    278     */
    279     HRESULT setStatusText([in] IWebView* sender, [in] BSTR text);
    280 
    281     /*!
    282         @method webViewStatusText:
    283         @abstract Get the currently displayed status text.
    284         @param sender The WebView sending the delegate method.
    285         @result The status text
    286         - (NSString *)webViewStatusText:(WebView *)sender;
    287     */
    288     HRESULT webViewStatusText([in] IWebView* sender, [out, retval] BSTR* text);
    289 
    290     /*!
    291         @method webViewAreToolbarsVisible:
    292         @abstract Determine whether the window's toolbars are currently visible
    293         @param sender The WebView sending the delegate method.
    294         @discussion This method should return YES if the window has any
    295         toolbars that are currently on, besides the status bar. If the app
    296         has more than one toolbar per window, for example a regular
    297         command toolbar and a favorites bar, it should return YES from
    298         this method if at least one is on.
    299         @result YES if at least one toolbar is visible, otherwise NO.
    300         - (BOOL)webViewAreToolbarsVisible:(WebView *)sender;
    301     */
    302     HRESULT webViewAreToolbarsVisible([in] IWebView* sender, [out, retval] BOOL* visible);
    303 
    304     /*!
    305         @method webView:setToolbarsVisible:
    306         @param sender The WebView sending the delegate method.
    307         @abstract Set whether the window's toolbars are currently visible.
    308         @param visible New value for toolbar visibility
    309         @discussion Setting this to YES should turn on all toolbars
    310         (except for a possible status bar). Setting it to NO should turn
    311         off all toolbars (with the same exception).
    312         - (void)webView:(WebView *)sender setToolbarsVisible:(BOOL)visible;
    313     */
    314     HRESULT setToolbarsVisible([in] IWebView* sender, [in] BOOL visible);
    315 
    316     /*!
    317         @method webViewIsStatusBarVisible:
    318         @abstract Determine whether the status bar is visible.
    319         @param sender The WebView sending the delegate method.
    320         @result YES if the status bar is visible, otherwise NO.
    321         - (BOOL)webViewIsStatusBarVisible:(WebView *)sender;
    322     */
    323     HRESULT webViewIsStatusBarVisible([in] IWebView* sender, [out, retval] BOOL* visible);
    324 
    325     /*!
    326         @method webView:setStatusBarVisible:
    327         @abstract Set whether the status bar is currently visible.
    328         @param visible The new visibility value
    329         @discussion Setting this to YES should show the status bar,
    330         setting it to NO should hide it.
    331         - (void)webView:(WebView *)sender setStatusBarVisible:(BOOL)visible;
    332     */
    333     HRESULT setStatusBarVisible([in] IWebView* sender, [in] BOOL visible);
    334 
    335     /*!
    336         @method webViewIsResizable:
    337         @abstract Determine whether the window is resizable or not.
    338         @param sender The WebView sending the delegate method.
    339         @result YES if resizable, NO if not.
    340         @discussion If there are multiple views in the same window, they
    341         have have their own separate resize controls and this may need to
    342         be handled specially.
    343         - (BOOL)webViewIsResizable:(WebView *)sender;
    344     */
    345     HRESULT webViewIsResizable([in] IWebView* sender, [out, retval] BOOL* resizable);
    346 
    347     /*!
    348         @method webView:setResizable:
    349         @abstract Set the window to resizable or not
    350         @param sender The WebView sending the delegate method.
    351         @param resizable YES if the window should be made resizable, NO if not.
    352         @discussion If there are multiple views in the same window, they
    353         have have their own separate resize controls and this may need to
    354         be handled specially.
    355         - (void)webView:(WebView *)sender setResizable:(BOOL)resizable;
    356     */
    357     HRESULT setResizable([in] IWebView* sender, [in] BOOL resizable);
    358 
    359     /*!
    360         @method webView:setFrame:
    361         @abstract Set the window's frame rect
    362         @param sender The WebView sending the delegate method.
    363         @param frame The new window frame size
    364         @discussion Even though a caller could set the frame directly using the NSWindow,
    365         this method is provided so implementors of this protocol can do special
    366         things on programmatic move/resize, like avoiding autosaving of the size.
    367         - (void)webView:(WebView *)sender setFrame:(NSRect)frame;
    368     */
    369     HRESULT setFrame([in] IWebView* sender, [in] RECT* frame);
    370 
    371     /*!
    372         @method webViewFrame:
    373         @param sender The WebView sending the delegate method.
    374         @abstract REturn the window's frame rect
    375         @discussion
    376         - (NSRect)webViewFrame:(WebView *)sender;
    377     */
    378     HRESULT webViewFrame([in] IWebView* sender, [out, retval] RECT* frame);
    379 
    380     /*!
    381         @method webView:setContentRect:
    382         @abstract Set the window's content rect
    383         @param sender The WebView sending the delegate method.
    384         @param frame The new window content rect
    385         @discussion Even though a caller could set the content rect
    386         directly using the NSWindow, this method is provided so
    387         implementors of this protocol can do special things on
    388         programmatic move/resize, like avoiding autosaving of the size.
    389         - (void)webView:(WebView *)sender setContentRect:(NSRect)contentRect;
    390     */
    391     HRESULT setContentRect([in] IWebView* sender, [in] RECT* contentRect);
    392 
    393     /*!
    394         @method webViewContentRect:
    395         @abstract Return the window's content rect
    396         @discussion
    397         - (NSRect)webViewContentRect:(WebView *)sender;
    398     */
    399     HRESULT webViewContentRect([in] IWebView* sender, [out, retval] RECT* contentRect);
    400 
    401     /*!
    402         @method webView:runJavaScriptAlertPanelWithMessage:
    403         @abstract Display a JavaScript alert panel
    404         @param sender The WebView sending the delegate method.
    405         @param message The message to display
    406         @discussion Clients should visually indicate that this panel comes
    407         from JavaScript. The panel should have a single OK button.
    408         - (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message;
    409     */
    410     HRESULT runJavaScriptAlertPanelWithMessage([in] IWebView* sender, [in] BSTR message);
    411 
    412     /*!
    413         @method webView:runJavaScriptConfirmPanelWithMessage:
    414         @abstract Display a JavaScript confirm panel
    415         @param sender The WebView sending the delegate method.
    416         @param message The message to display
    417         @result YES if the user hit OK, no if the user chose Cancel.
    418         @discussion Clients should visually indicate that this panel comes
    419         from JavaScript. The panel should have two buttons, e.g. "OK" and
    420         "Cancel".
    421         - (BOOL)webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message;
    422     */
    423     HRESULT runJavaScriptConfirmPanelWithMessage([in] IWebView* sender, [in] BSTR message, [out, retval] BOOL* result);
    424 
    425     /*!
    426         @method webView:runJavaScriptTextInputPanelWithPrompt:defaultText:
    427         @abstract Display a JavaScript text input panel
    428         @param sender The WebView sending the delegate method.
    429         @param message The message to display
    430         @param defaultText The initial text for the text entry area.
    431         @result The typed text if the user hit OK, otherwise nil.
    432         @discussion Clients should visually indicate that this panel comes
    433         from JavaScript. The panel should have two buttons, e.g. "OK" and
    434         "Cancel", and an area to type text.
    435         - (NSString *)webView:(WebView *)sender runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText;
    436     */
    437     HRESULT runJavaScriptTextInputPanelWithPrompt([in] IWebView* sender, [in] BSTR message, [in] BSTR defaultText, [out, retval] BSTR* result);
    438 
    439     /*!
    440         @method webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:
    441         @abstract Display a confirm panel by an "before unload" event handler.
    442         @param sender The WebView sending the delegate method.
    443         @param message The message to display.
    444         @param frame The WebFrame whose JavaScript initiated this call.
    445         @result YES if the user hit OK, NO if the user chose Cancel.
    446         @discussion Clients should include a message in addition to the one
    447         supplied by the web page that indicates. The panel should have
    448         two buttons, e.g. "OK" and "Cancel".
    449         - (BOOL)webView:(WebView *)sender runBeforeUnloadConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame;
    450     */
    451     HRESULT runBeforeUnloadConfirmPanelWithMessage([in] IWebView* sender, [in] BSTR message, [in] IWebFrame* initiatedByFrame, [out, retval] BOOL* result);
    452 
    453     /*!
    454         @method webView:runOpenPanelForFileButtonWithResultListener:
    455         @abstract Display a file open panel for a file input control.
    456         @param sender The WebView sending the delegate method.
    457         @param resultListener The object to call back with the results.
    458         @discussion This method is passed a callback object instead of giving a return
    459         value so that it can be handled with a sheet.
    460         - (void)webView:(WebView *)sender runOpenPanelForFileButtonWithResultListener:(id<WebOpenPanelResultListener>)resultListener;
    461     */
    462     HRESULT runOpenPanelForFileButtonWithResultListener([in] IWebView* sender, [in] IWebOpenPanelResultListener* resultListener);
    463 
    464     /*!
    465         @method webView:mouseDidMoveOverElement:modifierFlags:
    466         @abstract Update the window's feedback for mousing over links to reflect a new item the mouse is over
    467         or new modifier flags.
    468         @param sender The WebView sending the delegate method.
    469         @param elementInformation Dictionary that describes the element that the mouse is over, or nil.
    470         @param modifierFlags The modifier flags as in NSEvent.
    471         - (void)webView:(WebView *)sender mouseDidMoveOverElement:(NSDictionary *)elementInformation modifierFlags:(WebNSUInt)modifierFlags;
    472     */
    473     HRESULT mouseDidMoveOverElement([in] IWebView* sender, [in] IPropertyBag* elementInformation, [in] UINT modifierFlags);
    474 
    475     /*!
    476         @method webView:contextMenuItemsForElement:defaultMenuItems:
    477         @abstract Returns the menu items to display in an element's contextual menu.
    478         @param sender The WebView sending the delegate method.
    479         @param element A dictionary representation of the clicked element.
    480         @param defaultMenuItems An array of default NSMenuItems to include in all contextual menus.
    481         @result An array of NSMenuItems to include in the contextual menu.
    482         - (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems;
    483     */
    484     HRESULT contextMenuItemsForElement([in] IWebView* sender, [in] IPropertyBag* element, [in] OLE_HANDLE defaultItemsHMenu, [out, retval] OLE_HANDLE* resultHMenu);
    485 
    486     /*!
    487         @method webView:validateUserInterfaceItem:defaultValidation:
    488         @abstract Controls UI validation
    489         @param webView The WebView sending the delegate method
    490         @param item The user interface item being validated
    491         @pararm defaultValidation Whether or not the WebView thinks the item is valid
    492         @discussion This method allows the UI delegate to control WebView's validation of user interface items.
    493         See WebView.h to see the methods to that WebView can currently validate. See NSUserInterfaceValidations and
    494         NSValidatedUserInterfaceItem for information about UI validation.
    495         - (BOOL)webView:(WebView *)webView validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item defaultValidation:(BOOL)defaultValidation;
    496     */
    497     HRESULT validateUserInterfaceItem([in] IWebView* webView, [in] UINT itemCommandID, [in] BOOL defaultValidation, [out, retval] BOOL* isValid);
    498 
    499     /*!
    500         @method webView:shouldPerformAction:fromSender:
    501         @abstract Controls actions
    502         @param webView The WebView sending the delegate method
    503         @param action The action being sent
    504         @param sender The sender of the action
    505         @discussion This method allows the UI delegate to control WebView's behavior when an action is being sent.
    506         For example, if the action is copy:, the delegate can return YES to allow WebView to perform its default
    507         copy behavior or return NO and perform copy: in some other way. See WebView.h to see the actions that
    508         WebView can perform.
    509         - (BOOL)webView:(WebView *)webView shouldPerformAction:(SEL)action fromSender:(id)sender;
    510     */
    511     HRESULT shouldPerformAction([in] IWebView* webView, [in] UINT itemCommandID, [in] UINT sender);
    512 
    513     /*!
    514         @method webView:dragDestinationActionMaskForDraggingInfo:
    515         @abstract Controls behavior when dragging to a WebView
    516         @param webView The WebView sending the delegate method
    517         @param draggingInfo The dragging info of the drag
    518         @discussion This method is called periodically as something is dragged over a WebView. The UI delegate can return a mask
    519         indicating which drag destination actions can occur, WebDragDestinationActionAny to allow any kind of action or
    520         WebDragDestinationActionNone to not accept the drag.
    521         - (unsigned)webView:(WebView *)webView dragDestinationActionMaskForDraggingInfo:(id <NSDraggingInfo>)draggingInfo;
    522     */
    523     HRESULT dragDestinationActionMaskForDraggingInfo([in] IWebView* webView, [in] IDataObject* draggingInfo, [out, retval] WebDragDestinationAction* action);
    524 
    525     /*!
    526         @method webView:willPerformDragDestinationAction:forDraggingInfo:
    527         @abstract Informs that WebView will perform a drag destination action
    528         @param webView The WebView sending the delegate method
    529         @param action The drag destination action
    530         @param draggingInfo The dragging info of the drag
    531         @discussion This method is called after the last call to webView:dragDestinationActionMaskForDraggingInfo: after something is dropped on a WebView.
    532         This method informs the UI delegate of the drag destination action that WebView will perform.
    533         - (void)webView:(WebView *)webView willPerformDragDestinationAction:(WebDragDestinationAction)action forDraggingInfo:(id <NSDraggingInfo>)draggingInfo;
    534     */
    535     HRESULT willPerformDragDestinationAction([in] IWebView* webView, [in] WebDragDestinationAction action, [in] IDataObject* draggingInfo);
    536 
    537     /*!
    538         @method webView:dragSourceActionMaskForPoint:
    539         @abstract Controls behavior when dragging from a WebView
    540         @param webView The WebView sending the delegate method
    541         @param point The point where the drag started in the coordinates of the WebView
    542         @discussion This method is called after the user has begun a drag from a WebView. The UI delegate can return a mask indicating
    543         which drag source actions can occur, WebDragSourceActionAny to allow any kind of action or WebDragSourceActionNone to not begin a drag.
    544         - (unsigned)webView:(WebView *)webView dragSourceActionMaskForPoint:(NSPoint)point;
    545     */
    546     HRESULT dragSourceActionMaskForPoint([in] IWebView* webView, [in] LPPOINT point, [out, retval] WebDragSourceAction* action);
    547 
    548     /*!
    549         @method webView:willPerformDragSourceAction:fromPoint:withPasteboard:
    550         @abstract Informs that a drag a has begun from a WebView
    551         @param webView The WebView sending the delegate method
    552         @param action The drag source action
    553         @param point The point where the drag started in the coordinates of the WebView
    554         @param pasteboard The drag pasteboard
    555         @discussion This method is called after webView:dragSourceActionMaskForPoint: is called after the user has begun a drag from a WebView.
    556         This method informs the UI delegate of the drag source action that will be performed and gives the delegate an opportunity to modify
    557         the contents of the dragging pasteboard.
    558         - (void)webView:(WebView *)webView willPerformDragSourceAction:(WebDragSourceAction)action fromPoint:(NSPoint)point withPasteboard:(NSPasteboard *)pasteboard;
    559     */
    560     HRESULT willPerformDragSourceAction([in] IWebView* webView, [in] WebDragSourceAction action, [in] LPPOINT point, [in] IDataObject* pasteboard, [out, retval] IDataObject** newPasteboard);
    561 
    562     /*!
    563         @method webView:contextMenuItemSelected:ForElement:
    564         @abstract Perform the action associated with the selected item.
    565         @param sender The WebView sending the delegate method.
    566         @param item The menu item that was selected.
    567         @param element A dictionary representation of the clicked element.
    568     */
    569     [local] HRESULT contextMenuItemSelected([in] IWebView* sender, [in] void* item, [in] IPropertyBag* element);
    570 
    571     /*
    572         @method hasCustomMenuImplementation:
    573         @abstract Returns whether the application uses the following functions to create a custom menu impementation.
    574     */
    575     HRESULT hasCustomMenuImplementation([out, retval] BOOL* hasCustomMenus);
    576 
    577     /*
    578         @method webView:trackCutsomPopupMenu
    579         @abstract Adds custom draw data to the menu items and calls a custom trackPopupMenu.
    580         @param sender The WebView sending the delegate method.
    581         @param menu The menu that we want to pop up.
    582         @param point The point associated with the context menu event in the coordinates of the WebView
    583     */
    584     HRESULT trackCustomPopupMenu([in] IWebView* sender, [in] OLE_HANDLE hMenu, [in] LPPOINT point);
    585 
    586     /*
    587         @method webView:measureCustomMenuItem
    588         @abstract This is called when the WM_MEASUREITEM command is received to measure the custom menu items
    589         @param sender The WebView sending the delegate method.
    590         @param measureItem The LPMEASUREITEMSTRUCT associated with the item.
    591     */
    592     [local] HRESULT measureCustomMenuItem([in] IWebView* sender, [in] void* measureItem);
    593 
    594     /*
    595         @method webView:drawCustomMenuItem
    596         @abstract This is called when the WM_DRAWITEM command is received to draw the custom menu item
    597         @param sender The WebView sending the delegate method.
    598         @param drawItem The LPDRAWITEMSTRUCT associated with the item.
    599     */
    600     [local] HRESULT drawCustomMenuItem([in] IWebView* sender, [in] void* drawItem);
    601 
    602     /*
    603         @method webView:addCustomMenuDrawingData
    604         @abstract Add custom data to the menu that the delegate can use when asked to draw.
    605         @param sender The WebView sending the delegate method.
    606         @param menu The cutsom menu to clean up.
    607         @discussion This method is called for submenus as well.
    608     */
    609     HRESULT addCustomMenuDrawingData([in] IWebView* sender, [in] OLE_HANDLE hMenu);
    610 
    611     /*
    612         @method webView:cleanUpCustomMenuDrawingData
    613         @abstract Clean up any custom data added to the menu items
    614         @param sender The WebView sending the delegate method.
    615         @param menu The cutsom menu to clean up.
    616     */
    617     HRESULT cleanUpCustomMenuDrawingData([in] IWebView* sender, [in] OLE_HANDLE hMenu);
    618 
    619     /*!
    620         @method webView:canTakeFocus:
    621         @abstract Informs whether focus can be transferred out of the WebView in the specified direction
    622         @param sender The WebView sending the delegate method.
    623         @param forward Whether focus is moving forward or backward.
    624     */
    625     HRESULT canTakeFocus([in] IWebView* sender, [in] BOOL forward, [out] BOOL* result);
    626 
    627     /*!
    628         @method webView:takeFocus:
    629         @abstract Instructs the delegate to take focus out of the WebView
    630         @param sender The WebView sending the delegate method.
    631         @param forward Whether focus is moving forward or backward.
    632     */
    633     HRESULT takeFocus([in] IWebView* sender, [in] BOOL forward);
    634 
    635     /// Undo related UI delegate methods --------------------------------------------------------------------------------
    636 
    637     /*!
    638         @method registerUndoWithTarget:
    639         @abstract Registers an undo operation of a IWebUndoTarget on the undo/redo stack.
    640         @param target The target that will be called back when the action is undone
    641         @param actionName The name of the action - this will be passed back to the target when we need to undo the operation
    642         @param actionArg An object that target used to save undo information
    643     */
    644     HRESULT registerUndoWithTarget([in] IWebUndoTarget* target, [in] BSTR actionName, [in] IUnknown* actionArg);
    645 
    646     /*!
    647         @method removeAllActionsWithTarget:
    648         @abstract remove all the undo operations that are registered for the passed in target on the undo/redo stack.
    649         @param target
    650     */
    651     HRESULT removeAllActionsWithTarget([in] IWebUndoTarget* target);
    652 
    653     /*!
    654         @method setActionTitle:
    655         @abstract Sets the name of the action for the current group of undo operations
    656         @param actionName Name of the action
    657     */
    658     HRESULT setActionTitle([in] BSTR actionTitle);
    659 
    660     /*!
    661         @method undo:
    662         @abstract Undo the last group of operations
    663     */
    664     HRESULT undo();
    665 
    666     /*!
    667         @method redo:
    668         @abstract Redo the last group of operations
    669     */
    670     HRESULT redo();
    671 
    672     /*!
    673         @method canUndo:
    674         @abstract Returns whether there's anything on the undo stack to be undone
    675     */
    676     HRESULT canUndo([out, retval] BOOL* result);
    677 
    678     /*!
    679         @method canRedo:
    680         @abstract Returns whether there's anything on the redo stack to be redone
    681     */
    682     HRESULT canRedo([out, retval] BOOL* result);
    683 
    684 /*!
    685     @method webView:printFrame:
    686     @abstract Informs that a WebFrame needs to be printed
    687     @param webView The WebView sending the delegate method
    688     @param frame The WebFrame needing to be printed
    689     @discussion This method is called when a script or user requests the page to be printed.
    690     In this method the delegate can prepare the WebFrame to be printed.
    691 */
    692     HRESULT printFrame([in] IWebView* webView, [in] IWebFrame* frame);
    693 
    694 /*!
    695     @method webView:ftpDirectoryTemplatePath
    696     @abstract Returns the path to the FTP directory listing template document
    697     @param webView The WebView sending the delegate method
    698     @param path The path to the template document
    699     @discussion This method is called when an FTP directory listing is viewed in a webView.
    700     In practice, all WebViews show the same template document data that was loaded for the very
    701     first WebView that displayed a directory listing, so this will only be called once.
    702 */
    703     HRESULT ftpDirectoryTemplatePath([in] IWebView* webView, [out, retval] BSTR* path);
    704 
    705 /*!
    706     @method webViewHeaderHeight:
    707     @param webView The WebView sending the delegate method
    708     @abstract Reserve a height for the printed page header.
    709     @result The height to reserve for the printed page header, return 0.0 to not reserve any space for a header.
    710     @discussion The height returned will be used to calculate the rect passed to webView:drawHeaderInRect:.
    711 
    712     - (float)webViewHeaderHeight:(WebView *)sender;
    713 */
    714     HRESULT webViewHeaderHeight([in] IWebView* webView, [out, retval] float* result);
    715 
    716 /*!
    717     @method webViewFooterHeight:
    718     @param webView The WebView sending the delegate method
    719     @abstract Reserve a height for the printed page footer.
    720     @result The height to reserve for the printed page footer, return 0.0 to not reserve any space for a footer.
    721     @discussion The height returned will be used to calculate the rect passed to webView:drawFooterInRect:.
    722 
    723     - (float)webViewFooterHeight:(WebView *)sender;
    724 */
    725     HRESULT webViewFooterHeight([in] IWebView* webView, [out, retval] float* result);
    726 
    727 /*!
    728     @method webView:drawHeaderInRect:
    729     @param webView The WebView sending the delegate method
    730     @param rect The NSRect reserved for the header of the page
    731     @abstract The delegate should draw a header for the sender in the supplied rect.
    732 
    733     - (void)webView:(WebView *)sender drawHeaderInRect:(NSRect)rect;
    734 */
    735     HRESULT drawHeaderInRect([in] IWebView* webView, [in] RECT* rect, [in] OLE_HANDLE drawingContext);
    736 
    737 /*!
    738     @method webView:drawFooterInRect:
    739     @param webView The WebView sending the delegate method
    740     @param rect The NSRect reserved for the footer of the page
    741     @abstract The delegate should draw a footer for the sender in the supplied rect.
    742 
    743     - (void)webView:(WebView *)sender drawFooterInRect:(NSRect)rect;
    744 */
    745     HRESULT drawFooterInRect([in] IWebView* webView, [in] RECT* rect, [in] OLE_HANDLE drawingContext, [in] UINT pageIndex, [in] UINT pageCount);
    746 
    747     HRESULT webViewPrintingMarginRect([in] IWebView* webView, [out, retval] RECT* rect);
    748 
    749     HRESULT canRunModal([in] IWebView* webView, [out, retval] BOOL* canRunBoolean);
    750     HRESULT createModalDialog([in] IWebView* sender, [in] IWebURLRequest* request, [out, retval] IWebView** newWebView);
    751     HRESULT runModal([in] IWebView* webView);
    752     HRESULT isMenuBarVisible([in] IWebView* webView, [out, retval] BOOL* visible);
    753     HRESULT setMenuBarVisible([in] IWebView* webView, [in] BOOL visible);
    754     HRESULT runDatabaseSizeLimitPrompt([in] IWebView* webView, [in] BSTR displayName, [in] IWebFrame* initiatedByFrame, [out, retval] BOOL* allowed);
    755     HRESULT paintCustomScrollbar([in] IWebView* webView, [in] HDC hDC, [in] RECT rect, [in] WebScrollBarControlSize size, [in] WebScrollbarControlState state,
    756                                  [in] WebScrollbarControlPart pressedPart, [in] BOOL vertical, [in] float value, [in] float proportion, [in] WebScrollbarControlPartMask parts);
    757     HRESULT paintCustomScrollCorner([in] IWebView* webView, [in] HDC hDC, [in] RECT rect);
    758 }
    759