1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
23 // CTRuleBasedAppView |
23 // CTRuleBasedAppView |
24 // CTRuleBasedDocument |
24 // CTRuleBasedDocument |
25 // |
25 // |
26 // |
26 // |
27 |
27 |
28 |
|
29 |
|
30 |
|
31 /** |
28 /** |
32 @file |
29 @file |
33 @internalComponent - Internal Symbian test code |
30 @internalComponent - Internal Symbian test code |
34 */ |
31 */ |
35 |
32 |
36 #include <coeccntx.h> |
33 #include <coeccntx.h> |
37 #include <eikenv.h> |
34 #include <eikenv.h> |
38 #include <eikAppui.h> |
35 #include <eikappui.h> |
39 #include <eikApp.h> |
36 #include <eikapp.h> |
40 #include <eikdoc.h> |
37 #include <eikdoc.h> |
41 #include <eikmenup.h> |
38 #include <mw/eikmenup.h> |
42 #include <eikstart.h> |
39 #include <eikstart.h> |
43 |
40 |
44 #include <eikon.hrh> |
41 #include <mw/eikon.hrh> |
45 |
42 |
46 #include <tRuleBasedApp2.rsg> |
43 #include <trulebasedapp2.rsg> |
47 #include "tRuleBasedApp.hrh" |
44 #include "tRuleBasedApp.hrh" |
48 |
45 |
49 //const TInt KLeft = 0; // Display app window on the left |
46 //const TInt KLeft = 0; // Display app window on the left |
50 const TInt KCentre = 1; // Display app window in the centre |
47 const TInt KCentre = 1; // Display app window in the centre |
51 const TInt KRight = 2; // Display app window on the right |
48 const TInt KRight = 2; // Display app window on the right |
52 |
49 |
53 //////////////////////////////////////////////////////////////////////// |
50 // |
54 // |
51 // |
55 // CTRuleBasedApplication |
52 // CTRuleBasedApplication |
56 // |
53 // |
57 //////////////////////////////////////////////////////////////////////// |
54 // |
58 |
55 |
59 class CTRuleBasedApplication : public CEikApplication |
56 class CTRuleBasedApplication : public CEikApplication |
60 { |
57 { |
61 private: |
58 private: |
62 CApaDocument* CreateDocumentL(); |
59 CApaDocument* CreateDocumentL(); |
63 TUid AppDllUid() const; |
60 TUid AppDllUid() const; |
64 }; |
61 }; |
65 |
62 |
66 //////////////////////////////////////////////////////////////////////// |
63 // |
67 // |
64 // |
68 // CTRuleBasedAppView |
65 // CTRuleBasedAppView |
69 // |
66 // |
70 //////////////////////////////////////////////////////////////////////// |
67 // |
71 class CTRuleBasedAppView : public CCoeControl |
68 class CTRuleBasedAppView : public CCoeControl |
72 { |
69 { |
73 public: |
70 public: |
74 static CTRuleBasedAppView* NewL(const TRect& aRect); |
71 static CTRuleBasedAppView* NewL(const TRect& aRect); |
75 CTRuleBasedAppView(); |
72 CTRuleBasedAppView(); |
104 |
101 |
105 private: |
102 private: |
106 CTRuleBasedAppView* iAppView; |
103 CTRuleBasedAppView* iAppView; |
107 }; |
104 }; |
108 |
105 |
109 //////////////////////////////////////////////////////////////////////// |
106 // |
110 // |
107 // |
111 // CTRuleBasedDocument |
108 // CTRuleBasedDocument |
112 // |
109 // |
113 //////////////////////////////////////////////////////////////////////// |
110 // |
114 class CTRuleBasedDocument : public CEikDocument |
111 class CTRuleBasedDocument : public CEikDocument |
115 { |
112 { |
116 public: |
113 public: |
117 static CTRuleBasedDocument* NewL(CEikApplication& aApp); |
114 static CTRuleBasedDocument* NewL(CEikApplication& aApp); |
118 CTRuleBasedDocument(CEikApplication& aApp); |
115 CTRuleBasedDocument(CEikApplication& aApp); |
120 private: |
117 private: |
121 // Inherited from CEikDocument |
118 // Inherited from CEikDocument |
122 CEikAppUi* CreateAppUiL(); |
119 CEikAppUi* CreateAppUiL(); |
123 }; |
120 }; |
124 |
121 |
125 ////////////////////////////////////////////////////////////////////// |
122 // |
126 // |
123 // |
127 // Application Document class - CTRuleBasedAppDocument |
124 // Application Document class - CTRuleBasedAppDocument |
128 // |
125 // |
129 ////////////////////////////////////////////////////////////////////// |
126 // |
130 |
127 |
131 /** |
128 /** |
132 The constructor of the document class just passes the |
129 The constructor of the document class just passes the |
133 supplied reference to the constructor initialisation list. |
130 supplied reference to the constructor initialisation list. |
134 The document has no real work to do in this Application. |
131 The document has no real work to do in this Application. |
149 CEikAppUi* CTRuleBasedDocument::CreateAppUiL() |
146 CEikAppUi* CTRuleBasedDocument::CreateAppUiL() |
150 { |
147 { |
151 return new(ELeave) CTRuleBasedAppUi; |
148 return new(ELeave) CTRuleBasedAppUi; |
152 } |
149 } |
153 |
150 |
154 //////////////////////////////////////////////////////////////////////// |
151 // |
155 // |
152 // |
156 // Source for the implementation of the |
153 // Source for the implementation of the |
157 // Application view class - CTRuleBasedAppView |
154 // Application view class - CTRuleBasedAppView |
158 // |
155 // |
159 //////////////////////////////////////////////////////////////////////// |
156 // |
160 |
157 |
161 |
158 |
162 // Constructor for the view. |
159 // Constructor for the view. |
163 |
160 |
164 CTRuleBasedAppView::CTRuleBasedAppView():iAppType(KCentre) |
161 CTRuleBasedAppView::CTRuleBasedAppView():iAppType(KCentre) |
268 gc.DrawText(*iRuleBasedText,aRect,baselineOffset,CGraphicsContext::ECenter, 0); |
265 gc.DrawText(*iRuleBasedText,aRect,baselineOffset,CGraphicsContext::ECenter, 0); |
269 // Finished using the font |
266 // Finished using the font |
270 gc.DiscardFont(); |
267 gc.DiscardFont(); |
271 } |
268 } |
272 |
269 |
273 //////////////////////////////////////////////////////////////////////// |
270 // |
274 // |
271 // |
275 // Application UI class - CTRuleBasedAppUi |
272 // Application UI class - CTRuleBasedAppUi |
276 // |
273 // |
277 //////////////////////////////////////////////////////////////////////// |
274 // |
278 |
275 |
279 /** |
276 /** |
280 The second phase constructor of the Application UI class. |
277 The second phase constructor of the Application UI class. |
281 The Application UI creates and owns the one and only view. |
278 The Application UI creates and owns the one and only view. |
282 */ |
279 */ |
318 CTRuleBasedAppUi::~CTRuleBasedAppUi() |
315 CTRuleBasedAppUi::~CTRuleBasedAppUi() |
319 { |
316 { |
320 delete iAppView; |
317 delete iAppView; |
321 } |
318 } |
322 |
319 |
323 //////////////////////////////////////////////////////////////////////// |
320 // |
324 // |
321 // |
325 // Implementation of the |
322 // Implementation of the |
326 // Application class - CTRuleBasedApplication |
323 // Application class - CTRuleBasedApplication |
327 // |
324 // |
328 //////////////////////////////////////////////////////////////////////// |
325 // |
329 |
326 |
330 const TUid KUidRuleBasedApp = { 0X1020D6FD }; |
327 const TUid KUidRuleBasedApp = { 0X1020D6FD }; |
331 |
328 |
332 /** |
329 /** |
333 The function is called by the UI framework to ask for the |
330 The function is called by the UI framework to ask for the |