webengine/webkitutils/HistoryProvider/HistoryView.h
changeset 0 dd21522fd290
child 64 ac77f89b1d9e
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     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:  Represents the History View
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef HISTORYVIEW_H
       
    21 #define HISTORYVIEW_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <bitdev.h>
       
    26 #include <coecntrl.h>
       
    27 
       
    28 enum THistoryViewComponent
       
    29     {
       
    30     EHistoryComponentNone,
       
    31     EHistoryComponentLeftArrow,
       
    32     EHistoryComponentRightArrow,
       
    33     EHistoryComponentLeftPlaceHolder,
       
    34     EHistoryComponentMiddlePlaceHolder,
       
    35     EHistoryComponentRightPlaceHolder
       
    36     };
       
    37 
       
    38 
       
    39 // CONSTANTS
       
    40 const int KCenterThumbnailWidthPercent = 50;
       
    41 const int KCenterThumbnailHeightPercent = 90;
       
    42 const int KSideThumbnailWidthPercent = 25;
       
    43 const int KSideThumbnailHeightPercent = 70;
       
    44 
       
    45 // FORWARD DECLARATIONS
       
    46 class HistoryController;
       
    47 class HistoryEntry;
       
    48 class WebSurface;
       
    49 
       
    50 // CLASS DECLARATION
       
    51 
       
    52 /**
       
    53 *  Displays the Graphival History List
       
    54 *
       
    55 *  @lib browserview.lib
       
    56 *  @since Series 60 3.0
       
    57 */
       
    58 class HistoryView : public CCoeControl
       
    59     {
       
    60     public:  // Constructors and destructor
       
    61 
       
    62         /**
       
    63         * Two-phased constructor.
       
    64         */
       
    65         static HistoryView* NewL( HistoryController& historyController, bool previous);
       
    66 
       
    67         /**
       
    68         * Destructor.
       
    69         */
       
    70         virtual ~HistoryView();
       
    71 
       
    72     public: // New functions
       
    73 
       
    74        /**
       
    75         *
       
    76         * Pass key events to the Browser Control
       
    77         * @since 3.0
       
    78         * @param aKeyEvent The key event
       
    79         * @param aType The key code
       
    80         * @return If the Browser Control consumed the key event or not
       
    81         */
       
    82         TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aEventCode);
       
    83 
       
    84         /**
       
    85         * Draws the offscreen bitmap to the screen
       
    86         * @since 3.0
       
    87         * @param aGc System graphics context
       
    88         * @param aRect rectangle to be drawn
       
    89         * @return void
       
    90         */
       
    91         virtual void Draw( const TRect& aRect ) const;
       
    92 
       
    93         /**
       
    94         * GetCenterEntryTitle
       
    95         *
       
    96         * @since 3.x
       
    97         * @return page title of center entry
       
    98         */
       
    99         TPtrC getCenterEntryTitle();
       
   100 
       
   101         /**
       
   102         * CalcRepaintRect
       
   103         * Method to do transtion effect when the history view is launched
       
   104         * @since 3.x
       
   105         * @return ETrue when animation is continuing and EFalse when animation completes
       
   106         */
       
   107         bool calcRepaintRect();
       
   108 
       
   109         /**
       
   110         * AnimatePlaceHolderPosition
       
   111         * Method to do transtion effect when user navigates in the history view
       
   112         * @since 3.x
       
   113         * @return ETrue when animation is continuing and EFalse when animation completes
       
   114         */
       
   115         bool animatePlaceHolderPosition();
       
   116 
       
   117         /**
       
   118         * AnimatePlaceHolderPosition
       
   119         * Method to do transtion effect when user navigates in the history view
       
   120         * @since 3.x
       
   121         * @return ETrue when animation is continuing and EFalse when animation completes
       
   122         */
       
   123         int historyLoadOffset() { return ( m_centerPageIndex-m_historyStackIndex ); }
       
   124 
       
   125         /**
       
   126         * HandlePointerEventL
       
   127         * From CCoeControl
       
   128         *
       
   129         */
       
   130         virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
   131 
       
   132         /**
       
   133         * AutoScroll
       
   134         * Called v=by timer callback when user presses an arrow and does not let go
       
   135         * @since 3.2
       
   136         * @param
       
   137         * @return
       
   138         */
       
   139         void autoScroll();
       
   140         
       
   141         /**
       
   142         * Perform transition
       
   143         * Method to do layout of the history view place holders
       
   144         * @since 3.x
       
   145         * @return void
       
   146         */
       
   147         void performTransition(int dir);
       
   148         
       
   149         void updateState(int dir);
       
   150        
       
   151 
       
   152     private:
       
   153 
       
   154         /**
       
   155         * Constructor
       
   156         * @since 3.x
       
   157         * @param aWebKitControl
       
   158         * @param aRect
       
   159         * @param aMode display mode
       
   160         */
       
   161         HistoryView( HistoryController& aHistoryController, bool aPrevious );
       
   162 
       
   163         /**
       
   164         * By default Symbian 2nd phase constructor is private.
       
   165         */
       
   166         void ConstructL( );
       
   167 
       
   168         /**
       
   169         * Updates the offscreen bitmap with the thumbnails to be drawn
       
   170         * @since 3.x
       
   171         * @return void
       
   172         */
       
   173         void updateDisplay();
       
   174 
       
   175         /**
       
   176         * Creates offscreen bitmap
       
   177         * @since 3.x
       
   178         * @return void
       
   179         */
       
   180         void updateOffscreenBitmapL( );
       
   181 
       
   182         /**
       
   183         *   From CCoeControl, CountComponentControls
       
   184         */
       
   185         int CountComponentControls() const {return 0;}
       
   186 
       
   187         /**
       
   188         *   From CCoeControl, SizeChanged
       
   189         */
       
   190         virtual void SizeChanged();
       
   191 
       
   192         /**
       
   193         *   From CCoeControl, ComponentControl
       
   194         */
       
   195         CCoeControl* ComponentControl(int /*aIndex*/) const { return NULL;}
       
   196 
       
   197         /**
       
   198         * CalculateLayout
       
   199         * Method to do layout of the history view place holders
       
   200         * @since 3.x
       
   201         * @return void
       
   202         */
       
   203         void calculateLayout();
       
   204 
       
   205         /**
       
   206         * LoadUrl
       
   207         * Method to load an url
       
   208         * @since 3.x
       
   209         * @return void
       
   210         */
       
   211         void loadUrl();
       
   212 
       
   213     private:    // Data
       
   214 
       
   215 
       
   216         CFbsBitmapDevice*        m_bitmapDevice;     // owned
       
   217 
       
   218         WebSurface*              m_renderTarget;        // no owned
       
   219 
       
   220         CFbsBitGc*               m_bitmapContext; // owned
       
   221 
       
   222         HistoryController*       m_historyController;// not owned
       
   223 
       
   224         // indicates the index of the center thumbnail
       
   225         int                      m_centerPageIndex;
       
   226 
       
   227         TRect                    m_offscreenRect;
       
   228 
       
   229         // represents the entry corresponding to the selected page in view
       
   230         HistoryEntry*            m_centerEntry; // not owned
       
   231         // timer used to do animation
       
   232         CIdle*                   m_repaintTimer;
       
   233         //repaint rect using during animating initial display of history view
       
   234         TRect                    m_repaintRect;
       
   235         //resize factor applied during initial display animation
       
   236         int                      m_resizeFactor;
       
   237         //left place holder rectangle
       
   238         TRect                    m_leftPlaceHolderRect;
       
   239         //left place holder rectangle
       
   240         TRect                    m_centerPlaceHolderRect;
       
   241         //left place holder rectangle
       
   242         TRect                    m_rightPlaceHolderRect;
       
   243         //Left Arrow position
       
   244         TPoint                   m_leftArrow[3];
       
   245         //Right arrow position
       
   246         TPoint                   m_rightArrow[3];
       
   247         //Factor used during animation of place holders
       
   248         int                      m_placeHolderResizeFactor;
       
   249         //Direction of movement
       
   250         int                      m_direction;
       
   251         //Flag to check if fast animation is needed or not
       
   252         bool                     m_fastScroll;
       
   253         // Initial position of History Stack
       
   254         int                      m_historyStackIndex;
       
   255         // Save the last pointer event
       
   256         TPointerEvent            m_pointerEvent;
       
   257         // Component selected by MouseDown event
       
   258         THistoryViewComponent    m_historyViewComponent;
       
   259         // Timer for repeated scrolling
       
   260         CPeriodic*               m_autoScrollPeriodic;
       
   261 
       
   262         TPoint m_lastpointerposition;
       
   263     };
       
   264 
       
   265 #endif      // HISTORYVIEW_H
       
   266 
       
   267 // End of File