webengine/wmlengine/src/hed/include/HistoryStack.h
changeset 74 91031d3aab7d
parent 68 92a765b5b3e7
child 85 e358f2276d3f
equal deleted inserted replaced
68:92a765b5b3e7 74:91031d3aab7d
     1 /*
       
     2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Stack of HistoryEntry objects containing info about previously 
       
    15 *       viewed pages.  Allows for the navigation (forward and back) of 
       
    16 *       those pages and for the maintenance (add/remove) of the pages
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef HISTORYSTACK_H
       
    22 #define HISTORYSTACK_H
       
    23 
       
    24 // INCLUDES
       
    25 #include <e32base.h>
       
    26 //#include "historyentry.h"
       
    27 #include "HistoryInterface.h"
       
    28 #include "HistoryController.h"
       
    29 
       
    30 // CONSTANTS
       
    31 
       
    32 /*
       
    33    static const TUint KHistoryStackSize = 20;
       
    34 
       
    35 // MACROS
       
    36 
       
    37 // DATA TYPES
       
    38 
       
    39 enum THistoryStackDirection
       
    40 {
       
    41 
       
    42     EHistoryStackDirectionPrevious,
       
    43     EHistoryStackDirectionCurrent,
       
    44     EHistoryStackDirectionNext
       
    45 };
       
    46 
       
    47 
       
    48 enum THistoryStackLocation
       
    49 {
       
    50 
       
    51     EHistoryStackLocationAtBeginning,
       
    52     EHistoryStackLocationInMiddle,
       
    53     EHistoryStackLocationAtEnd
       
    54 };
       
    55 */
       
    56 
       
    57 // FUNCTION PROTOTYPES
       
    58 
       
    59 // FORWARD DECLARATIONS
       
    60 class CHistoryMemCollector;
       
    61 class CUrlRequestInfo;
       
    62 
       
    63 // CLASS DECLARATION
       
    64 
       
    65 /**
       
    66 * CHistoryStack
       
    67 * 
       
    68 *  @lib ?library
       
    69 *  @since ?Series60_version
       
    70 */
       
    71 class CHistoryStack : public CBase
       
    72     {
       
    73 
       
    74     public:
       
    75 
       
    76         /**
       
    77         * Two-phased constructor.
       
    78         * @return CHistoryStack *
       
    79         */
       
    80         static CHistoryStack* NewL(TInt aHistoryStackStackSize);
       
    81 
       
    82         /**
       
    83         * Two-phased constructor.
       
    84         * @return CHistoryStack *
       
    85         */
       
    86         static CHistoryStack* NewLC(TInt aHistoryStackStackSize);
       
    87 
       
    88         /**
       
    89         * Sets the new current page in the history relative to
       
    90         * the current page.
       
    91         * Leave if index out of bounds.
       
    92         */
       
    93         void SetCurrentL (THistoryStackDirection aDirection);
       
    94 
       
    95         /**
       
    96         * Sets the new current page in the history to
       
    97         * the index.
       
    98         * Leave if index out of bounds.
       
    99         */
       
   100         void SetCurrentByIndexL (TInt aIndex);
       
   101 
       
   102         /**
       
   103         * Return the entry in the direction relative to the current page
       
   104         * @return CHistoryEntry const*
       
   105         */
       
   106 //        CHistoryEntry* Entry (THistoryStackDirection aDirection) ;
       
   107 
       
   108 
       
   109         /**
       
   110         * Delete entire history
       
   111         */
       
   112         void DeleteAll ();
       
   113 
       
   114         /**
       
   115         * Returns the number of objects in the history list
       
   116         * @return TInt
       
   117         */
       
   118 //        TInt Length () const {return iHistoryList->Count();}
       
   119 
       
   120         /**
       
   121         * Retreive an entry by it's position (index) in the list
       
   122         * @return CHistoryEntry const*
       
   123         */
       
   124 //        CHistoryEntry* EntryByIndex (TInt aHistoryIndex);
       
   125 
       
   126         /**
       
   127         * Determine position in stack
       
   128         * @return THistoryStackLocation 
       
   129         */
       
   130         THistoryStackLocation HistoryStackLocation () const;
       
   131 
       
   132 		// return current index
       
   133 		TInt CurrentIndex () const { return iCurrent; }
       
   134 		
       
   135 		// sets the current index
       
   136 		void SetCurrentIndex(TInt aHistoryIndex) {iCurrent = aHistoryIndex;}
       
   137 
       
   138         /**
       
   139 		* Insert
       
   140 		* Add Url to History List
       
   141 		* @since 3.x
       
   142         * @return void
       
   143 		*/
       
   144 		void Insert( const TDesC& aUrl, const CUrlRequestInfo* aRequestInfo);
       
   145 
       
   146         /**
       
   147 		* Insert
       
   148 		* Add Url to History List
       
   149 		* @since 3.x
       
   150         * @return void
       
   151 		*/
       
   152 //        void InsertL( const TDesC& aUrl, const TDesC& aRequestUrl, TBool aIsPost, TDesC8& aFormContentType, CPostDataParts* aPostData );
       
   153 
       
   154         /**
       
   155         * Implements virtual TBool ContainsItemForURL(const TDesC& aUrl) = 0;)
       
   156         * @return TBool
       
   157         * Return TRUE if URL request is in the history list
       
   158         */
       
   159         TBool containsItemForURL (const TDesC& aUrl);
       
   160         
       
   161         /**
       
   162         * Delete the entry(s) from the list
       
   163         */
       
   164         void DeleteEntry (TInt aIndex, TInt aCount=1);
       
   165         
       
   166         /**
       
   167         * Returns the stack size
       
   168         */
       
   169         TInt Size(){ return iHistoryStackStackSize; }
       
   170         
       
   171         /**
       
   172         * Retreive the index of the entry relative to the current page
       
   173         * @return TInt
       
   174         */
       
   175         TInt Index (THistoryStackDirection aDirection);
       
   176 
       
   177 	public:
       
   178 	
       
   179 	    void ClearThumbnails();
       
   180 
       
   181 		TBool IsOOMCollecting();
       
   182 
       
   183         /**
       
   184         * Destructor
       
   185         */
       
   186         ~CHistoryStack();
       
   187 
       
   188     private:
       
   189 
       
   190 
       
   191         /**
       
   192         * By default Symbian 2nd phase constructor is private.
       
   193         */
       
   194         void ConstructL(TInt aHistoryStackStackSize);
       
   195 
       
   196         /**
       
   197         * Insert entry into stack at the current position and 
       
   198         * delete all entries above the current entry.
       
   199         * Leave if out of memory.
       
   200         */
       
   201 //        void PushEntryL (CHistoryEntry* aHistoryEntry);
       
   202 
       
   203         /**
       
   204         * Insert entry either at the beginning of the list
       
   205         * or at the end of the list
       
   206         * Leave if out of memory.
       
   207         */
       
   208 //        void InsertEntryL (CHistoryEntry* aHistoryEntry, THistoryStackLocation aLocation);
       
   209 
       
   210 		/**
       
   211 		*  Default constructor
       
   212 		*/
       
   213 		CHistoryStack();
       
   214 
       
   215         /*  Private Members  */
       
   216 
       
   217     private :
       
   218 
       
   219 		/**
       
   220 		* List of pointers to History Entries
       
   221 		* Pointers are owned by this class
       
   222 		*/
       
   223 //        CArrayPtrFlat<CHistoryEntry>* iHistoryList;
       
   224 
       
   225         TInt iCurrent;
       
   226 
       
   227 		TInt iHistoryStackStackSize;
       
   228 
       
   229         CHistoryMemCollector* iMemCollector;
       
   230 
       
   231     };
       
   232 #endif  // HISTORYSTACK_H
       
   233 
       
   234 // End of File