Symbian/beginnings of Series 80 support
[p5sagit/p5-mst-13.2.git] / symbian / PerlApp.h
CommitLineData
27da23d5 1/* Copyright (c) 2004-2005 Nokia. All rights reserved. */
2
3/* The PerlApp application is licensed under the same terms as Perl itself. */
4
5#ifndef __PerlApp_h__
6#define __PerlApp_h__
7
ed76c0e4 8#ifdef __SERIES60__
9# include <aknapp.h>
10# include <aknappui.h>
11# include <akndoc.h>
12#endif /* #ifdef __SERIES60__ */
13
14#ifdef __SERIES80__
15# include <eikapp.h>
16# include <eikappui.h>
17# include <eikdoc.h>
18# include <eikbctrl.h>
19# include <eikgted.h>
20#endif /* #ifdef __SERIES60__ */
21
27da23d5 22#include <coecntrl.h>
23#include <f32file.h>
24
f26f4a2f 25/* The source code can be compiled into "PerlApp" which is the simple
26 * launchpad application/demonstrator, or into "PerlMin", which is the
ed76c0e4 27 * minimal Perl launchpad application. Define the cpp symbols
f26f4a2f 28 * PerlMin (a boolean), PerlMinUid (the Symbian application uid in
29 * the 0x... format), and PerlMinName (a C wide string, with the L prefix)
30 * to compile as "PerlMin". */
31
ed76c0e4 32#define PerlMinSample
f26f4a2f 33
34#ifdef PerlMinSample
35# define PerlMin
36# define PerlMinUid 0x102015F6
37# define PerlMinName L"PerlMin"
38#endif
39
40#ifdef PerlMin
41# ifndef PerlMinUid
42# error PerlMin defined but PerlMinUid undefined
43# endif
44# ifndef PerlMinName
45# error PerlMin defined but PerlMinName undefined
46# endif
47#endif
48
ed76c0e4 49#ifdef __SERIES60__
50# define CMyDocument CAknDocument
51# define CMyApplication CAknApplication
52# define CMyAppUi CAknAppUi
53# define CMyNoteDialog CAknNoteDialog
54# define CMyAppView CCoeControl
55#endif /* #ifdef __SERIES60__ */
56
57#ifdef __SERIES80__
58# define CMyDocument CEikDocument
59# define CMyApplication CEikApplication
60# define CMyAppUi CEikAppUi
61# define CMyNoteDialog CCknFlashingDialog
62# define CMyAppView CEikBorderedControl
63#endif /* #ifdef __SERIES60__ */
64
65class CPerlAppDocument : public CMyDocument
27da23d5 66{
67 public:
ed76c0e4 68 CPerlAppDocument(CEikApplication& aApp):CMyDocument(aApp) {;}
f26f4a2f 69#ifndef PerlMin
27da23d5 70 CFileStore* OpenFileL(TBool aDoOpen, const TDesC& aFilename, RFs& aFs);
f26f4a2f 71#endif // #ifndef PerlMin
27da23d5 72 private: // from CEikDocument
73 CEikAppUi* CreateAppUiL();
74};
75
ed76c0e4 76class CPerlAppApplication : public CMyApplication
27da23d5 77{
78 private:
79 CApaDocument* CreateDocumentL();
80 TUid AppDllUid() const;
81};
82
ed76c0e4 83const TUint KPerlAppPromptSize = 20;
84const TUint KPerlAppOneLinerSize = 128;
27da23d5 85
86class CPerlAppView;
87
ed76c0e4 88class CPerlAppUi : public CMyAppUi
27da23d5 89{
90 public:
91 void ConstructL();
92 ~CPerlAppUi();
f26f4a2f 93 TBool ProcessCommandParametersL(TApaCommand aCommand, TFileName& aDocumentName, const TDesC8& aTail);
27da23d5 94 void HandleCommandL(TInt aCommand);
f26f4a2f 95#ifndef PerlMin
27da23d5 96 void OpenFileL(const TDesC& aFileName);
27da23d5 97 void InstallOrRunL(const TFileName& aFileName);
98 void SetFs(const RFs& aFs);
f26f4a2f 99#endif // #ifndef PerlMin
ed76c0e4 100 TBuf<KPerlAppOneLinerSize> iOneLiner; // Perl source code to evaluate.
27da23d5 101 CPerlAppView* iAppView;
ed76c0e4 102 private:
27da23d5 103 RFs* iFs;
27da23d5 104};
105
ed76c0e4 106class CPerlAppView : public CMyAppView
27da23d5 107{
108 public:
109 static CPerlAppView* NewL(const TRect& aRect);
110 static CPerlAppView* NewLC(const TRect& aRect);
ed76c0e4 111 ~CPerlAppView();
27da23d5 112 void Draw(const TRect& aRect) const;
ed76c0e4 113#ifdef __SERIES80__
114 void HandleCommandL(TInt aCommand);
115#endif /* #ifdef __SERIES80__ */
27da23d5 116 private:
117 void ConstructL(const TRect& aRect);
118};
119
120#endif // __PerlApp_h__