1 /* |
|
2 * Copyright (c) 2002-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: Landmarks info for landmarks list box model |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 // INCLUDE FILES |
|
24 #include "CLmkLandmarkUiItem.h" |
|
25 #include <EPos_CPosLandmark.h> |
|
26 #include "CLmkFields.h" |
|
27 #include <lmkerrors.h> |
|
28 |
|
29 #if defined(_DEBUG) |
|
30 // CONSTANTS |
|
31 /// Unnamed namespace for local definitions |
|
32 namespace { |
|
33 |
|
34 _LIT( KPanicMsg, "CLmkLandmarkUiItem" ); |
|
35 |
|
36 void Panic( TPanicCode aReason ) |
|
37 { |
|
38 User::Panic( KPanicMsg, aReason ); |
|
39 } |
|
40 } // namespace |
|
41 #endif |
|
42 // ============================ MEMBER FUNCTIONS =============================== |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CLmkLandmarkUiItem::CLmkLandmarkUiItem |
|
46 // C++ default constructor can NOT contain any code, that |
|
47 // might leave. |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 CLmkLandmarkUiItem::CLmkLandmarkUiItem( |
|
51 CPosLandmark* aLandmark, |
|
52 TInt aIconListIndex ) |
|
53 : iLandmark( aLandmark ), |
|
54 iIconListIndex( aIconListIndex ) |
|
55 { |
|
56 TPtrC name; |
|
57 iLandmark->GetLandmarkName( name ); |
|
58 TPtr des1 = CLmkFields::RemoveEnterCharacter( name ); |
|
59 iText.Set( des1 ); |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CLmkLandmarkUiItem::ConstructL |
|
64 // Symbian 2nd phase constructor can leave. |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 void CLmkLandmarkUiItem::ConstructL() |
|
68 { |
|
69 } |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // CLmkLandmarkUiItem::NewL |
|
73 // Two-phased constructor. |
|
74 // ----------------------------------------------------------------------------- |
|
75 // |
|
76 CLmkLandmarkUiItem* CLmkLandmarkUiItem::NewL( |
|
77 CPosLandmark* aLandmark, |
|
78 TInt aIconListIndex ) |
|
79 { |
|
80 __ASSERT_DEBUG( aLandmark, Panic( KLmkPanicNullMember ) ); |
|
81 CLmkLandmarkUiItem* self = |
|
82 new ( ELeave ) CLmkLandmarkUiItem( aLandmark, aIconListIndex ); |
|
83 |
|
84 CleanupStack::PushL( self ); |
|
85 self->ConstructL(); |
|
86 CleanupStack::Pop(); |
|
87 |
|
88 return self; |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CLmkLandmarkUiItem::~CLmkLandmarkUiItem |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 CLmkLandmarkUiItem::~CLmkLandmarkUiItem() |
|
96 { |
|
97 delete iLandmark; |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CLmkLandmarkUiItem::Type |
|
102 // ?implementation_description |
|
103 // (other items were commented in a header). |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 TLmkItemType CLmkLandmarkUiItem::Type() |
|
107 { |
|
108 return ELmkItemTypeLandmark; |
|
109 } |
|
110 |
|
111 // ----------------------------------------------------------------------------- |
|
112 // CLmkLandmarkUiItem::Text |
|
113 // ?implementation_description |
|
114 // (other items were commented in a header). |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 TPtrC CLmkLandmarkUiItem::Text() |
|
118 { |
|
119 return iText; |
|
120 } |
|
121 |
|
122 // ----------------------------------------------------------------------------- |
|
123 // CLmkLandmarkUiItem::GetIconId |
|
124 // ?implementation_description |
|
125 // (other items were commented in a header). |
|
126 // ----------------------------------------------------------------------------- |
|
127 // |
|
128 TInt CLmkLandmarkUiItem::GetIconId() |
|
129 { |
|
130 return iIconListIndex; |
|
131 } |
|
132 |
|
133 // End of File |
|