examples/AppFramework/Clock/ClockExample.h

00001 /*
00002 Copyright (c) 2005-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 #ifndef __CLOCKEXAMPLE_H__
00032 #define __CLOCKEXAMPLE_H__
00033 
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 
00043 #include <eikstart.h> 
00044 
00045 #include <clock.h>
00046 
00047 #include <clockexample.rsg>
00048 #include "ClockExample.hrh"
00049 
00050 #include <mymbs0.mbg>
00051 
00052 _LIT(KMyMBS,"z:\\system\\data\\MYMBS0.MBM");
00053 
00054 #define CLOCK 0  
00055 #define CLOCKMSK 1 
00056 
00057 enum TTimezoneOffset
00058         {
00059         EUTOffsetOneHour = ( 60 * 60 ),
00060         EUTOffsetHalfHour = ( 30 * 60 ),
00061         EUTOffsetQuarterHour = ( 15 * 60 ),
00062         EUTOffsetTenMinutes = ( 10 * 60 ),
00063         EUTOffsetFiveMinutes = ( 5 * 60 ),
00064         EUTOffsetOneMinute = ( 1 * 60 ),
00065         EUTOffsetThirtySeconds = ( 30 ),
00066         EUTOffsetFifteenSeconds = ( 15 ),
00067         EUTOffsetTenSeconds = ( 10 ),
00068         EUTOffsetFiveSeconds = ( 5 ),
00069         EUTOffsetOneSecond = ( 1 ),
00070 
00071         EUTOffsetLondon = 0,
00072         EUTOffsetLondonSummer = EUTOffsetLondon + EUTOffsetOneHour,
00073         EUTOffsetBangalore = 5 * EUTOffsetOneHour + EUTOffsetHalfHour           
00074         };
00075 
00076 // Destructable font for Digital clock
00077 class CDestructableFont : public CBase
00078         {
00079 public:
00080         CDestructableFont(CWsScreenDevice* aScreenDevice);
00081         void ConstructL(const TFontSpec& aFontSpec);
00082         virtual ~CDestructableFont();
00083         TInt Handle() const;
00084 private:
00085         CWsScreenDevice* iScreenDevice; // not owned by this pointer
00086         CFbsFont* iFont;
00087         };
00088         
00089                 
00090 // Application class    
00091 class CExampleApplication : public CEikApplication
00092         {
00093 private: 
00094         CApaDocument* CreateDocumentL();
00095         TUid AppDllUid() const;
00096         };
00097 
00098 // View class
00099 class CExampleAppView : public CCoeControl
00100     {
00101 public:
00102         static CExampleAppView* NewL( const TRect& aRect );
00103         CExampleAppView();
00104         ~CExampleAppView();
00105         void ConstructL( const TRect& aRect );
00106     
00107         void DoExperimentL( TInt aCommand );
00108         void ConstructAnalogClockL();
00109         void ConstructDigitalClockL();
00110 
00111 private:
00112         void Draw(const TRect& /*aRect*/) const;
00113 
00114 private:
00115         HBufC*  iTextBuffer;
00116         RAnalogClock* iAnalogClock;
00117         RDigitalClock* iDigitalClock;
00118         TPoint iDigitalClockPosition;
00119         TPoint iAnalogClockPosition;
00120         TSize iDigitalClockSize;
00121         TSize iAnalogClockSize;
00122         TInt iDigitalClockUniversalTimeOffset;
00123         TInt iAnalogClockUniversalTimeOffset;
00124         RAnimDll iAnimDll;
00125         
00126         TRgb iBackgroundColor;
00127         CFbsFont* iFont;
00128     };
00129 
00130 // Application UI class
00131 class CExampleAppUi : public CEikAppUi
00132     {
00133 public:
00134         void ConstructL();
00135         ~CExampleAppUi();
00136 
00137 private:
00138         void HandleCommandL(TInt aCommand);
00139 
00140 private:
00141         CExampleAppView* iAppView;
00142         };
00143 
00144 // Document class
00145 class CExampleDocument : public CEikDocument
00146         {
00147 public:
00148         static CExampleDocument* NewL(CEikApplication& aApp);
00149         CExampleDocument(CEikApplication& aApp);
00150         void ConstructL();
00151 private: 
00152         CEikAppUi* CreateAppUiL();
00153         };
00154 
00155 #endif // __CLOCKEXAMPLE_H__

Generated by  doxygen 1.6.2