1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
/*
* Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/Foundation.h>
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
#define WebNSUInteger unsigned int
#else
#define WebNSUInteger NSUInteger
#endif
@class WebHistoryItem;
@class WebBackForwardListPrivate;
/*!
@class WebBackForwardList
WebBackForwardList holds an ordered list of WebHistoryItems that comprises the back and
forward lists.
Note that the methods which modify instances of this class do not cause
navigation to happen in other layers of the stack; they are only for maintaining this data
structure.
*/
@interface WebBackForwardList : NSObject {
@private
WebBackForwardListPrivate *_private;
}
/*!
@method addItem:
@abstract Adds an entry to the list.
@param entry The entry to add.
@discussion The added entry is inserted immediately after the current entry.
If the current position in the list is not at the end of the list, elements in the
forward list will be dropped at this point. In addition, entries may be dropped to keep
the size of the list within the maximum size.
*/
- (void)addItem:(WebHistoryItem *)item;
/*!
@method goBack
@abstract Move the current pointer back to the entry before the current entry.
*/
- (void)goBack;
/*!
@method goForward
@abstract Move the current pointer ahead to the entry after the current entry.
*/
- (void)goForward;
/*!
@method goToItem:
@abstract Move the current pointer to the given entry.
@param item The history item to move the pointer to
*/
- (void)goToItem:(WebHistoryItem *)item;
/*!
@method backItem
@abstract Returns the entry right before the current entry.
@result The entry right before the current entry, or nil if there isn't one.
*/
- (WebHistoryItem *)backItem;
/*!
@method currentItem
@abstract Returns the current entry.
@result The current entry.
*/
- (WebHistoryItem *)currentItem;
/*!
@method forwardItem
@abstract Returns the entry right after the current entry.
@result The entry right after the current entry, or nil if there isn't one.
*/
- (WebHistoryItem *)forwardItem;
/*!
@method backListWithLimit:
@abstract Returns a portion of the list before the current entry.
@param limit A cap on the size of the array returned.
@result An array of items before the current entry, or nil if there are none. The entries are in the order that they were originally visited.
*/
- (NSArray *)backListWithLimit:(int)limit;
/*!
@method forwardListWithLimit:
@abstract Returns a portion of the list after the current entry.
@param limit A cap on the size of the array returned.
@result An array of items after the current entry, or nil if there are none. The entries are in the order that they were originally visited.
*/
- (NSArray *)forwardListWithLimit:(int)limit;
/*!
@method capacity
@abstract Returns the list's maximum size.
@result The list's maximum size.
*/
- (int)capacity;
/*!
@method setCapacity
@abstract Sets the list's maximum size.
@param size The new maximum size for the list.
*/
- (void)setCapacity:(int)size;
/*!
@method backListCount
@abstract Returns the back list's current count.
@result The number of items in the list.
*/
- (int)backListCount;
/*!
@method forwardListCount
@abstract Returns the forward list's current count.
@result The number of items in the list.
*/
- (int)forwardListCount;
/*!
@method containsItem:
@param item The item that will be checked for presence in the WebBackForwardList.
@result Returns YES if the item is in the list.
*/
- (BOOL)containsItem:(WebHistoryItem *)item;
/*!
@method itemAtIndex:
@abstract Returns an entry the given distance from the current entry.
@param index Index of the desired list item relative to the current item; 0 is current item, -1 is back item, 1 is forward item, etc.
@result The entry the given distance from the current entry. If index exceeds the limits of the list, nil is returned.
*/
- (WebHistoryItem *)itemAtIndex:(int)index;
@end
@interface WebBackForwardList(WebBackForwardListDeprecated)
// The following methods are deprecated, and exist for backward compatibility only.
// Use -[WebPreferences setUsesPageCache] and -[WebPreferences usesPageCache]
// instead.
/*!
@method setPageCacheSize:
@abstract The size passed to this method determines whether the WebView
associated with this WebBackForwardList will use the shared page cache.
@param size If size is 0, the WebView associated with this WebBackForwardList
will not use the shared page cache. Otherwise, it will.
*/
- (void)setPageCacheSize:(WebNSUInteger)size;
/*!
@method pageCacheSize
@abstract Returns the size of the shared page cache, or 0.
@result The size of the shared page cache (in pages), or 0 if the WebView
associated with this WebBackForwardList will not use the shared page cache.
*/
- (WebNSUInteger)pageCacheSize;
@end
#undef WebNSUInteger
|