|
1 /* |
|
2 * Copyright (c) 2006 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: CMnrpNaviView class implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <lbsposition.h> |
|
21 #include <EPos_CPosLandmark.h> |
|
22 |
|
23 #include <mnrefprovider.rsg> |
|
24 #include "mnrp.hrh" |
|
25 |
|
26 #include "debug.h" |
|
27 #include "mnrputils.h" |
|
28 #include "mnrpengine.h" |
|
29 |
|
30 #include "mnrpappui.h" |
|
31 #include "mnrpnavicontrol.h" |
|
32 |
|
33 #include "mnrpnaviview.h" |
|
34 |
|
35 // ============================ MEMBER FUNCTIONS =============================== |
|
36 |
|
37 // ----------------------------------------------------------------------------- |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 CMnrpNaviView::CMnrpNaviView( CMnrpEngine& aEngine ) |
|
41 : iEngine( aEngine ) |
|
42 { |
|
43 } |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 CMnrpNaviView::~CMnrpNaviView() |
|
49 { |
|
50 delete iDestination; |
|
51 delete iControl; |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 CMnrpNaviView* CMnrpNaviView::NewL( TBool aChained, CMnrpEngine& aEngine ) |
|
58 { |
|
59 CMnrpNaviView* self = new (ELeave) CMnrpNaviView( aEngine ); |
|
60 CleanupStack::PushL( self ); |
|
61 self->ConstructL( aChained ); |
|
62 CleanupStack::Pop( self ); |
|
63 return self; |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 void CMnrpNaviView::ConstructL( TBool aChained ) |
|
70 { |
|
71 if ( aChained ) |
|
72 { |
|
73 BaseConstructL( R_MNREFPROVIDER_NAVI_VIEW_CHAINED ); |
|
74 } |
|
75 else |
|
76 { |
|
77 BaseConstructL( R_MNREFPROVIDER_NAVI_VIEW ); |
|
78 } |
|
79 } |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 void CMnrpNaviView::SetDestinationL( const CPosLandmark& aNewDestination ) |
|
85 { |
|
86 delete iDestination; |
|
87 iDestination = NULL; |
|
88 iDestination = CPosLandmark::NewL( aNewDestination ); |
|
89 if ( iControl ) |
|
90 { |
|
91 iControl->UpdateModelL( *iDestination ); |
|
92 } |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 TUid CMnrpNaviView::Id() const |
|
99 { |
|
100 return TUid::Uid( EMnrpNavigationViewId ); |
|
101 } |
|
102 |
|
103 // ----------------------------------------------------------------------------- |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 void CMnrpNaviView::HandleCommandL( TInt aCommand ) |
|
107 { |
|
108 switch ( aCommand ) |
|
109 { |
|
110 default: |
|
111 AppUi()->HandleCommandL( aCommand ); |
|
112 break; |
|
113 } |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 void CMnrpNaviView::DoActivateL( |
|
120 const TVwsViewId& /*aPrevViewId*/, |
|
121 TUid /* aCustomMessageId */, |
|
122 const TDesC8& /* aCustomMessage */) |
|
123 { |
|
124 if ( !iControl ) |
|
125 { |
|
126 iControl = CMnrpNaviControl::NewL( *this, ClientRect(), iEngine ); |
|
127 iControl->SetMopParent( this ); |
|
128 } |
|
129 |
|
130 if ( iDestination ) |
|
131 { |
|
132 iControl->UpdateModelL( *iDestination ); |
|
133 } |
|
134 |
|
135 // Enable receiving of keyboard events. |
|
136 CMnrpAppUi* ui = ( CMnrpAppUi* ) AppUi(); |
|
137 ui->AddToStackL( *this, iControl ); |
|
138 |
|
139 _LIT( KNavigation, "Navigation" ); |
|
140 ui->SetNaviPaneTitleL( KNavigation ); |
|
141 |
|
142 // Make view visible. |
|
143 iControl->MakeVisible( ETrue ); |
|
144 } |
|
145 |
|
146 // ----------------------------------------------------------------------------- |
|
147 // ----------------------------------------------------------------------------- |
|
148 // |
|
149 void CMnrpNaviView::DoDeactivate() |
|
150 { |
|
151 if ( iControl ) |
|
152 { |
|
153 // Hide view. |
|
154 iControl->MakeVisible( EFalse ); |
|
155 |
|
156 // Disable receiving keyboard events. |
|
157 AppUi()->RemoveFromStack( iControl ); |
|
158 } |
|
159 } |
|
160 |