1/* 2 * Copyright (C) 2003 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 * 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 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 <Foundation/Foundation.h> 30 31@class WebHistoryItem; 32@class WebBackForwardListPrivate; 33 34/*! 35 @class WebBackForwardList 36 WebBackForwardList holds an ordered list of WebHistoryItems that comprises the back and 37 forward lists. 38 39 Note that the methods which modify instances of this class do not cause 40 navigation to happen in other layers of the stack; they are only for maintaining this data 41 structure. 42*/ 43@interface WebBackForwardList : NSObject { 44@private 45 WebBackForwardListPrivate *_private; 46} 47 48/*! 49 @method addItem: 50 @abstract Adds an entry to the list. 51 @param entry The entry to add. 52 @discussion The added entry is inserted immediately after the current entry. 53 If the current position in the list is not at the end of the list, elements in the 54 forward list will be dropped at this point. In addition, entries may be dropped to keep 55 the size of the list within the maximum size. 56*/ 57- (void)addItem:(WebHistoryItem *)item; 58 59/*! 60 @method goBack 61 @abstract Move the current pointer back to the entry before the current entry. 62*/ 63- (void)goBack; 64 65/*! 66 @method goForward 67 @abstract Move the current pointer ahead to the entry after the current entry. 68*/ 69- (void)goForward; 70 71/*! 72 @method goToItem: 73 @abstract Move the current pointer to the given entry. 74 @param item The history item to move the pointer to 75*/ 76- (void)goToItem:(WebHistoryItem *)item; 77 78/*! 79 @property backItem 80 @abstract The entry right before the current entry, or nil if there isn't one. 81*/ 82@property (nonatomic, readonly, strong) WebHistoryItem *backItem; 83 84/*! 85 @property currentItem 86 @abstract Returns the current entry. 87*/ 88@property (nonatomic, readonly, strong) WebHistoryItem *currentItem; 89 90/*! 91 @property forwardItem 92 @abstract The entry right after the current entry, or nil if there isn't one. 93*/ 94@property (nonatomic, readonly, strong) WebHistoryItem *forwardItem; 95 96/*! 97 @method backListWithLimit: 98 @abstract Returns a portion of the list before the current entry. 99 @param limit A cap on the size of the array returned. 100 @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. 101*/ 102- (NSArray *)backListWithLimit:(int)limit; 103 104/*! 105 @method forwardListWithLimit: 106 @abstract Returns a portion of the list after the current entry. 107 @param limit A cap on the size of the array returned. 108 @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. 109*/ 110- (NSArray *)forwardListWithLimit:(int)limit; 111 112/*! 113 @property capacity 114 @abstract The list's maximum size. 115*/ 116@property (nonatomic) int capacity; 117 118/*! 119 @property backListCount 120 @abstract The number of items in the list. 121*/ 122@property (nonatomic, readonly) int backListCount; 123 124/*! 125 @property forwardListCount 126 @result The number of items in the list. 127*/ 128@property (nonatomic, readonly) int forwardListCount; 129 130/*! 131 @method containsItem: 132 @param item The item that will be checked for presence in the WebBackForwardList. 133 @result Returns YES if the item is in the list. 134*/ 135- (BOOL)containsItem:(WebHistoryItem *)item; 136 137/*! 138 @method itemAtIndex: 139 @abstract Returns an entry the given distance from the current entry. 140 @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. 141 @result The entry the given distance from the current entry. If index exceeds the limits of the list, nil is returned. 142*/ 143- (WebHistoryItem *)itemAtIndex:(int)index; 144 145@end 146 147@interface WebBackForwardList(WebBackForwardListDeprecated) 148 149// The following methods are deprecated, and exist for backward compatibility only. 150// Use -[WebPreferences setUsesPageCache] and -[WebPreferences usesPageCache] 151// instead. 152 153/*! 154 @method setPageCacheSize: 155 @abstract The size passed to this method determines whether the WebView 156 associated with this WebBackForwardList will use the shared page cache. 157 @param size If size is 0, the WebView associated with this WebBackForwardList 158 will not use the shared page cache. Otherwise, it will. 159*/ 160- (void)setPageCacheSize:(NSUInteger)size; 161 162/*! 163 @method pageCacheSize 164 @abstract Returns the size of the shared page cache, or 0. 165 @result The size of the shared page cache (in pages), or 0 if the WebView 166 associated with this WebBackForwardList will not use the shared page cache. 167*/ 168- (NSUInteger)pageCacheSize; 169@end 170