1 /* Copyright (c) 2004-2005 Nokia. All rights reserved. */
3 /* The PerlApp application is licensed under the same terms as Perl itself. */
10 # include <aknappui.h>
12 #endif /* #ifdef __SERIES60__ */
16 # include <eikappui.h>
18 # include <eikbctrl.h>
20 # include <eikdialg.h>
21 #endif /* #ifdef __SERIES60__ */
26 /* The source code can be compiled into "PerlApp" which is the simple
27 * launchpad application/demonstrator, or into "PerlAppMinimal", which
28 * is the minimal Perl launchpad application. Define the cpp symbols
29 * CreatePerlAppMinimal (a boolean), PerlAppMinimalUid (the Symbian
30 * application uid in the 0x... format), and PerlAppMinimalName (a C
31 * wide string, with the L prefix) to compile as "PerlAppMinimal". */
33 // #define CreatePerlAppMinimal
35 #ifdef CreatePerlAppMinimal
36 # define PerlAppMinimal
37 # ifndef PerlAppMinimalUid // PerlApp is ...F6, PerlRecog is ...F7
38 # define PerlAppMinimalUid 0x102015F8
40 # ifndef PerlAppMinimalName
41 # define PerlAppMinimalName L"PerlAppMinimal"
46 # ifndef PerlAppMinimalUid
47 # error PerlAppMinimal defined but PerlAppMinimalUid undefined
49 # ifndef PerlAppMinimalName
50 # error PerlAppMinimal defined but PerlAppMinimalName undefined
55 # define CMyDocument CAknDocument
56 # define CMyApplication CAknApplication
57 # define CMyAppUi CAknAppUi
58 # define CMyNoteDialog CAknNoteDialog
59 # define CMyAppView CCoeControl
60 #endif /* #ifdef __SERIES60__ */
63 # define CMyDocument CEikDocument
64 # define CMyApplication CEikApplication
65 # define CMyAppUi CEikAppUi
66 # define CMyNoteDialog CCknFlashingDialog
67 # define CMyAppView CEikBorderedControl
68 #endif /* #ifdef __SERIES60__ */
70 class CPerlAppDocument : public CMyDocument
73 CPerlAppDocument(CEikApplication& aApp):CMyDocument(aApp) {;}
74 #ifndef PerlAppMinimal
75 CFileStore* OpenFileL(TBool aDoOpen, const TDesC& aFilename, RFs& aFs);
76 #endif // #ifndef PerlAppMinimal
77 private: // from CEikDocument
78 CEikAppUi* CreateAppUiL();
81 class CPerlAppApplication : public CMyApplication
84 CApaDocument* CreateDocumentL();
85 TUid AppDllUid() const;
88 const TUint KPerlAppPromptSize = 20;
89 const TUint KPerlAppOneLinerSize = 128;
93 class CPerlAppUi : public CMyAppUi
98 TBool ProcessCommandParametersL(TApaCommand aCommand, TFileName& aDocumentName, const TDesC8& aTail);
99 void HandleCommandL(TInt aCommand);
100 #ifndef PerlAppMinimal
101 void OpenFileL(const TDesC& aFileName);
102 void InstallOrRunL(const TFileName& aFileName);
103 void SetFs(const RFs& aFs);
104 #endif // #ifndef PerlAppMinimal
105 TBuf<KPerlAppOneLinerSize> iOneLiner; // Perl source code to evaluate.
106 CPerlAppView* iAppView;
111 class CPerlAppView : public CMyAppView
114 static CPerlAppView* NewL(const TRect& aRect);
115 static CPerlAppView* NewLC(const TRect& aRect);
117 void Draw(const TRect& aRect) const;
119 void HandleCommandL(TInt aCommand);
120 #endif /* #ifdef __SERIES80__ */
122 void ConstructL(const TRect& aRect);
127 class CPerlAppTextQueryDialog : public CEikDialog
130 CPerlAppTextQueryDialog(HBufC*& aBuffer);
131 /* TODO: OfferKeyEventL() so that newline can be seen as 'OK'. */
133 TPtrC iTitle; // used in S80 but not in S60
134 TPtrC iPrompt; // used in S60 and S80
137 void PreLayoutDynInitL();
139 TBool OkToExitL(TInt aKeycode);
142 #endif /* #ifdef __SERIES80__ */
144 #endif // __PerlApp_h__