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

Generated by  doxygen 1.6.2