1/*
2 * Copyright (C) 2006, 2007, 2008 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 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef DO_NO_IMPORTS
27import "oaidl.idl";
28import "ocidl.idl";
29import "IWebHistoryItem.idl";
30#endif
31
32interface IWebHistoryItem;
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[
44    object,
45    oleautomation,
46    uuid(C278A16D-B502-4131-B551-DCE3F4ED2B36),
47    pointer_default(unique)
48]
49interface IWebBackForwardList : IUnknown
50{
51    /*!
52        @method addItem:
53        @abstract Adds an entry to the list.
54        @param entry The entry to add.
55        @discussion The added entry is inserted immediately after the current entry.
56        If the current position in the list is not at the end of the list, elements in the
57        forward list will be dropped at this point.  In addition, entries may be dropped to keep
58        the size of the list within the maximum size.
59        - (void)addItem:(WebHistoryItem *)item;
60    */
61    HRESULT addItem([in] IWebHistoryItem* item);
62
63    /*!
64        @method goBack
65        @abstract Move the current pointer back to the entry before the current entry.
66        - (void)goBack;
67    */
68    HRESULT goBack();
69
70    /*!
71        @method goForward
72        @abstract Move the current pointer ahead to the entry after the current entry.
73        - (void)goForward;
74    */
75    HRESULT goForward();
76
77    /*!
78        @method goToItem:
79        @abstract Move the current pointer to the given entry.
80        @param item The history item to move the pointer to
81        - (void)goToItem:(WebHistoryItem *)item;
82    */
83    HRESULT goToItem([in] IWebHistoryItem* item);
84
85    /*!
86        @method backItem
87        @abstract Returns the entry right before the current entry.
88        @result The entry right before the current entry, or nil if there isn't one.
89        - (WebHistoryItem *)backItem;
90    */
91    HRESULT backItem([out, retval] IWebHistoryItem** item);
92
93    /*!
94        @method currentItem
95        @abstract Returns the current entry.
96        @result The current entry.
97        - (WebHistoryItem *)currentItem;
98    */
99    HRESULT currentItem([out, retval] IWebHistoryItem** item);
100
101    /*!
102        @method forwardItem
103        @abstract Returns the entry right after the current entry.
104        @result The entry right after the current entry, or nil if there isn't one.
105        - (WebHistoryItem *)forwardItem;
106    */
107    HRESULT forwardItem([out, retval] IWebHistoryItem** item);
108
109    /*!
110        @method backListWithLimit:
111        @abstract Returns a portion of the list before the current entry.
112        @param limit A cap on the size of the array returned.
113        @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.
114        - (NSArray *)backListWithLimit:(int)limit;
115    */
116    HRESULT backListWithLimit([in] int limit, [out] int* listCount, [in] IWebHistoryItem** list);
117
118    /*!
119        @method forwardListWithLimit:
120        @abstract Returns a portion of the list after the current entry.
121        @param limit A cap on the size of the array returned.
122        @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.
123        - (NSArray *)forwardListWithLimit:(int)limit;
124    */
125    HRESULT forwardListWithLimit([in] int limit, [out] int* listCount, [in] IWebHistoryItem** list);
126
127    /*!
128        @method capacity
129        @abstract Returns the list's maximum size.
130        @result The list's maximum size.
131        - (int)capacity;
132    */
133    HRESULT capacity([out, retval] int* result);
134
135    /*!
136        @method setCacpacity
137        @abstract Sets the list's maximum size.
138        @param size The new maximum size for the list.
139        - (void)setCapacity:(int)size;
140    */
141    HRESULT setCapacity([in] int size);
142
143    /*!
144        @method backListCount
145        @abstract Returns the back list's current count.
146        @result The number of items in the list.
147        - (int)backListCount;
148    */
149    HRESULT backListCount([out, retval] int* count);
150
151    /*!
152        @method forwardListCount
153        @abstract Returns the forward list's current count.
154        @result The number of items in the list.
155        - (int)forwardListCount;
156    */
157    HRESULT forwardListCount([out, retval] int* sizecount);
158
159    /*!
160        @method containsItem:
161        @param item The item that will be checked for presence in the WebBackForwardList.
162        @result Returns YES if the item is in the list.
163        - (BOOL)containsItem:(WebHistoryItem *)item;
164    */
165    HRESULT containsItem([in] IWebHistoryItem* item, [out, retval] BOOL* result);
166
167    /*!
168        @method itemAtIndex:
169        @abstract Returns an entry the given distance from the current entry.
170        @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.
171        @result The entry the given distance from the current entry. If index exceeds the limits of the list, nil is returned.
172        - (WebHistoryItem *)itemAtIndex:(int)index;
173    */
174    HRESULT itemAtIndex([in] int index, [out, retval] IWebHistoryItem** item);
175}
176