|
1 /* |
|
2 * Copyright (c) 2007 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: A list box item with text and a bitmap |
|
15 * |
|
16 * Copyright © 2007 Nokia. All rights reserved. |
|
17 * This material, including documentation and any related computer |
|
18 * programs, is protected by copyright controlled by Nokia. All |
|
19 * rights are reserved. Copying, including reproducing, storing, |
|
20 * adapting or translating, any or all of this material requires the |
|
21 * prior written consent of Nokia. This material also contains |
|
22 * confidential information which may not be disclosed to others |
|
23 * without the prior written consent of Nokia. |
|
24 * |
|
25 * |
|
26 */ |
|
27 |
|
28 |
|
29 // INCLUDE FILES |
|
30 #include "CamCaptureSetupListItem.h" |
|
31 #include "CamUtility.h" |
|
32 #include "camlogging.h" |
|
33 #include <eikappui.h> // For CCoeAppUiBase |
|
34 #include <eikapp.h> // For CEikApplication |
|
35 #include <eikenv.h> |
|
36 #include <barsread.h> |
|
37 #include <cameraapp.mbg> |
|
38 #include <AknIconUtils.h> |
|
39 // CONSTANTS |
|
40 |
|
41 // ================= MEMBER FUNCTIONS ======================= |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CCamCaptureSetupListItem::NewLC |
|
45 // Two-phased constructor. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 CCamCaptureSetupListItem* |
|
49 CCamCaptureSetupListItem::NewLC( TResourceReader& aReader, |
|
50 TAknLayoutRect& aIconLayout ) |
|
51 { |
|
52 CCamCaptureSetupListItem* self = |
|
53 new( ELeave ) CCamCaptureSetupListItem( aIconLayout ); |
|
54 CleanupStack::PushL( self ); |
|
55 self->ConstructFromResourceL( aReader ); |
|
56 return self; |
|
57 } |
|
58 |
|
59 // ----------------------------------------------------------------------------- |
|
60 // NewLC |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 CCamCaptureSetupListItem* |
|
64 CCamCaptureSetupListItem::NewLC( |
|
65 const TDesC& aItemText, |
|
66 TInt aSettingId, |
|
67 TInt aBitmapId, |
|
68 TAknLayoutRect aIconLayout ) |
|
69 { |
|
70 CCamCaptureSetupListItem* self = |
|
71 new( ELeave ) CCamCaptureSetupListItem( aIconLayout ); |
|
72 CleanupStack::PushL( self ); |
|
73 self->ConstructFromValuesL( aItemText, aSettingId, aBitmapId ); |
|
74 return self; |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // CCamCaptureSetupListItem::CCamCaptureSetupListItem |
|
79 // C++ constructor |
|
80 // --------------------------------------------------------------------------- |
|
81 // |
|
82 CCamCaptureSetupListItem::CCamCaptureSetupListItem( TAknLayoutRect& aLayoutRect ) |
|
83 : iIconLayout( aLayoutRect ) |
|
84 { |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------------------------- |
|
88 // CCamCaptureSetupListItem::ConstructFromResourceL |
|
89 // Extract the data from aReader to populate data members |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 void |
|
93 CCamCaptureSetupListItem::ConstructFromResourceL( TResourceReader& aReader ) |
|
94 { |
|
95 // iListItemText = aReader.ReadTPtrC(); |
|
96 iListItemText = aReader.ReadTPtrC().AllocL(); |
|
97 iSettingItemValueId = aReader.ReadInt16(); |
|
98 iBitmapId = aReader.ReadInt32(); |
|
99 |
|
100 ConstructL(); |
|
101 } |
|
102 |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // Construct the item from given data |
|
106 // --------------------------------------------------------------------------- |
|
107 // |
|
108 void |
|
109 CCamCaptureSetupListItem::ConstructFromValuesL( const TDesC& aItemText, |
|
110 TInt aSettingId, |
|
111 TInt aBitmapId ) |
|
112 { |
|
113 iListItemText = aItemText.AllocL(); |
|
114 iSettingItemValueId = aSettingId; |
|
115 iBitmapId = aBitmapId; |
|
116 |
|
117 ConstructL(); |
|
118 } |
|
119 // --------------------------------------------------------------------------- |
|
120 // CCamCaptureSetupListItem::ConstructL |
|
121 // Second phase construction |
|
122 // --------------------------------------------------------------------------- |
|
123 // |
|
124 void CCamCaptureSetupListItem::ConstructL() |
|
125 { |
|
126 if ( iBitmapId != KErrNotFound ) |
|
127 { |
|
128 TFileName resFileName; |
|
129 CamUtility::ResourceFileName( resFileName ); |
|
130 TPtrC resname = resFileName; |
|
131 |
|
132 AknIconUtils::CreateIconL( iBitmap, iBitmapMask, resname, iBitmapId, iBitmapId ); |
|
133 AknIconUtils::SetSize( iBitmap, TSize( iIconLayout.Rect().Width(), iIconLayout.Rect().Height() ) ); |
|
134 } |
|
135 } |
|
136 |
|
137 |
|
138 // --------------------------------------------------------------------------- |
|
139 // Destructor |
|
140 // --------------------------------------------------------------------------- |
|
141 // |
|
142 CCamCaptureSetupListItem::~CCamCaptureSetupListItem() |
|
143 { |
|
144 } |
|
145 |
|
146 // End of File |