CTTabStripModelDelegate.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #pragma once
  2. @class CTBrowser;
  3. @class CTTabContents;
  4. //
  5. // CTTabStripModelDelegate
  6. //
  7. // A delegate interface that the CTTabStripModel uses to perform work that it
  8. // can't do itself, such as obtain a container for creating new CTTabContents,
  9. // creating new TabStripModels for detached tabs, etc.
  10. //
  11. // This interface is typically implemented by the controller that instantiates
  12. // the CTTabStripModel (the CTBrowser object).
  13. //
  14. @protocol CTTabStripModelDelegate
  15. // Adds what the delegate considers to be a blank tab to the model.
  16. -(CTTabContents*)addBlankTabInForeground:(BOOL)foreground;
  17. -(CTTabContents*)addBlankTabAtIndex:(int)index inForeground:(BOOL)foreground;
  18. // Asks for a new TabStripModel to be created and the given tab contents to
  19. // be added to it. Its size and position are reflected in |window_bounds|.
  20. // If |dock_info|'s type is other than NONE, the newly created window should
  21. // be docked as identified by |dock_info|. Returns the CTBrowser object
  22. // representing the newly created window and tab strip. This does not
  23. // show the window, it's up to the caller to do so.
  24. -(CTBrowser*)createNewStripWithContents:(CTTabContents*)contents;
  25. // Creates a new CTBrowser object and window containing the specified
  26. // |contents|, and continues a drag operation that began within the source
  27. // window's tab strip. |window_bounds| are the bounds of the source window in
  28. // screen coordinates, used to place the new window, and |tab_bounds| are the
  29. // bounds of the dragged Tab view in the source window, in screen coordinates,
  30. // used to place the new Tab in the new window.
  31. -(void)continueDraggingDetachedTab:(CTTabContents*)contents
  32. windowBounds:(const NSRect)windowBounds
  33. tabBounds:(const NSRect)tabBounds;
  34. // Returns whether some contents can be duplicated.
  35. -(BOOL)canDuplicateContentsAt:(int)index;
  36. // Duplicates the contents at the provided index and places it into its own
  37. // window.
  38. -(void)duplicateContentsAt:(int)index;
  39. // Called when a drag session has completed and the frame that initiated the
  40. // the session should be closed.
  41. -(void)closeFrameAfterDragSession;
  42. // Creates an entry in the historical tab database for the specified
  43. // CTTabContents.
  44. -(void)createHistoricalTab:(CTTabContents*)contents;
  45. // Runs any unload listeners associated with the specified CTTabContents before
  46. // it is closed. If there are unload listeners that need to be run, this
  47. // function returns true and the TabStripModel will wait before closing the
  48. // CTTabContents. If it returns false, there are no unload listeners and the
  49. // TabStripModel can close the CTTabContents immediately.
  50. -(BOOL)runUnloadListenerBeforeClosing:(CTTabContents*)contents;
  51. // Returns true if a tab can be restored.
  52. -(BOOL)canRestoreTab;
  53. // Restores the last closed tab if CanRestoreTab would return true.
  54. -(void)restoreTab;
  55. // Returns whether some contents can be closed.
  56. -(BOOL)canCloseContentsAt:(int)index;
  57. // Returns true if any of the tabs can be closed.
  58. -(BOOL)canCloseTab;
  59. @end // @protocol CTTabStripModelDelegate