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 <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 @method backItem 80 @abstract Returns the entry right before the current entry. 81 @result The entry right before the current entry, or nil if there isn't one. 82*/ 83- (WebHistoryItem *)backItem; 84 85/*! 86 @method currentItem 87 @abstract Returns the current entry. 88 @result The current entry. 89*/ 90- (WebHistoryItem *)currentItem; 91 92/*! 93 @method forwardItem 94 @abstract Returns the entry right after the current entry. 95 @result The entry right after the current entry, or nil if there isn't one. 96*/ 97- (WebHistoryItem *)forwardItem; 98 99/*! 100 @method backListWithLimit: 101 @abstract Returns a portion of the list before the current entry. 102 @param limit A cap on the size of the array returned. 103 @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. 104*/ 105- (NSArray *)backListWithLimit:(int)limit; 106 107/*! 108 @method forwardListWithLimit: 109 @abstract Returns a portion of the list after the current entry. 110 @param limit A cap on the size of the array returned. 111 @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. 112*/ 113- (NSArray *)forwardListWithLimit:(int)limit; 114 115/*! 116 @method capacity 117 @abstract Returns the list's maximum size. 118 @result The list's maximum size. 119*/ 120- (int)capacity; 121 122/*! 123 @method setCapacity 124 @abstract Sets the list's maximum size. 125 @param size The new maximum size for the list. 126*/ 127- (void)setCapacity:(int)size; 128 129/*! 130 @method backListCount 131 @abstract Returns the back list's current count. 132 @result The number of items in the list. 133*/ 134- (int)backListCount; 135 136/*! 137 @method forwardListCount 138 @abstract Returns the forward list's current count. 139 @result The number of items in the list. 140*/ 141- (int)forwardListCount; 142 143/*! 144 @method containsItem: 145 @param item The item that will be checked for presence in the WebBackForwardList. 146 @result Returns YES if the item is in the list. 147*/ 148- (BOOL)containsItem:(WebHistoryItem *)item; 149 150/*! 151 @method itemAtIndex: 152 @abstract Returns an entry the given distance from the current entry. 153 @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. 154 @result The entry the given distance from the current entry. If index exceeds the limits of the list, nil is returned. 155*/ 156- (WebHistoryItem *)itemAtIndex:(int)index; 157 158@end 159 160@interface WebBackForwardList(WebBackForwardListDeprecated) 161 162// The following methods are deprecated, and exist for backward compatibility only. 163// Use -[WebPreferences setUsesPageCache] and -[WebPreferences usesPageCache] 164// instead. 165 166/*! 167 @method setPageCacheSize: 168 @abstract The size passed to this method determines whether the WebView 169 associated with this WebBackForwardList will use the shared page cache. 170 @param size If size is 0, the WebView associated with this WebBackForwardList 171 will not use the shared page cache. Otherwise, it will. 172*/ 173- (void)setPageCacheSize:(NSUInteger)size; 174 175/*! 176 @method pageCacheSize 177 @abstract Returns the size of the shared page cache, or 0. 178 @result The size of the shared page cache (in pages), or 0 if the WebView 179 associated with this WebBackForwardList will not use the shared page cache. 180*/ 181- (NSUInteger)pageCacheSize; 182@end 183