Avoid corruption when calling mg_get to retrieve the value
[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>
c7a4d1c0 20# include <eikdialg.h>
ed76c0e4 21#endif /* #ifdef __SERIES60__ */
22
27da23d5 23#include <coecntrl.h>
24#include <f32file.h>
25
f26f4a2f 26/* The source code can be compiled into "PerlApp" which is the simple
c7a4d1c0 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". */
32
33// #define CreatePerlAppMinimal
34
35#ifdef CreatePerlAppMinimal
36# define PerlAppMinimal
37# ifndef PerlAppMinimalUid // PerlApp is ...F6, PerlRecog is ...F7
38# define PerlAppMinimalUid 0x102015F8
39# endif
40# ifndef PerlAppMinimalName
41# define PerlAppMinimalName L"PerlAppMinimal"
42# endif
f26f4a2f 43#endif
44
c7a4d1c0 45#ifdef PerlAppMinimal
46# ifndef PerlAppMinimalUid
47# error PerlAppMinimal defined but PerlAppMinimalUid undefined
f26f4a2f 48# endif
c7a4d1c0 49# ifndef PerlAppMinimalName
50# error PerlAppMinimal defined but PerlAppMinimalName undefined
f26f4a2f 51# endif
52#endif
53
ed76c0e4 54#ifdef __SERIES60__
55# define CMyDocument CAknDocument
56# define CMyApplication CAknApplication
57# define CMyAppUi CAknAppUi
58# define CMyNoteDialog CAknNoteDialog
59# define CMyAppView CCoeControl
60#endif /* #ifdef __SERIES60__ */
61
62#ifdef __SERIES80__
63# define CMyDocument CEikDocument
64# define CMyApplication CEikApplication
65# define CMyAppUi CEikAppUi
66# define CMyNoteDialog CCknFlashingDialog
67# define CMyAppView CEikBorderedControl
68#endif /* #ifdef __SERIES60__ */
69
70class CPerlAppDocument : public CMyDocument
27da23d5 71{
72 public:
ed76c0e4 73 CPerlAppDocument(CEikApplication& aApp):CMyDocument(aApp) {;}
c7a4d1c0 74#ifndef PerlAppMinimal
27da23d5 75 CFileStore* OpenFileL(TBool aDoOpen, const TDesC& aFilename, RFs& aFs);
c7a4d1c0 76#endif // #ifndef PerlAppMinimal
27da23d5 77 private: // from CEikDocument
78 CEikAppUi* CreateAppUiL();
79};
80
ed76c0e4 81class CPerlAppApplication : public CMyApplication
27da23d5 82{
83 private:
84 CApaDocument* CreateDocumentL();
85 TUid AppDllUid() const;
86};
87
ed76c0e4 88const TUint KPerlAppPromptSize = 20;
89const TUint KPerlAppOneLinerSize = 128;
27da23d5 90
91class CPerlAppView;
92
ed76c0e4 93class CPerlAppUi : public CMyAppUi
27da23d5 94{
95 public:
96 void ConstructL();
97 ~CPerlAppUi();
f26f4a2f 98 TBool ProcessCommandParametersL(TApaCommand aCommand, TFileName& aDocumentName, const TDesC8& aTail);
27da23d5 99 void HandleCommandL(TInt aCommand);
c7a4d1c0 100#ifndef PerlAppMinimal
27da23d5 101 void OpenFileL(const TDesC& aFileName);
27da23d5 102 void InstallOrRunL(const TFileName& aFileName);
103 void SetFs(const RFs& aFs);
c7a4d1c0 104#endif // #ifndef PerlAppMinimal
ed76c0e4 105 TBuf<KPerlAppOneLinerSize> iOneLiner; // Perl source code to evaluate.
27da23d5 106 CPerlAppView* iAppView;
ed76c0e4 107 private:
27da23d5 108 RFs* iFs;
27da23d5 109};
110
ed76c0e4 111class CPerlAppView : public CMyAppView
27da23d5 112{
113 public:
114 static CPerlAppView* NewL(const TRect& aRect);
115 static CPerlAppView* NewLC(const TRect& aRect);
ed76c0e4 116 ~CPerlAppView();
27da23d5 117 void Draw(const TRect& aRect) const;
ed76c0e4 118#ifdef __SERIES80__
119 void HandleCommandL(TInt aCommand);
120#endif /* #ifdef __SERIES80__ */
27da23d5 121 private:
122 void ConstructL(const TRect& aRect);
123};
124
c7a4d1c0 125#ifdef __SERIES80__
126
127class CPerlAppTextQueryDialog : public CEikDialog
128{
129 public:
130 CPerlAppTextQueryDialog(HBufC*& aBuffer);
131 /* TODO: OfferKeyEventL() so that newline can be seen as 'OK'. */
132 HBufC*& iData;
133 TPtrC iTitle; // used in S80 but not in S60
134 TPtrC iPrompt; // used in S60 and S80
135 TInt iMaxLength;
136 protected:
137 void PreLayoutDynInitL();
138 private:
139 TBool OkToExitL(TInt aKeycode);
140};
141
142#endif /* #ifdef __SERIES80__ */
143
27da23d5 144#endif // __PerlApp_h__