Commit | Line | Data |
d0d72822 |
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 | |
14 | #ifdef __SERIES80__ |
15 | # include <eikapp.h> |
16 | # include <eikappui.h> |
17 | # include <eikdoc.h> |
18 | # include <eikbctrl.h> |
19 | # include <eikgted.h> |
20 | # include <eikdialg.h> |
21 | #endif /* #ifdef __SERIES60__ */ |
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 | |
41 | #ifdef __SERIES80__ |
42 | # define CgPerlUiDocument CEikDocument |
43 | # define CgPerlUiApplication CEikApplication |
44 | # define CgPerlUiAppUi CEikAppUi |
45 | # define CgPerlUiNoteDialog CCknFlashingDialog |
46 | # define CgPerlUiAppView CEikBorderedControl |
47 | #endif /* #ifdef __SERIES60__ */ |
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; |
83 | #if defined(__SERIES80__) || defined(__UIQ__) |
84 | IMPORT_C void HandleCommandL(TInt aCommand, CPerlUiAppUi* aAppUi); |
85 | #endif /* #if defined(__SERIES80__) || defined(__UIQ__) */ |
86 | private: |
87 | void ConstructL(const TRect& aRect); |
88 | }; |
89 | |
90 | #if defined(__SERIES80__) || defined(__UIQ__) |
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 | |
107 | #endif /* #if defined(__SERIES80__) || defined(__UIQ__) */ |
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__ |