examples/AppFramework/AnimExample/AnimExample.h

00001 /*
00002 Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
00003 
00004 Redistribution and use in source and binary forms, with or without
00005 modification, are permitted provided that the following conditions are met:
00006 
00007 * Redistributions of source code must retain the above copyright notice, this
00008   list of conditions and the following disclaimer.
00009 * Redistributions in binary form must reproduce the above copyright notice,
00010   this list of conditions and the following disclaimer in the documentation
00011   and/or other materials provided with the distribution.
00012 * Neither the name of Nokia Corporation nor the names of its contributors
00013   may be used to endorse or promote products derived from this software
00014   without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00017 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00020 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00021 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00022 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00023 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00024 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00025 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 
00027 Description:  
00028 */
00029 
00030 
00031 
00032 #ifndef __ANIMEXAMPLE_H
00033 #define __ANIMEXAMPLE_H
00034 
00035 #include <coeccntx.h>
00036 
00037 #include <eikenv.h>
00038 #include <eikappui.h>
00039 #include <eikapp.h>
00040 #include <eikdoc.h>
00041 #include <eikmenup.h>
00042 #include <eikstart.h> 
00043 #include <eikon.hrh>
00044 #include <gdi.h>
00045 
00046 #include <spriteanimation.h>
00047 #include <iclanimationdataprovider.h>
00048 #include <basicanimation.h>
00049 #include "animMover.h"
00050 #include <animexample.rsg>
00051 #include "AnimExample.hrh"
00052 
00053 _LIT(KAnimExStopWatch,"Z:\\resource\\apps\\AnimExample\\stopwatch.gif");
00054 
00055 _LIT( KAnimExSpriteLabel, "Sprite Animation" );
00056 _LIT( KAnimExBasicLabel, "Basic Animation" );
00057 
00058 const TInt KBasicOffset = 135;
00059 const TInt KSpriteOffset = 25;
00060 
00061 const TInt KspriteInterval = 10000;  //Microseconds
00062 const TInt KBasicInterval = 99999; //Microseconds
00063 
00064 const TInt KAnimExBasicPositionX = 300;
00065 const TInt KAnimExBasicPositionY = 100;
00066 const TInt KAnimExSpritePositionX = 60;
00067 const TInt KAnimExSpritePositionY = 70; 
00068 
00069 
00070 enum TAnimOperation
00071         {
00072         EAnimPause,
00073         EAnimResume,    
00074         EAnimHold,
00075         EAnimUnhold,
00076         EAnimFreeze,
00077         EAnimUnfreeze,
00078         EAnimStart,
00079         EAnimStop               
00080         };
00081 
00082 
00083 class CAnimationApplication : public CEikApplication
00084         {
00085 private: 
00086         // Inherited from class CApaApplication
00087         CApaDocument* CreateDocumentL();
00088         TUid AppDllUid() const;
00089         };
00090 
00091 class CAnimationAppView : public CCoeControl
00092     {
00093 public:
00094         static CAnimationAppView* NewL( const TRect& aRect );
00095         CAnimationAppView();
00096         ~CAnimationAppView();
00097     void ConstructL( const TRect& aRect );
00098     
00099     void ProduceSpriteAnimL();
00100     void ProduceBasicAnimL();
00101     void MoveAnimsL();
00102     void DoSpriteAnimOperationL( TAnimOperation aOperation );
00103     void DoBasicAnimOperationL( TAnimOperation aOperation );
00104     void ResetSpriteAnimAndMover();
00105     void ResetBasicAnimAndMover();
00106 
00107     CSpriteAnimation* iSpriteAnim;
00108         CBasicAnimation* iBasicAnim;
00109         
00110 private:
00111         // From CCoeControl
00112         void Draw(const TRect& /*aRect*/) const;
00113 
00114 private:
00115         HBufC*  iAnimTestText;
00116         CSpriteAnimMover* iSpriteAnimMover;
00117         CBasicAnimMover* iBasicAnimMover;
00118         
00119     };
00120 
00121 class CAnimationAppUi : public CEikAppUi
00122     {
00123 public:
00124     void ConstructL();
00125         ~CAnimationAppUi();
00126 
00127 private:
00128     // Inherited from class CEikAppUi
00129         void HandleCommandL(TInt aCommand);
00130 
00131 private:
00132         CAnimationAppView* iAppView;
00133         };
00134 
00135 
00136 class CAnimationDocument : public CEikDocument
00137         {
00138 public:
00139         static CAnimationDocument* NewL(CEikApplication& aApp);
00140         CAnimationDocument(CEikApplication& aApp);
00141         void ConstructL();
00142 
00143 private: 
00144         // Inherited from CEikDocument
00145         CEikAppUi* CreateAppUiL();
00146         };
00147 
00148 
00149 #endif
00150 
00151 

Generated by  doxygen 1.6.2