WebHistoryItem.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
  14. * its contributors may be used to endorse or promote products derived
  15. * from this software without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
  18. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20. * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
  21. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  26. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. */
  28. #import <Cocoa/Cocoa.h>
  29. @class WebHistoryItemPrivate;
  30. @class NSURL;
  31. /*
  32. @discussion Notification sent when history item is modified.
  33. @constant WebHistoryItemChanged Posted from whenever the value of
  34. either the item's title, alternate title, url strings, or last visited interval
  35. changes. The userInfo will be nil.
  36. */
  37. extern NSString *WebHistoryItemChangedNotification;
  38. /*!
  39. @class WebHistoryItem
  40. @discussion WebHistoryItems are created by WebKit to represent pages visited.
  41. The WebBackForwardList and WebHistory classes both use WebHistoryItems to represent
  42. pages visited. With the exception of the displayTitle, the properties of
  43. WebHistoryItems are set by WebKit. WebHistoryItems are normally never created directly.
  44. */
  45. @interface WebHistoryItem : NSObject <NSCopying>
  46. {
  47. @private
  48. WebHistoryItemPrivate *_private;
  49. }
  50. /*!
  51. @method initWithURLString:title:lastVisitedTimeInterval:
  52. @param URLString The URL string for the item.
  53. @param title The title to use for the item. This is normally the <title> of a page.
  54. @param time The time used to indicate when the item was used.
  55. @abstract Initialize a new WebHistoryItem
  56. @discussion WebHistoryItems are normally created for you by the WebKit.
  57. You may use this method to prepopulate a WebBackForwardList, or create
  58. 'artificial' items to add to a WebBackForwardList. When first initialized
  59. the URLString and originalURLString will be the same.
  60. */
  61. - (id)initWithURLString:(NSString *)URLString title:(NSString *)title lastVisitedTimeInterval:(NSTimeInterval)time;
  62. /*!
  63. @method originalURLString
  64. @abstract The string representation of the originial URL of this item.
  65. This value is normally set by the WebKit.
  66. @result The string corresponding to the initial URL of this item.
  67. */
  68. - (NSString *)originalURLString;
  69. /*!
  70. @method URLString
  71. @abstract The string representation of the URL represented by this item.
  72. @discussion The URLString may be different than the originalURLString if the page
  73. redirected to a new location. This value is normally set by the WebKit.
  74. @result The string corresponding to the final URL of this item.
  75. */
  76. - (NSString *)URLString;
  77. /*!
  78. @method title
  79. @abstract The title of the page represented by this item.
  80. @discussion This title cannot be changed by the client. This value
  81. is normally set by the WebKit when a page title for the item is received.
  82. @result The title of this item.
  83. */
  84. - (NSString *)title;
  85. /*!
  86. @method lastVisitedTimeInterval
  87. @abstract The last time the page represented by this item was visited. The interval
  88. is since the reference date as determined by NSDate. This value is normally set by
  89. the WebKit.
  90. @result The last time this item was visited.
  91. */
  92. - (NSTimeInterval)lastVisitedTimeInterval;
  93. /*!
  94. @method setAlternateTitle:
  95. @param alternateTitle The new display title for this item.
  96. @abstract A title that may be used by the client to display this item.
  97. */
  98. - (void)setAlternateTitle:(NSString *)alternateTitle;
  99. /*
  100. @method title
  101. @abstract A title that may be used by the client to display this item.
  102. @result The alternate title for this item.
  103. */
  104. - (NSString *)alternateTitle;
  105. /*!
  106. @method icon
  107. @abstract The favorite icon of the page represented by this item.
  108. @discussion This icon returned will be determined by the WebKit.
  109. @result The icon associated with this item's URL.
  110. */
  111. - (NSImage *)icon;
  112. @end