emailuis/uicomponents/inc/fstextviewercontrol.h
branchRCL_3
changeset 25 3533d4323edc
parent 0 8466d47a6819
equal deleted inserted replaced
24:d189ee25cf9d 25:3533d4323edc
       
     1 /*
       
     2 * Copyright (c) 2007 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 "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:  Control class for TextViewer component
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_FSTEXTVIEWERCONTROL_H
       
    20 #define C_FSTEXTVIEWERCONTROL_H
       
    21 
       
    22 //<cmail> removed __FS_ALFRED_SUPPORT flag
       
    23 //#include <fsconfig.h>
       
    24 //</cmail> removed __FS_ALFRED_SUPPORT flag
       
    25 // <cmail> SF
       
    26 #include <alf/alfcontrol.h>
       
    27 #include <eiksbobs.h>                // MEikScrollBarObserver
       
    28 #include <aknphysicsobserveriface.h> // MAknPhysicsObserver
       
    29 // </cmail>
       
    30 
       
    31 #include "fstextviewerobserver.h"
       
    32 #include "fstextviewervisualizer.h"
       
    33 
       
    34 class CAknPhysics;
       
    35 class CFsTextViewerVisualizer;
       
    36 class MFsTextViewerObserver;
       
    37 class CFsTextViewerKeys;
       
    38 
       
    39 class CFsTextViewerControl :
       
    40     public CAlfControl,
       
    41     public MEikScrollBarObserver,
       
    42     public MAknPhysicsObserver
       
    43     {
       
    44 
       
    45     public:
       
    46         static CFsTextViewerControl* NewL( CAlfEnv& aEnv );
       
    47         ~CFsTextViewerControl();
       
    48 
       
    49     public:
       
    50         void SetVisualizer( CFsTextViewerVisualizer* aVis );
       
    51         void SetObserver( MFsTextViewerObserver* aObserver );
       
    52         void EnableCursorScroll( TBool aStatus = ETrue );
       
    53         TBool CursorScroll();
       
    54         void SetKeys( CFsTextViewerKeys* aKeys );
       
    55         CFsTextViewerKeys* Keys();
       
    56         TBool IsScrollEventHandlingOngoing();
       
    57 
       
    58         // Scroll specified offset, direction is calculated based on the
       
    59         // given offset and view's current position.
       
    60         void ScrollL(
       
    61                 const TInt aOffset,
       
    62                 const TInt aTime = CFsTextViewerVisualizer::EUseDefaultScrollTime );
       
    63         // Scroll specified offset to specified direction. If aOffset is
       
    64         // less than zero, scrolls default amount.
       
    65         void ScrollL( 
       
    66                 const MFsTextViewerObserver::TFsTextViewerEvent aEventDirection,
       
    67                 const TInt aOffset = CFsTextViewerVisualizer::EUseDefaultScrollOffset,
       
    68                 const TInt aTime = CFsTextViewerVisualizer::EUseDefaultScrollTime );
       
    69         
       
    70     protected:
       
    71         /**
       
    72          * From CAlfControl
       
    73          */
       
    74         void NotifyControlVisibility( TBool  aIsVisible, CAlfDisplay& aDisplay );
       
    75         
       
    76     private:
       
    77         CFsTextViewerControl(  );
       
    78         void ConstructL( CAlfEnv& aEnv );
       
    79 
       
    80     private:
       
    81         TBool OfferEventL( const TAlfEvent& aEvent );
       
    82         TBool HandleKeyEventL( const TAlfEvent& aEvent );
       
    83         TBool HandlePointerEventL( const TAlfEvent& aEvent );
       
    84         void UpdatePhysicsL();
       
    85         
       
    86     public:
       
    87         /**
       
    88          * From MEikScrollBarObserver
       
    89          * 
       
    90          * Callback method for scroll bar events
       
    91          *
       
    92          * Scroll bar observer should implement this method to get scroll bar events.
       
    93          *
       
    94          * @since S60 0.9
       
    95          * @param aScrollBar A pointer to scrollbar which created the event
       
    96          * @param aEventType The event occured on the scroll bar
       
    97          */
       
    98         void HandleScrollEventL( CEikScrollBar* aScrollBar, TEikScrollEvent aEventType );
       
    99         
       
   100     private: // from MAknPhysicsObserver
       
   101 
       
   102        /**
       
   103         * @see MAknPhysicsObserver::ViewPositionChanged
       
   104         */
       
   105        virtual void ViewPositionChanged( const TPoint& aNewPosition, TBool aDrawNow, TUint aFlags );
       
   106 
       
   107        /**
       
   108         * @see MAknPhysicsObserver::PhysicEmulationEnded
       
   109         */
       
   110        virtual void PhysicEmulationEnded();
       
   111 
       
   112        /**
       
   113         * @see MAknPhysicsObserver::ViewPosition
       
   114         */
       
   115        virtual TPoint ViewPosition() const;
       
   116 
       
   117     private:
       
   118         CFsTextViewerVisualizer* iVisualizer;
       
   119         MFsTextViewerObserver* iObserver;
       
   120         TBool iCursorUDScroll;
       
   121         CFsTextViewerKeys* iKeys;
       
   122         CAknPhysics* iPhysics;
       
   123         TBool iScrollEventHandlingOngoing;
       
   124         TBool iIsVisible;
       
   125         TBool iStartHotspotAction;
       
   126         TBool iIsDragging;
       
   127         TBool iIsFlicking;
       
   128         TPoint iPreviousPosition;
       
   129         TPoint iOriginalPosition;
       
   130         TTime iStartTime;
       
   131     };
       
   132 
       
   133 #endif // C_FSTEXTVIEWERCONTROL_H
       
   134