|
1 /* |
|
2 * Copyright (c) 2005-2008 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: Provides blid main view class methods. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // SYSTEM INCLUDE FILES |
|
20 #include <aknViewAppUi.h> |
|
21 #include <Blid.rsg> |
|
22 #include <alf/alfenv.h> |
|
23 #include <alf/alfcontrolgroup.h> |
|
24 #include <alf/alfdisplay.h> |
|
25 #include <alf/alftransformation.h> |
|
26 #include <alf/alfroster.h> |
|
27 // USER INCLUDE FILES |
|
28 #include "CBlidMainView.h" |
|
29 #include "Blid.hrh" |
|
30 #include "CBlidMainControl.h" |
|
31 #include "MBlidLocation.h" |
|
32 #include "CBlidAppUi.h" |
|
33 #include "bliduiconsts.h" |
|
34 #include "Debug.h" |
|
35 |
|
36 //CONSTANTS |
|
37 enum TPanicCode |
|
38 { |
|
39 KBlidNullPointer = 1 |
|
40 }; |
|
41 |
|
42 // ================= MEMBER FUNCTIONS ======================= |
|
43 // ---------------------------------------------------------------------------- |
|
44 // CBlidMainView::NewLC( MKeyProcessor& aKeyProcessor ) |
|
45 // Two-phased constructor. |
|
46 // ---------------------------------------------------------------------------- |
|
47 // |
|
48 CBlidMainView* CBlidMainView::NewLC( MKeyProcessor& aKeyProcessor, |
|
49 CAlfEnv& aEnv ) |
|
50 { |
|
51 CBlidMainView* self = new (ELeave) CBlidMainView( aKeyProcessor,aEnv ); |
|
52 CleanupStack::PushL( self ); |
|
53 self->ConstructL(); |
|
54 return self; |
|
55 } |
|
56 // ---------------------------------------------------------------------------- |
|
57 // CBlidMainView::CBlidMainView |
|
58 // C++ default constructor can NOT contain any code, that |
|
59 // might leave. |
|
60 // ---------------------------------------------------------------------------- |
|
61 // |
|
62 CBlidMainView::CBlidMainView( MKeyProcessor& aKeyProcessor , |
|
63 CAlfEnv& aEnv ): |
|
64 CBlidBaseView( aKeyProcessor ), |
|
65 iEnv(aEnv) |
|
66 { |
|
67 } |
|
68 |
|
69 // ---------------------------------------------------------------------------- |
|
70 // CBlidMainView::ConstructL |
|
71 // Symbian 2nd phase constructor can leave. |
|
72 // ---------------------------------------------------------------------------- |
|
73 // |
|
74 void CBlidMainView::ConstructL() |
|
75 { |
|
76 // Modify the Main view option key |
|
77 BaseConstructL( R_BLID_MAIN_VIEW ); |
|
78 |
|
79 // Create an instance of our list control. |
|
80 iMainCtrl = CBlidMainControl::NewL(iEnv, ClientRect(), *this ); |
|
81 iMainCtrl->CreateNaviPaneL(); |
|
82 |
|
83 // Create a control group. |
|
84 iMainCtrlGroup = &( iEnv.NewControlGroupL( KBlidMainGroup ) ); |
|
85 |
|
86 // pass ownership of the list control to the control group |
|
87 iMainCtrlGroup->AppendL(iMainCtrl); |
|
88 |
|
89 iCtrlDisplay = &( iEnv.NewDisplayL( ClientRect(), CAlfEnv::ENewDisplayAsCoeControl ) ); |
|
90 // Use the Avkon skin background as the display background. |
|
91 iCtrlDisplay->SetClearBackgroundL(CAlfDisplay::EClearWithSkinBackground); |
|
92 } |
|
93 |
|
94 // ---------------------------------------------------------------------------- |
|
95 // CBlidMainView::~CBlidMainView |
|
96 // ---------------------------------------------------------------------------- |
|
97 // |
|
98 CBlidMainView::~CBlidMainView() |
|
99 { |
|
100 } |
|
101 |
|
102 // ---------------------------------------------------------------------------- |
|
103 // CBlidMainView::ProcessKeyEventL |
|
104 // ---------------------------------------------------------------------------- |
|
105 // |
|
106 TBool CBlidMainView::ProcessKeyEventL( const TKeyEvent& aKeyEvent, |
|
107 TEventCode aType ) |
|
108 { |
|
109 return CBlidBaseView::ProcessKeyEventL( aKeyEvent,aType ); |
|
110 } |
|
111 |
|
112 // ---------------------------------------------------------------------------- |
|
113 // TUid CBlidMainView::Id |
|
114 // ---------------------------------------------------------------------------- |
|
115 // |
|
116 TUid CBlidMainView::Id() const |
|
117 { |
|
118 return TUid::Uid(EBlidMainView); |
|
119 } |
|
120 |
|
121 // ---------------------------------------------------------------------------- |
|
122 // CBlidMainView::HandleCommandL |
|
123 // ---------------------------------------------------------------------------- |
|
124 // |
|
125 void CBlidMainView::HandleCommandL(TInt aCommand) |
|
126 { |
|
127 (static_cast<CBlidAppUi*>(AppUi()))->HandleCommandL( aCommand ); |
|
128 } |
|
129 |
|
130 // ---------------------------------------------------------------------------- |
|
131 // CBlidMainView::DoActivateL |
|
132 // ---------------------------------------------------------------------------- |
|
133 // |
|
134 void CBlidMainView::DoActivateL( |
|
135 const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, |
|
136 const TDesC8& /*aCustomMessage*/) |
|
137 { |
|
138 #ifdef _DEBUG |
|
139 RDebug::Print(_L("CBlidMainView::DoActivateL() called")); |
|
140 #endif |
|
141 |
|
142 iLocation->SetObserver(*this, EBlidMainView); |
|
143 iMainCtrl->MakeTitleL( R_BLID_TITLE_MAIN ); |
|
144 |
|
145 // Show the control group on the display. |
|
146 iCtrlDisplay->Roster().ShowL( *iMainCtrlGroup ); |
|
147 } |
|
148 |
|
149 // ---------------------------------------------------------------------------- |
|
150 // CBlidMainView::DoDeactivate |
|
151 // ---------------------------------------------------------------------------- |
|
152 // |
|
153 void CBlidMainView::DoDeactivate() |
|
154 { |
|
155 // Nothing to do. |
|
156 } |
|
157 |
|
158 // ---------------------------------------------------------------------------- |
|
159 // CBlidMainView::NotifyL |
|
160 // ---------------------------------------------------------------------------- |
|
161 // |
|
162 void CBlidMainView::NotifyL( const TBool aOnlineMode ) |
|
163 { |
|
164 if( iMainCtrl && aOnlineMode ) |
|
165 { |
|
166 iMainCtrl->UpdateL(); |
|
167 iMainCtrl->SetOnlineMode( aOnlineMode ); |
|
168 } |
|
169 DEBUG1(" CBlidMainView::NotifyL called ::%d", aOnlineMode ); |
|
170 CBlidBaseView::NotifyL( aOnlineMode ); |
|
171 } |
|
172 |
|
173 // ---------------------------------------------------------------------------- |
|
174 // CBlidMainView::NotifyError |
|
175 // ---------------------------------------------------------------------------- |
|
176 // |
|
177 void CBlidMainView::NotifyErrorL( TInt aErrorCode ) |
|
178 { |
|
179 CBlidBaseView::NotifyErrorL( aErrorCode ); |
|
180 DEBUG1(" CBlidMainView::NotifyErrorL errorcode ::%d", aErrorCode ); |
|
181 if( iMainCtrl ) |
|
182 { |
|
183 iMainCtrl->UpdateL(); |
|
184 iMainCtrl->SetErrorCode( aErrorCode ); |
|
185 } |
|
186 } |
|
187 |
|
188 // ---------------------------------------------------------- |
|
189 // Handle Resource Change Events: Display orientation switch |
|
190 // ---------------------------------------------------------- |
|
191 // |
|
192 void CBlidMainView::HandleResourceChangeL( TInt aType ) |
|
193 { |
|
194 if(aType == KEikDynamicLayoutVariantSwitch) |
|
195 { |
|
196 TRect rect; |
|
197 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect); |
|
198 |
|
199 // Notify skin of changed display size. |
|
200 iEnv.PrimaryDisplay().SetVisibleArea(rect); |
|
201 iMainCtrl->UpdateDisplayLayoutL(); |
|
202 } |
|
203 } |
|
204 |
|
205 |
|
206 #ifdef RD_SCALABLE_UI_V2 |
|
207 // --------------------------------------------------------------------------- |
|
208 // CBlidNavigationView::HandleListBoxSelectionL |
|
209 // --------------------------------------------------------------------------- |
|
210 // |
|
211 void CBlidMainView::HandleListBoxSelectionL() |
|
212 { |
|
213 //Do something if needed |
|
214 } |
|
215 #endif //RD_SCALABLE_UI_V2 |
|
216 // End of File |
|
217 |
|
218 |