|
1 /* |
|
2 * Copyright (c) Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <avkon.hrh> |
|
21 #include <aknnotewrappers.h> |
|
22 #include <aknutils.h> |
|
23 #include <eikmenup.h> |
|
24 |
|
25 #include <alf/alfenv.h> |
|
26 #include <alf/alfdisplay.h> |
|
27 #include <alf/alfcontrolgroup.h> |
|
28 #include <alf/alfroster.h> |
|
29 #include <alf/alftransformation.h> |
|
30 |
|
31 #include "alfexcalendar.pan" |
|
32 #include "alfexcalendarappui.h" |
|
33 #include "alfexcalendar.hrh" |
|
34 #include "alfexcalendardeckcontrol.h" |
|
35 #include "alfexcalendarengine.h" |
|
36 #include "alfexcalendar.rsg" |
|
37 |
|
38 // Control group ID |
|
39 const TInt KAlfExCalendarControlGroupDeckId = 1; |
|
40 |
|
41 // -------------------------------------------------------------------------- |
|
42 // CAlfExCalendarAppUi::ConstructL |
|
43 // -------------------------------------------------------------------------- |
|
44 // |
|
45 void CAlfExCalendarAppUi::ConstructL() |
|
46 { |
|
47 BaseConstructL( EAknEnableSkin ); |
|
48 |
|
49 // Create Toolkit Environment |
|
50 iEnv = CAlfEnv::NewL(); |
|
51 |
|
52 TRect rect; |
|
53 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect ); |
|
54 |
|
55 // Create Display |
|
56 CAlfDisplay& display = |
|
57 iEnv->NewDisplayL( rect, CAlfEnv::ENewDisplayAsCoeControl ); |
|
58 display.SetClearBackgroundL( CAlfDisplay::EClearWithSkinBackground ); |
|
59 |
|
60 // instantiate CalendarEngine |
|
61 // This is dummy engine which generates and give hardcoded calendar events |
|
62 iCalendarEngine = CAlfExCalendarEngine::NewL(); |
|
63 |
|
64 // Create Control Group for Deck Layout |
|
65 CAlfControlGroup& deckGroup = |
|
66 iEnv->NewControlGroupL( KAlfExCalendarControlGroupDeckId ); |
|
67 |
|
68 // Create Control and Append to Control Group2 |
|
69 CAlfExCalendarDeckControl* deckControl = |
|
70 CAlfExCalendarDeckControl::NewLC( *iEnv, *iCalendarEngine ); |
|
71 deckGroup.AppendL( deckControl ); |
|
72 CleanupStack::Pop( deckControl ); |
|
73 |
|
74 // Activate/Show the Control group on the Display |
|
75 display.Roster().ShowL( deckGroup ); |
|
76 |
|
77 } |
|
78 |
|
79 // -------------------------------------------------------------------------- |
|
80 // CAlfExCalendarAppUi::CAlfExCalendarAppUi |
|
81 // -------------------------------------------------------------------------- |
|
82 // |
|
83 CAlfExCalendarAppUi::CAlfExCalendarAppUi() |
|
84 { |
|
85 // no implementation required |
|
86 } |
|
87 |
|
88 // -------------------------------------------------------------------------- |
|
89 // CAlfExCalendarAppUi::~CAlfExCalendarAppUi |
|
90 // -------------------------------------------------------------------------- |
|
91 // |
|
92 CAlfExCalendarAppUi::~CAlfExCalendarAppUi() |
|
93 { |
|
94 // delete Toolkit Environment |
|
95 delete iEnv; |
|
96 |
|
97 delete iCalendarEngine; |
|
98 } |
|
99 |
|
100 // -------------------------------------------------------------------------- |
|
101 // CAlfExCalendarAppUi::DynInitMenuPaneL |
|
102 // -------------------------------------------------------------------------- |
|
103 // |
|
104 void CAlfExCalendarAppUi::DynInitMenuPaneL( |
|
105 TInt aResourceId, |
|
106 CEikMenuPane* aMenuPane ) |
|
107 { |
|
108 // Not used currently. May be used if necessary in future |
|
109 switch ( aResourceId ) |
|
110 { |
|
111 case R_ALFEXCALENDAR_MENU: |
|
112 { |
|
113 |
|
114 } |
|
115 break; |
|
116 } |
|
117 |
|
118 CAknAppUi::DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
119 } |
|
120 |
|
121 // -------------------------------------------------------------------------- |
|
122 // CAlfExCalendarAppUi::HandleCommandL |
|
123 // -------------------------------------------------------------------------- |
|
124 // |
|
125 void CAlfExCalendarAppUi::HandleCommandL( TInt aCommand ) |
|
126 { |
|
127 switch( aCommand ) |
|
128 { |
|
129 case EEikCmdExit: |
|
130 case EAknSoftkeyExit: |
|
131 Exit(); |
|
132 break; |
|
133 |
|
134 case EAlfExCalendarCmdHelp: |
|
135 { |
|
136 _LIT(message,"Alf Calendar"); |
|
137 CAknInformationNote* informationNote = |
|
138 new (ELeave) CAknInformationNote; |
|
139 informationNote->ExecuteLD(message); |
|
140 } |
|
141 break; |
|
142 |
|
143 default: |
|
144 Panic( EAlfExCalendarBasicUi ); |
|
145 break; |
|
146 } |
|
147 } |
|
148 |
|
149 // -------------------------------------------------------------------------- |
|
150 // CAlfExCalendarAppUi::HandleResourceChangeL |
|
151 // -------------------------------------------------------------------------- |
|
152 // |
|
153 void CAlfExCalendarAppUi::HandleResourceChangeL( TInt aType ) |
|
154 { |
|
155 // In order to handle resolution and orientation changes properly, |
|
156 // the HandleResourceChangeL method needs to be implemented |
|
157 |
|
158 CAknAppUi::HandleResourceChangeL( aType ); |
|
159 |
|
160 if ( iEnv && aType == KEikDynamicLayoutVariantSwitch ) |
|
161 { |
|
162 iEnv->NotifyLayoutChangedL(); |
|
163 } |
|
164 } |
|
165 |
|
166 // -------------------------------------------------------------------------- |
|
167 // CAlfExCalendarAppUi::HandleWsEventL |
|
168 // Calls HUI environment to release the resources when KAknFullOrPartialForegroundLost |
|
169 // is received and to restore the resources when KAknFullOrPartialForegroundGained. |
|
170 // Resources that are released/restored are memory loaded bitmaps. |
|
171 // -------------------------------------------------------------------------- |
|
172 // |
|
173 void CAlfExCalendarAppUi::HandleWsEventL( |
|
174 const TWsEvent& aEvent, |
|
175 CCoeControl* aDestination ) |
|
176 { |
|
177 switch( aEvent.Type() ) |
|
178 { |
|
179 // When the application is moved out of the foreground, |
|
180 // release all resources in the environment with CAlfEnv::Release() |
|
181 case KAknFullOrPartialForegroundLost: |
|
182 { |
|
183 iEnv->Release(); |
|
184 break; |
|
185 } |
|
186 |
|
187 // When the application is brought to foreground, |
|
188 // restore all resources in the environment with CAlfEnv::RestoreL() |
|
189 case KAknFullOrPartialForegroundGained: |
|
190 { |
|
191 iEnv->RestoreL(); |
|
192 break; |
|
193 } |
|
194 default: |
|
195 { |
|
196 break; |
|
197 } |
|
198 } |
|
199 |
|
200 CAknAppUi::HandleWsEventL( aEvent, aDestination ); |
|
201 } |
|
202 |
|
203 // END OF FILE |
|
204 |