This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Symbian port 0.3.0 as of blead@25911
[perl5.git] / symbian / PerlApp.h
CommitLineData
27da23d5
JH
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
JH
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>
c7a4d1c0 20# include <eikdialg.h>
ed76c0e4
JH
21#endif /* #ifdef __SERIES60__ */
22
25ca88e0
JH
23#ifdef __UIQ__
24# include <qikapplication.h>
25# include <qikappui.h>
26# include <qikdocument.h>
27# include <eikdialg.h>
28#endif /* #ifdef __UIQ____ */
29
27da23d5
JH
30#include <coecntrl.h>
31#include <f32file.h>
32
f26f4a2f 33/* The source code can be compiled into "PerlApp" which is the simple
c7a4d1c0
JH
34 * launchpad application/demonstrator, or into "PerlAppMinimal", which
35 * is the minimal Perl launchpad application. Define the cpp symbols
36 * CreatePerlAppMinimal (a boolean), PerlAppMinimalUid (the Symbian
37 * application uid in the 0x... format), and PerlAppMinimalName (a C
38 * wide string, with the L prefix) to compile as "PerlAppMinimal". */
39
40// #define CreatePerlAppMinimal
41
42#ifdef CreatePerlAppMinimal
43# define PerlAppMinimal
44# ifndef PerlAppMinimalUid // PerlApp is ...F6, PerlRecog is ...F7
45# define PerlAppMinimalUid 0x102015F8
46# endif
47# ifndef PerlAppMinimalName
48# define PerlAppMinimalName L"PerlAppMinimal"
49# endif
f26f4a2f
JH
50#endif
51
c7a4d1c0
JH
52#ifdef PerlAppMinimal
53# ifndef PerlAppMinimalUid
54# error PerlAppMinimal defined but PerlAppMinimalUid undefined
f26f4a2f 55# endif
c7a4d1c0
JH
56# ifndef PerlAppMinimalName
57# error PerlAppMinimal defined but PerlAppMinimalName undefined
f26f4a2f
JH
58# endif
59#endif
60
ed76c0e4
JH
61#ifdef __SERIES60__
62# define CMyDocument CAknDocument
63# define CMyApplication CAknApplication
64# define CMyAppUi CAknAppUi
65# define CMyNoteDialog CAknNoteDialog
66# define CMyAppView CCoeControl
67#endif /* #ifdef __SERIES60__ */
68
69#ifdef __SERIES80__
70# define CMyDocument CEikDocument
71# define CMyApplication CEikApplication
72# define CMyAppUi CEikAppUi
73# define CMyNoteDialog CCknFlashingDialog
74# define CMyAppView CEikBorderedControl
75#endif /* #ifdef __SERIES60__ */
76
25ca88e0
JH
77#ifdef __UIQ__
78# define CMyDocument CEikDocument
79# define CMyApplication CQikApplication
80# define CMyAppUi CQikAppUi
81# define CMyNoteDialog CCknFlashingDialog
82# define CMyAppView CCoeControl
83#endif /* #ifdef __UIQ__ */
84
ed76c0e4 85class CPerlAppDocument : public CMyDocument
27da23d5
JH
86{
87 public:
ed76c0e4 88 CPerlAppDocument(CEikApplication& aApp):CMyDocument(aApp) {;}
c7a4d1c0 89#ifndef PerlAppMinimal
27da23d5 90 CFileStore* OpenFileL(TBool aDoOpen, const TDesC& aFilename, RFs& aFs);
c7a4d1c0 91#endif // #ifndef PerlAppMinimal
27da23d5
JH
92 private: // from CEikDocument
93 CEikAppUi* CreateAppUiL();
94};
95
ed76c0e4 96class CPerlAppApplication : public CMyApplication
27da23d5
JH
97{
98 private:
99 CApaDocument* CreateDocumentL();
100 TUid AppDllUid() const;
101};
102
ed76c0e4
JH
103const TUint KPerlAppPromptSize = 20;
104const TUint KPerlAppOneLinerSize = 128;
27da23d5
JH
105
106class CPerlAppView;
107
ed76c0e4 108class CPerlAppUi : public CMyAppUi
27da23d5
JH
109{
110 public:
111 void ConstructL();
112 ~CPerlAppUi();
f26f4a2f 113 TBool ProcessCommandParametersL(TApaCommand aCommand, TFileName& aDocumentName, const TDesC8& aTail);
27da23d5 114 void HandleCommandL(TInt aCommand);
c7a4d1c0 115#ifndef PerlAppMinimal
27da23d5 116 void OpenFileL(const TDesC& aFileName);
27da23d5
JH
117 void InstallOrRunL(const TFileName& aFileName);
118 void SetFs(const RFs& aFs);
c7a4d1c0 119#endif // #ifndef PerlAppMinimal
ed76c0e4 120 TBuf<KPerlAppOneLinerSize> iOneLiner; // Perl source code to evaluate.
27da23d5 121 CPerlAppView* iAppView;
ed76c0e4 122 private:
27da23d5 123 RFs* iFs;
27da23d5
JH
124};
125
ed76c0e4 126class CPerlAppView : public CMyAppView
27da23d5
JH
127{
128 public:
129 static CPerlAppView* NewL(const TRect& aRect);
130 static CPerlAppView* NewLC(const TRect& aRect);
ed76c0e4 131 ~CPerlAppView();
27da23d5 132 void Draw(const TRect& aRect) const;
25ca88e0 133#if defined(__SERIES80__) || defined(__UIQ__)
ed76c0e4 134 void HandleCommandL(TInt aCommand);
25ca88e0 135#endif /* #if defined(__SERIES80__) || defined(__UIQ__) */
27da23d5
JH
136 private:
137 void ConstructL(const TRect& aRect);
138};
139
25ca88e0 140#if defined(__SERIES80__) || defined(__UIQ__)
c7a4d1c0
JH
141
142class CPerlAppTextQueryDialog : public CEikDialog
143{
144 public:
145 CPerlAppTextQueryDialog(HBufC*& aBuffer);
146 /* TODO: OfferKeyEventL() so that newline can be seen as 'OK'. */
147 HBufC*& iData;
148 TPtrC iTitle; // used in S80 but not in S60
149 TPtrC iPrompt; // used in S60 and S80
150 TInt iMaxLength;
151 protected:
152 void PreLayoutDynInitL();
153 private:
154 TBool OkToExitL(TInt aKeycode);
155};
156
25ca88e0 157#endif /* #if defined(__SERIES80__) || defined(__UIQ__) */
c7a4d1c0 158
27da23d5 159#endif // __PerlApp_h__