# examples/Stdlib/GUIApp/GUIApp.h

    00001 // Copyright (c) 1997-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 // GUIAppEng.H
    00015 //
    00016
    00017 #if !defined(__SLSUMEIK_H__)
    00018 #define __SLSUMEIK_H__
    00019
    00021 //
    00022 // Include files containing:
    00023 //
    00024 // 1. Symbol definitions used by C++ code and resource scripts (the *.hrh)
    00025 // 2. Resource ids generated by resource compilation of
    00026 //    resource scripts (the *.rsg)
    00027 // 3. Class definitions required by this app (the *.h)
    00028 //
    00030
    00031 // 1.
    00032 #include <eikon.hrh>
    00033 #include "GUIApp.hrh"
    00034
    00035 #include <e32std.h> // required to avoid warning
    00036 // C header files
    00037 #include <fcntl.h>
    00038 #include <unistd.h>
    00039 #include <sys/reent.h>
    00040 #include "EXTERN.H"
    00041
    00042 #include <eikon.rsg> // needed for file browse dialog
    00043 #include <guiapp.rsg>
    00044
    00045 // 3.
    00046 #include <eikenv.h>
    00047 #include <eikappui.h>
    00048 #include <eikproc.h>
    00049 #include <eiktbar.h>
    00050 #include <eikfsel.h>
    00051 #include <eikapp.h>
    00052 #include <eikdoc.h>
    00053 #include <eikfnlab.h>
    00054 #include <eikfbrow.h>
    00055 #include <eikfutil.h>
    00056 #include <eiktxlbm.h>
    00057
    00058 #include <coeutils.h>
    00059
    00060 #include <basched.h>
    00061
    00062   // The unique identifier for this application.
    00063   // NOTE that the number has been arbitrarily chosen for the purpose
    00064   // of the example.
    00065 const TUid KUidCksumApp={0xE8000073};
    00066
    00067 // Number of digits required to hold the maximum length checksum
    00068 const TInt KMaxChecksumLength=10;
    00069
    00071 //
    00072 // -----> CExamplePrefsDialog(definition)
    00073 //
    00075
    00076 class CExampleChecksumDialog : public CEikDialog
    00077         {
    00078 public:
    00079         CExampleChecksumDialog(TDes* aFileName, TInt aTitleId=0);
    00080 private:
    00081         void       PreLayoutDynInitL();
    00082         TBool      OkToExitL(TInt aKeycode);
    00083 private:
    00084           // Data members defined by this class.
    00085         TDes* iFileName;
    00086         TInt iTitleId;
    00087         };
    00088
    00089 class CExampleListBoxDialog : public CEikDialog
    00090     {
    00091 public:
    00092         CExampleListBoxDialog(CDesCArrayFlat* aCksumArray); // (change name of parameter)
    00093 private: // framework
    00094     void PreLayoutDynInitL();
    00095         void SetSizeAndPositionL(const TSize& aSize);
    00096     TBool OkToExitL(TInt aKeycode);
    00097         CDesCArrayFlat* iCksumArray;
    00098     };
    00099
    00100
    00102 //
    00103 // -----> CExampleContainer(definition)
    00104 //
    00106 class CExampleContainer : public CCoeControl,
    00107                       public MCoeControlObserver
    00108         {
    00109 public:
    00110           // Construction
    00111         CExampleContainer();
    00112         void ConstructL(const TRect& aRect);
    00113           // Destruction
    00114         ~CExampleContainer();
    00115
    00116 private:
    00117           // Virtual, defined by CCoeControl; replaces the default implementation
    00118           // provided by CCoeControl.
    00119         void         Draw(const TRect& aRect) const;
    00120
    00121           // Defined as pure virtual by the mixin class MCoeControlObserver
    00122           // inherited by CCoeControl. An empty implementation provided by
    00123           // this class (its containees do not report events).
    00124         void         HandleControlEventL(CCoeControl* aControl,
    00125                                              TCoeEvent aEventType
    00126                                                                         );
    00127
    00128 public:
    00129           // Member functions defined by this class
    00130         void                     AppendChecksumL(const TDesC& aFilename);
    00131         CDesCArrayFlat*  GetChecksumArray() const;
    00132
    00133
    00134 private:
    00135       // Data members defined and used by this class.
    00136         CDesCArrayFlat* iChecksumArray;                 // List of filenames and checksums
    00137         };
    00138
    00140 //
    00141 // -----> CExampleAppUi (definition)
    00142 //
    00144 class CExampleAppUi : public CEikAppUi
    00145         {
    00146 public:
    00147           // Destruction.
    00148         ~CExampleAppUi();
    00149
    00150 public:
    00151           // Virtual, defined by CEikAppUi; replaces the implementation
    00152           // provided by CEikAppUi.
    00153         void ConstructL();
    00154
    00155 private:
    00156           // Virtual, defined by CEikAppUi; ; empty implementation
    00157           // provided by CEikAppUi; full implementation provided
    00158           // by this class.
    00159         void  HandleCommandL(TInt aCommand);
    00160
    00161 private:
    00162           // Member functions defined by this class
    00163         void         OnCmdExit();
    00164         void             OnCmdChecksumL();
    00165         void             OnCmdViewChecksumsL();
    00166         void         DrawViewL();
    00167
    00168 private:
    00169           // Data members defined by this class.
    00170         CExampleContainer* iContainer;      // The container control (ie the view)
    00171         };
    00172
    00174 //
    00175 // -----> CExampleDocument (definition)
    00176 //
    00178 class CExampleDocument : public CEikDocument
    00179         {
    00180 public:
    00181           // Construction.
    00182         static CExampleDocument* NewL(CEikApplication& aApp);
    00183     CExampleDocument(CEikApplication& aApp);
    00184           // Destruction.
    00185         ~CExampleDocument();
    00186
    00187 private:
    00188           // Defined as pure virtual by CEikDocument; full implementation
    00189           // provided by this class
    00190         CEikAppUi* CreateAppUiL();              // Construct an app.user interface
    00191         };
    00192
    00194 //
    00195 // -----> CExampleApplication (definition)
    00196 //
    00198 class CExampleApplication : public CEikApplication
    00199         {
    00200 private:
    00201           // Defined as pure virtual by CApaApplication; implementation
    00202           // provided by this class
    00203         TUid          AppDllUid() const; // Returns Uid associated with app
    00204
    00205           // Defined as pure virtual by CEikApplication; implementation
    00206           // provided by this class.
    00207         CApaDocument* CreateDocumentL(); // Construct new document
    00208         };
    00209
    00210 #endif