exampleapps/alfexcalendar/inc/alfexcalendardeckcontrol.h
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c)  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:   ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef ALFEXCALENDARDECKCONTROL_H
       
    21 #define ALFEXCALENDARDECKCONTROL_H
       
    22 
       
    23 #include <alf/alfcontrol.h>
       
    24 
       
    25 const TInt KMonthsVisible = 2; // DONT CHANGE
       
    26 
       
    27 // Animation styles
       
    28 enum TMonthAnimationStyle
       
    29 {
       
    30     EAnimationStyle1 = 1,
       
    31     EAnimationStyle2,
       
    32     EAnimationStyle3,
       
    33     EAnimationStyleInvalid
       
    34 };
       
    35 
       
    36 // 
       
    37 enum TMonthTransitionState
       
    38 {
       
    39    ETransitionStateMovingToNext = 1,
       
    40    ETransitionStateMovingToPrev,
       
    41    ETransitionStateStopped
       
    42 };
       
    43 
       
    44 // Forward declarations
       
    45 class CAlfGridLayout;
       
    46 class CAlfDeckLayout;
       
    47 class CAlfFlowLayout;
       
    48 class CAlfCurvePath;
       
    49 class CAlfCurvePathLayout;
       
    50 class CAlfImageVisual;
       
    51 class CAlfExCalendarMonth;
       
    52 class CAlfExCalendarEngine;
       
    53 
       
    54 // CAlfExCalendarDeckControl declaration
       
    55 
       
    56 class CAlfExCalendarDeckControl : public CAlfControl
       
    57     {
       
    58 public: // methods
       
    59 
       
    60     /**
       
    61      * 2 phase construction
       
    62      */
       
    63     static CAlfExCalendarDeckControl* NewLC( CAlfEnv& aEnv, CAlfExCalendarEngine& aCalendarEngine );
       
    64 
       
    65     /**
       
    66      * destructor
       
    67      */    
       
    68     ~CAlfExCalendarDeckControl();
       
    69     
       
    70     /**
       
    71      * Handles application events
       
    72      *
       
    73      * @param aEvent contains event data
       
    74      * @return true if event is handled successfully
       
    75      */    
       
    76     TBool OfferEventL( const TAlfEvent& aEvent );
       
    77 
       
    78     /**
       
    79      * Sets month view value
       
    80      *
       
    81      * @param aVal value to be set to iMonthView
       
    82      */
       
    83     void SetMonthView( TBool aVal );
       
    84 
       
    85     /**
       
    86      * returns CAlfExCalendarEngine object
       
    87      * @return CAlfExCalendarEngine object
       
    88      */    
       
    89     CAlfExCalendarEngine& CalendarEngine() const;
       
    90     
       
    91 private: // Methods
       
    92     
       
    93     /**
       
    94      * constructor
       
    95      */
       
    96 	CAlfExCalendarDeckControl( CAlfExCalendarEngine& aCalendarEngine, CAlfEnv& aEnv  );
       
    97     
       
    98     /**
       
    99      * 2nd phase constructor
       
   100      */
       
   101     void ConstructL( CAlfEnv& aEnv );
       
   102 
       
   103     /**
       
   104      * Creates texture from aImageFileName and set it to aImageVisual
       
   105      *
       
   106      * @param aImageVisual created texture is added to this visual
       
   107      * @param aImageFileName file from which texture is created
       
   108      */
       
   109     void SetImageTexture(
       
   110             CAlfImageVisual* aImageVisual,
       
   111             const TDesC& aImageFileName );
       
   112 
       
   113 
       
   114     /**
       
   115      * updates the does transition to next month according to animation style
       
   116      */
       
   117     void UpdateNextMonthL();
       
   118 
       
   119     /**
       
   120      * does transition to next month according to animation style
       
   121      */
       
   122     void UpdatePrevMonthL();
       
   123 
       
   124     /**
       
   125      * does transition to next month according to animation style
       
   126      */
       
   127     void MoveToNextMonthL();
       
   128 
       
   129     /**
       
   130      * does transition to previous month according to animation style
       
   131      */
       
   132     void MoveToPrevMonthL();
       
   133 
       
   134     /**
       
   135      * Implements transition to next month with animation style 1
       
   136      * Gets the month from right of display with rotation
       
   137      */
       
   138     void MoveToNextMonthAnimation1L();
       
   139 
       
   140     /**
       
   141      * Implements transition to next month with animation style 2
       
   142      * Gets the month from bottom of the display
       
   143      */
       
   144     void MoveToNextMonthAnimation2L();
       
   145     
       
   146     /**
       
   147      * Implements transition to previous month with animation style 1
       
   148      * Moves curently visible month to right of display with rotation
       
   149      * so that below month is visible (which is previous month)
       
   150      */
       
   151     void MoveToPrevMonthAnimation1L();
       
   152 
       
   153     /**
       
   154      * Implements transition to previous month with animation style 2
       
   155      * Moves curently visible month to bottom of display, so that
       
   156      * below month is visible (which is previous month)
       
   157      */
       
   158     void MoveToPrevMonthAnimation2L();
       
   159 
       
   160     
       
   161     /**
       
   162      * performs scaling transformation according to given scaling factors
       
   163      *
       
   164      * @param aVisual
       
   165      * @param aXSf
       
   166      * @param aYSf
       
   167      * @param aTime
       
   168      */
       
   169     void ScaleVisualL(
       
   170             CAlfVisual& aVisual,
       
   171             TReal aXSf,
       
   172             TReal aYSf,
       
   173             TInt aTime );
       
   174 
       
   175     /**
       
   176      * performs rotation transformation according to given timed values.
       
   177      *
       
   178      * @param aVisual
       
   179      * @param aInitAngle
       
   180      * @param aTargetAngle
       
   181      * @param aTime
       
   182      */
       
   183     void RotateVisualL(
       
   184             CAlfVisual& aVisual,
       
   185             TReal aInitAngle,
       
   186             TReal aTargetAngle,
       
   187             TInt aTime );
       
   188 
       
   189     /**
       
   190      * Sets opacity of given visual according to timed values.
       
   191      *
       
   192      * @param aVisual
       
   193      * @param aInitValue
       
   194      * @param aTargetValue
       
   195      * @param aTime
       
   196      */
       
   197     void SetOpacity(
       
   198             CAlfVisual& aVisual,
       
   199             TReal aInitValue,
       
   200             TReal aTargetValue,
       
   201             TInt aTime );
       
   202     
       
   203 private: // Data
       
   204 	
       
   205     // toolkit environment
       
   206     CAlfEnv& iEnv;
       
   207     
       
   208     // deck layout
       
   209 	CAlfDeckLayout* iDeck;
       
   210     
       
   211     // index into iMonthControls
       
   212     TInt iCurrentMonthControlIndex;
       
   213     
       
   214     // currently focused month
       
   215 	TInt iFocusedMonth;
       
   216     
       
   217     // display rectangle
       
   218 	TRect iDisplayRect;
       
   219 	
       
   220     // current time/month
       
   221 	TTime iSelectedTime;
       
   222 
       
   223     // month control array
       
   224 	CAlfExCalendarMonth* iMonthControls[KMonthsVisible];
       
   225 
       
   226     // month view status
       
   227     TBool iMonthView;
       
   228 
       
   229     // dummy calendar engine
       
   230     CAlfExCalendarEngine& iCalendarEngine;
       
   231     
       
   232     // animation style
       
   233     TMonthAnimationStyle iMonthAnimationStyle;
       
   234     
       
   235     // month transition state
       
   236     TMonthTransitionState iMonthTransitionState;
       
   237 
       
   238     // CAlfImageVisual* iBackground; // Currently not used
       
   239 
       
   240     };
       
   241 
       
   242 #endif // ALFEXCALENDARDECKCONTROL_H
       
   243