examples/Graphics/WS/Direct/Direct.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 // Application framework classes for Direct Screen Area (DSA) API example
00015 //
00016 
00017 #ifndef __DIRECT_H
00018 #define __DIRECT_H
00019 
00020 #include <coecntrl.h>
00021 #include <coeccntx.h>
00022 #include <coemain.h>
00023 
00024 #include <eikappui.h>
00025 #include <eikapp.h>
00026 #include <eikdoc.h>
00027 #include <uikon.hrh>
00028 
00029 #include <direct.rsg>
00030 #include "Direct.hrh"
00031 
00032 const TUid KUidExample = { 0xE8000054 };
00033 
00034 class CDirectDisplayLife;
00035 class CLifeEngine;
00036 
00037 // View, a window containing a DSA
00038 class CExampleAppView : public CCoeControl
00039         {
00040 public:
00041         // View state
00042         enum {
00043                 EDirectNotStarted=0,    // DSA not used
00044                 EDirectStarted,                 // DSA in use
00045                 EDirectPaused                   // Use of DSA temporarily halted
00046                 };
00047 
00048 public:
00049         // Construction & destruction
00050         CExampleAppView(CLifeEngine& aLifeEngine);
00051         ~CExampleAppView();
00052         void ConstructL(const TRect& aRect);
00053 
00054         // Start using the DSA
00055         void StartDirectL();
00056         // Pause use of the DSA
00057         void PauseDirect();
00058         // Restart use of the DSA after pausing
00059         void RestartDirect();
00060 
00061         // Gets the view state
00062         TInt State() const;
00063 
00064 private:
00065         // from CCoeControl
00066         void Draw(const TRect&) const;
00067 
00068 private:
00069         // The object that handles the DSA
00070         CDirectDisplayLife* iDirectDisplayLife;
00071         // The data the view displays
00072         CLifeEngine& iLifeEngine;
00073         // View state
00074         TInt iState;
00075         };
00076 
00077 // App UI, handles user commands
00078 class CExampleAppUi : public CEikAppUi
00079         {
00080 public:
00081         // Construction & destruction
00082         void ConstructL();
00083         ~CExampleAppUi();
00084 
00085 private:
00086         // from CEikAppUi
00087         void HandleCommandL(TInt aCommand);
00088 
00089 private:
00090         class COverlayDialog: public CActive
00091                 {
00092         public:
00093                 COverlayDialog();
00094                 ~COverlayDialog();
00095                 void ShowDialog();
00096 
00097         private:
00098                 void RunL();
00099                 void DoCancel();
00100 
00101         private:
00102                 RNotifier iNotifier;
00103                 TInt iR;
00104                 };
00105 
00106 private:
00107         // The app view
00108         CExampleAppView* iAppView;
00109         COverlayDialog* iOverlayDialog;
00110         };
00111 
00112 // App document. Owns the engine.
00113 class CExampleDocument : public CEikDocument
00114         {
00115 public:
00116         // Construction & destruction
00117         CExampleDocument(CEikApplication& aApp);
00118         ~CExampleDocument();
00119 
00120         // Gets the engine
00121         CLifeEngine& LifeEngine() const;
00122 
00123 private:
00124         // from CEikDocument
00125         CEikAppUi* CreateAppUiL();
00126 
00127 private:
00128         // The engine
00129         CLifeEngine* iLifeEngine;
00130         };
00131 
00132 // Application class
00133 class CExampleApplication : public CEikApplication
00134         {
00135 private: // from CApaApplication
00136         CApaDocument* CreateDocumentL();
00137         TUid AppDllUid() const;
00138         };
00139 
00140 #endif

Generated by  doxygen 1.6.2