examples/AppFramework/Clock/ClockExample.h

00001 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
00002 // All rights reserved.
00003 // This component and the accompanying materials are made available
00004 // under the terms of "Eclipse Public License v1.0"
00005 // which accompanies this distribution, and is available
00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00007 //
00008 // Initial Contributors:
00009 // Nokia Corporation - initial contribution.
00010 //
00011 // Contributors:
00012 //
00013 // Description:
00014 //
00015 
00016 #ifndef __CLOCKEXAMPLE_H__
00017 #define __CLOCKEXAMPLE_H__
00018 
00019 
00020 #include <coeccntx.h>
00021 
00022 #include <eikenv.h>
00023 #include <eikappui.h>
00024 #include <eikapp.h>
00025 #include <eikdoc.h>
00026 #include <eikmenup.h>
00027 
00028 #include <eikstart.h> 
00029 
00030 #include <clock.h>
00031 
00032 #include <clockexample.rsg>
00033 #include "ClockExample.hrh"
00034 
00035 #include <mymbs0.mbg>
00036 
00037 _LIT(KMyMBS,"z:\\system\\data\\MYMBS0.MBM");
00038 
00039 #define CLOCK 0  
00040 #define CLOCKMSK 1 
00041 
00042 enum TTimezoneOffset
00043         {
00044         EUTOffsetOneHour = ( 60 * 60 ),
00045         EUTOffsetHalfHour = ( 30 * 60 ),
00046         EUTOffsetQuarterHour = ( 15 * 60 ),
00047         EUTOffsetTenMinutes = ( 10 * 60 ),
00048         EUTOffsetFiveMinutes = ( 5 * 60 ),
00049         EUTOffsetOneMinute = ( 1 * 60 ),
00050         EUTOffsetThirtySeconds = ( 30 ),
00051         EUTOffsetFifteenSeconds = ( 15 ),
00052         EUTOffsetTenSeconds = ( 10 ),
00053         EUTOffsetFiveSeconds = ( 5 ),
00054         EUTOffsetOneSecond = ( 1 ),
00055 
00056         EUTOffsetLondon = 0,
00057         EUTOffsetLondonSummer = EUTOffsetLondon + EUTOffsetOneHour,
00058         EUTOffsetBangalore = 5 * EUTOffsetOneHour + EUTOffsetHalfHour           
00059         };
00060 
00061 // Destructable font for Digital clock
00062 class CDestructableFont : public CBase
00063         {
00064 public:
00065         CDestructableFont(CWsScreenDevice* aScreenDevice);
00066         void ConstructL(const TFontSpec& aFontSpec);
00067         virtual ~CDestructableFont();
00068         TInt Handle() const;
00069 private:
00070         CWsScreenDevice* iScreenDevice; // not owned by this pointer
00071         CFbsFont* iFont;
00072         };
00073         
00074                 
00075 // Application class    
00076 class CExampleApplication : public CEikApplication
00077         {
00078 private: 
00079         CApaDocument* CreateDocumentL();
00080         TUid AppDllUid() const;
00081         };
00082 
00083 // View class
00084 class CExampleAppView : public CCoeControl
00085     {
00086 public:
00087         static CExampleAppView* NewL( const TRect& aRect );
00088         CExampleAppView();
00089         ~CExampleAppView();
00090         void ConstructL( const TRect& aRect );
00091     
00092         void DoExperimentL( TInt aCommand );
00093         void ConstructAnalogClockL();
00094         void ConstructDigitalClockL();
00095 
00096 private:
00097         void Draw(const TRect& /*aRect*/) const;
00098 
00099 private:
00100         HBufC*  iTextBuffer;
00101         RAnalogClock* iAnalogClock;
00102         RDigitalClock* iDigitalClock;
00103         TPoint iDigitalClockPosition;
00104         TPoint iAnalogClockPosition;
00105         TSize iDigitalClockSize;
00106         TSize iAnalogClockSize;
00107         TInt iDigitalClockUniversalTimeOffset;
00108         TInt iAnalogClockUniversalTimeOffset;
00109         RAnimDll iAnimDll;
00110         
00111         TRgb iBackgroundColor;
00112         CFbsFont* iFont;
00113     };
00114 
00115 // Application UI class
00116 class CExampleAppUi : public CEikAppUi
00117     {
00118 public:
00119         void ConstructL();
00120         ~CExampleAppUi();
00121 
00122 private:
00123         void HandleCommandL(TInt aCommand);
00124 
00125 private:
00126         CExampleAppView* iAppView;
00127         };
00128 
00129 // Document class
00130 class CExampleDocument : public CEikDocument
00131         {
00132 public:
00133         static CExampleDocument* NewL(CEikApplication& aApp);
00134         CExampleDocument(CEikApplication& aApp);
00135         void ConstructL();
00136 private: 
00137         CEikAppUi* CreateAppUiL();
00138         };
00139 
00140 #endif // __CLOCKEXAMPLE_H__

Generated by  doxygen 1.6.2