Commit | Line | Data |
---|---|---|
d0d72822 JH |
1 | /* Copyright (c) 2005 Nokia. All rights reserved. */ |
2 | ||
3 | /* The PerlUi class is licensed under the same terms as Perl itself. */ | |
4 | ||
5 | #ifndef __PerlUi_h__ | |
6 | #define __PerlUi_h__ | |
7 | ||
8 | #ifdef __SERIES60__ | |
9 | # include <aknapp.h> | |
10 | # include <aknappui.h> | |
11 | # include <akndoc.h> | |
12 | #endif /* #ifdef __SERIES60__ */ | |
13 | ||
53d44271 | 14 | #if defined(__SERIES80__) || defined(__SERIES90__) |
d0d72822 JH |
15 | # include <eikapp.h> |
16 | # include <eikappui.h> | |
17 | # include <eikdoc.h> | |
18 | # include <eikbctrl.h> | |
19 | # include <eikgted.h> | |
20 | # include <eikdialg.h> | |
53d44271 | 21 | #endif /* #if defined(__SERIES80__) || defined(__SERIES90__) */ |
d0d72822 JH |
22 | |
23 | #ifdef __UIQ__ | |
24 | # include <qikapplication.h> | |
25 | # include <qikappui.h> | |
26 | # include <qikdocument.h> | |
27 | # include <eikdialg.h> | |
28 | #endif /* #ifdef __UIQ____ */ | |
29 | ||
30 | #include <coecntrl.h> | |
31 | #include <f32file.h> | |
32 | ||
33 | #ifdef __SERIES60__ | |
34 | # define CgPerlUiDocument CAknDocument | |
35 | # define CgPerlUiApplication CAknApplication | |
36 | # define CgPerlUiAppUi CAknAppUi | |
37 | # define CgPerlUiNoteDialog CAknNoteDialog | |
38 | # define CgPerlUiAppView CCoeControl | |
39 | #endif /* #ifdef __SERIES60__ */ | |
40 | ||
53d44271 | 41 | #if defined(__SERIES80__) || defined(__SERIES90__) |
d0d72822 JH |
42 | # define CgPerlUiDocument CEikDocument |
43 | # define CgPerlUiApplication CEikApplication | |
44 | # define CgPerlUiAppUi CEikAppUi | |
45 | # define CgPerlUiNoteDialog CCknFlashingDialog | |
46 | # define CgPerlUiAppView CEikBorderedControl | |
53d44271 | 47 | #endif /* #if defined(__SERIES80__) || defined(__SERIES90__) */ |
d0d72822 JH |
48 | |
49 | #ifdef __UIQ__ | |
50 | # define CgPerlUiDocument CEikDocument | |
51 | # define CgPerlUiApplication CQikApplication | |
52 | # define CgPerlUiAppUi CQikAppUi | |
53 | # define CgPerlUiNoteDialog CCknFlashingDialog | |
54 | # define CgPerlUiAppView CCoeControl | |
55 | #endif /* #ifdef __UIQ__ */ | |
56 | ||
57 | class CPerlUiApplication : public CgPerlUiApplication | |
58 | { | |
59 | }; | |
60 | ||
61 | const TUint KPerlUiPromptSize = 20; | |
62 | const TUint KPerlUiOneLinerSize = 128; | |
63 | ||
64 | class CPerlUiAppView; | |
65 | ||
66 | class CPerlUiAppUi : public CgPerlUiAppUi | |
67 | { | |
68 | public: | |
69 | IMPORT_C void ConstructL(); | |
70 | void virtual DoHandleCommandL(TInt aCommand) = 0; | |
71 | IMPORT_C void HandleCommandL(TInt aCommand); | |
72 | TBuf<KPerlUiOneLinerSize> iOneLiner; // Perl code to evaluate. | |
73 | CPerlUiAppView* iAppView; | |
74 | }; | |
75 | ||
76 | class CPerlUiAppView : public CgPerlUiAppView | |
77 | { | |
78 | public: | |
79 | static CPerlUiAppView* NewL(const TRect& aRect); | |
80 | static CPerlUiAppView* NewLC(const TRect& aRect); | |
81 | ~CPerlUiAppView(); | |
82 | void Draw(const TRect& aRect) const; | |
53d44271 | 83 | #if defined(__SERIES80__) || defined(__SERIES90__) || defined(__UIQ__) |
d0d72822 | 84 | IMPORT_C void HandleCommandL(TInt aCommand, CPerlUiAppUi* aAppUi); |
53d44271 | 85 | #endif /* #if defined(__SERIES80__) || defined(__SERIES90__) || defined(__UIQ__) */ |
d0d72822 JH |
86 | private: |
87 | void ConstructL(const TRect& aRect); | |
88 | }; | |
89 | ||
53d44271 | 90 | #if defined(__SERIES80__) || defined(__SERIES90__) || defined(__UIQ__) |
d0d72822 JH |
91 | |
92 | class CPerlUiTextQueryDialog : public CEikDialog | |
93 | { | |
94 | public: | |
95 | CPerlUiTextQueryDialog(HBufC*& aBuffer); | |
96 | /* TODO: OfferKeyEventL() so that newline can be seen as 'OK'. */ | |
97 | HBufC*& iData; | |
98 | TPtrC iTitle; // used in S80 but not in S60 | |
99 | TPtrC iPrompt; // used in S60 and S80 | |
100 | TInt iMaxLength; | |
101 | protected: | |
102 | void PreLayoutDynInitL(); | |
103 | private: | |
104 | TBool OkToExitL(TInt aKeycode); | |
105 | }; | |
106 | ||
53d44271 | 107 | #endif /* #if defined(__SERIES80__) || defined(__SERIES90__) || defined(__UIQ__) */ |
d0d72822 JH |
108 | |
109 | class CPerlUi : public CgPerlUiAppUi | |
110 | { | |
111 | public: | |
112 | IMPORT_C static TBool OkCancelDialogL(TDesC& aMessage); | |
113 | IMPORT_C static TBool YesNoDialogL(TDesC& aMessage); | |
114 | IMPORT_C static void InformationNoteL(TDesC& aMessage); | |
115 | IMPORT_C static TInt WarningNoteL(TDesC& aMessage); | |
116 | IMPORT_C static TBool TextQueryDialogL(const TDesC& aTitle, const TDesC& aPrompt, TDes& aData, const TInt aMaxLength); | |
117 | IMPORT_C static TBool FileQueryDialogL(TDes& aFilename); | |
118 | }; | |
119 | ||
120 | #endif // __PerlUi_h__ |