|
1 /* |
|
2 * Copyright (c) 2009 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: CAknConfAppUi implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <avkon.hrh> |
|
21 #include <aknmessagequerydialog.h> |
|
22 #include <aknnotewrappers.h> |
|
23 #include <aknnavide.h> |
|
24 #include <akntabgrp.h> |
|
25 #include <StringLoader.h> |
|
26 |
|
27 #include <aknconf.rsg> |
|
28 |
|
29 #include "aknconf.hrh" |
|
30 #include "aknconf.pan" |
|
31 #include "aknconfapplication.h" |
|
32 #include "aknconfappui.h" |
|
33 #include "aknconfview.h" |
|
34 |
|
35 const TInt KPhysicsTabIndex( 0 ); |
|
36 const TInt KGestureTabIndex( 1 ); |
|
37 |
|
38 // ============================ MEMBER FUNCTIONS =============================== |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // CAknConfAppUi::ConstructL() |
|
42 // Symbian 2nd phase constructor can leave. |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 void CAknConfAppUi::ConstructL() |
|
46 { |
|
47 // Initialise app UI with standard value. |
|
48 BaseConstructL( CAknAppUi::EAknEnableSkin ); |
|
49 |
|
50 CEikStatusPane* statusPane = StatusPane(); |
|
51 if ( statusPane ) |
|
52 { |
|
53 CAknNavigationControlContainer* naviPane = |
|
54 static_cast<CAknNavigationControlContainer*>( |
|
55 statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
56 if ( naviPane ) |
|
57 { |
|
58 iDecorator = naviPane->ResourceDecorator(); |
|
59 static_cast<CAknTabGroup*>( |
|
60 iDecorator->DecoratedControl() )->SetObserver( this ); |
|
61 } |
|
62 } |
|
63 |
|
64 CAknConfView* physicsView = |
|
65 new( ELeave ) CAknConfView( KPhysicsViewUid ); |
|
66 CleanupStack::PushL( physicsView ); |
|
67 physicsView->ConstructL( R_PHYSICS_VIEW ); |
|
68 CleanupStack::Pop( physicsView ); |
|
69 AddViewL( physicsView ); // transfer ownership to CAknViewAppUi |
|
70 |
|
71 CAknConfView* gestureView = |
|
72 new( ELeave ) CAknConfView( KGestureViewUid ); |
|
73 CleanupStack::PushL( gestureView ); |
|
74 gestureView->ConstructL( R_GESTURE_VIEW ); |
|
75 CleanupStack::Pop( gestureView ); |
|
76 AddViewL( gestureView ); // transfer ownership to CAknViewAppUi |
|
77 |
|
78 iCurrentViewId = physicsView->Id().iUid; |
|
79 |
|
80 } |
|
81 // ----------------------------------------------------------------------------- |
|
82 // CAknConfAppUi::CAknConfAppUi() |
|
83 // C++ default constructor can NOT contain any code, that might leave. |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 CAknConfAppUi::CAknConfAppUi() |
|
87 { |
|
88 // No implementation required |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CAknConfAppUi::~CAknConfAppUi() |
|
93 // Destructor. |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 CAknConfAppUi::~CAknConfAppUi() |
|
97 { |
|
98 delete iDecorator; |
|
99 } |
|
100 |
|
101 |
|
102 // ----------------------------------------------------------------------------- |
|
103 // CAknConfAppUi::SetTabIndex |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 void CAknConfAppUi::SetTabIndex( TInt aViewId ) |
|
107 { |
|
108 TInt tabIndex( 0 ); |
|
109 if ( aViewId == KPhysicsViewUid ) |
|
110 { |
|
111 tabIndex = KPhysicsTabIndex; |
|
112 } |
|
113 else |
|
114 { |
|
115 tabIndex = KGestureTabIndex; |
|
116 } |
|
117 static_cast<CAknTabGroup*>( |
|
118 iDecorator->DecoratedControl() )->SetActiveTabByIndex( |
|
119 tabIndex ); |
|
120 |
|
121 } |
|
122 |
|
123 |
|
124 // ----------------------------------------------------------------------------- |
|
125 // CAknConfAppUi::TabChangedL |
|
126 // ----------------------------------------------------------------------------- |
|
127 // |
|
128 void CAknConfAppUi::TabChangedL( TInt aIndex ) |
|
129 { |
|
130 if ( iCurrentViewId != KPhysicsViewUid && aIndex == KPhysicsTabIndex ) |
|
131 { |
|
132 ActivateLocalViewL( TUid::Uid( KPhysicsViewUid ) ); |
|
133 iCurrentViewId = KPhysicsViewUid; |
|
134 } |
|
135 else if ( iCurrentViewId != KGestureViewUid |
|
136 && aIndex == KGestureTabIndex ) |
|
137 { |
|
138 ActivateLocalViewL( TUid::Uid( KGestureViewUid ) ); |
|
139 iCurrentViewId = KGestureViewUid; |
|
140 } |
|
141 } |
|
142 |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // CAknConfAppUi::ActivateViewL |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 void CAknConfAppUi::ActivateViewL( TUid aViewId ) |
|
149 { |
|
150 CAknViewAppUi::ActivateLocalViewL( aViewId ); |
|
151 iCurrentViewId = aViewId.iUid; |
|
152 SetTabIndex( aViewId.iUid ); |
|
153 } |
|
154 |
|
155 |
|
156 // ----------------------------------------------------------------------------- |
|
157 // CAknConfAppUi::ActivateNextViewL |
|
158 // ----------------------------------------------------------------------------- |
|
159 // |
|
160 CAknConfView* CAknConfAppUi::CurrentView() |
|
161 { |
|
162 return static_cast<CAknConfView*>( |
|
163 View( TUid::Uid( iCurrentViewId ) ) ); |
|
164 } |
|
165 |
|
166 |
|
167 // ----------------------------------------------------------------------------- |
|
168 // CAknConfAppUi::HandleCommandL() |
|
169 // Takes care of command handling. |
|
170 // ----------------------------------------------------------------------------- |
|
171 // |
|
172 void CAknConfAppUi::HandleCommandL(TInt aCommand) |
|
173 { |
|
174 switch (aCommand) |
|
175 { |
|
176 case EEikCmdExit: |
|
177 case EAknSoftkeyExit: |
|
178 Exit(); |
|
179 break; |
|
180 case EAbout: |
|
181 { |
|
182 CAknMessageQueryDialog* dlg = new ( ELeave ) CAknMessageQueryDialog(); |
|
183 dlg->PrepareLC( R_ABOUT_QUERY_DIALOG ); |
|
184 HBufC* title = iEikonEnv->AllocReadResourceLC( R_ABOUT_DIALOG_TITLE ); |
|
185 dlg->QueryHeading()->SetTextL( *title ); |
|
186 CleanupStack::PopAndDestroy(); //title |
|
187 HBufC* msg = iEikonEnv->AllocReadResourceLC( R_ABOUT_DIALOG_TEXT ); |
|
188 dlg->SetMessageTextL( *msg ); |
|
189 CleanupStack::PopAndDestroy(); //msg |
|
190 dlg->RunLD(); |
|
191 } |
|
192 break; |
|
193 case EAknConfView: |
|
194 ActivateViewL( TUid::Uid( KPhysicsViewUid ) ); |
|
195 break; |
|
196 case EGestureConfView: |
|
197 ActivateViewL( TUid::Uid( KGestureViewUid ) ); |
|
198 break; |
|
199 default: |
|
200 Panic(EAknConfUi); |
|
201 break; |
|
202 } |
|
203 } |
|
204 |
|
205 |
|
206 // ----------------------------------------------------------------------------- |
|
207 // Called by the framework when the application status pane |
|
208 // size is changed. Passes the new client rectangle to the |
|
209 // AppView |
|
210 // ----------------------------------------------------------------------------- |
|
211 // |
|
212 void CAknConfAppUi::HandleStatusPaneSizeChange() |
|
213 { |
|
214 } |
|
215 |
|
216 // End of File |