initial import
[vuplus_webkit] / Source / WebKit / mac / History / WebHistoryItem.h
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
29 #import <Cocoa/Cocoa.h>
30
31 @class WebHistoryItemPrivate;
32 @class NSURL;
33
34 /*
35     @discussion Notification sent when history item is modified.
36     @constant WebHistoryItemChanged Posted from whenever the value of
37     either the item's title, alternate title, url strings, or last visited interval
38     changes.  The userInfo will be nil.
39 */
40 extern NSString *WebHistoryItemChangedNotification;
41
42 /*!
43     @class WebHistoryItem
44     @discussion  WebHistoryItems are created by WebKit to represent pages visited.
45     The WebBackForwardList and WebHistory classes both use WebHistoryItems to represent
46     pages visited.  With the exception of the displayTitle, the properties of 
47     WebHistoryItems are set by WebKit.  WebHistoryItems are normally never created directly.
48 */
49 @interface WebHistoryItem : NSObject <NSCopying>
50 {
51 @private
52     WebHistoryItemPrivate *_private;
53 }
54
55 /*!
56     @method initWithURLString:title:lastVisitedTimeInterval:
57     @param URLString The URL string for the item.
58     @param title The title to use for the item.  This is normally the <title> of a page.
59     @param time The time used to indicate when the item was used.
60     @abstract Initialize a new WebHistoryItem
61     @discussion WebHistoryItems are normally created for you by the WebKit.
62     You may use this method to prepopulate a WebBackForwardList, or create
63     'artificial' items to add to a WebBackForwardList.  When first initialized
64     the URLString and originalURLString will be the same.
65 */
66 - (id)initWithURLString:(NSString *)URLString title:(NSString *)title lastVisitedTimeInterval:(NSTimeInterval)time;
67
68 /*!
69     @method originalURLString
70     @abstract The string representation of the originial URL of this item.
71     This value is normally set by the WebKit.
72     @result The string corresponding to the initial URL of this item.
73 */
74 - (NSString *)originalURLString;
75
76 /*!
77     @method URLString
78     @abstract The string representation of the URL represented by this item.
79     @discussion The URLString may be different than the originalURLString if the page
80     redirected to a new location.  This value is normally set by the WebKit.
81     @result The string corresponding to the final URL of this item.
82 */
83 - (NSString *)URLString;
84
85
86 /*!
87     @method title
88     @abstract The title of the page represented by this item.
89     @discussion This title cannot be changed by the client.  This value
90     is normally set by the WebKit when a page title for the item is received.
91     @result The title of this item.
92 */
93 - (NSString *)title;
94
95 /*!
96     @method lastVisitedTimeInterval
97     @abstract The last time the page represented by this item was visited. The interval
98     is since the reference date as determined by NSDate.  This value is normally set by
99     the WebKit.
100     @result The last time this item was visited.
101 */
102 - (NSTimeInterval)lastVisitedTimeInterval;
103
104 /*!
105     @method setAlternateTitle:
106     @param alternateTitle The new display title for this item.
107     @abstract A title that may be used by the client to display this item.
108 */
109 - (void)setAlternateTitle:(NSString *)alternateTitle;
110
111 /*
112     @method title
113     @abstract A title that may be used by the client to display this item.
114     @result The alternate title for this item.
115 */
116 - (NSString *)alternateTitle;
117
118 /*!
119     @method icon
120     @abstract The favorite icon of the page represented by this item.
121     @discussion This icon returned will be determined by the WebKit.
122     @result The icon associated with this item's URL.
123 */
124 - (NSImage *)icon;
125
126 @end