IWebUIDelegate.idl 36 KB

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