|
1 /* |
|
2 * Copyright (c) 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: Implementation of the class CFscContactActionMenuListBox. |
|
15 * |
|
16 */ |
|
17 |
|
18 //<cmail> |
|
19 |
|
20 // INCUDES |
|
21 #include "emailtrace.h" |
|
22 #include <e32std.h> |
|
23 #include <AknUtils.h> |
|
24 #include <AknsDrawUtils.h> |
|
25 #include <eikclbd.h> |
|
26 #include <AknsFrameBackgroundControlContext.h> |
|
27 |
|
28 #include "cfsccontactactionmenulistbox.h" |
|
29 #include "cfsccontactactionmenulistboxitemdrawer.h" |
|
30 #include "fsccontactactionmenuuidefines.h" |
|
31 |
|
32 // ======== LOCAL FUNCTIONS ======== |
|
33 |
|
34 // ======== MEMBER FUNCTIONS ======== |
|
35 |
|
36 |
|
37 // --------------------------------------------------------------------------- |
|
38 // CFscContactActionMenuListBox::CFscContactActionMenuListBox |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 CFscContactActionMenuListBox::CFscContactActionMenuListBox() |
|
42 { |
|
43 FUNC_LOG; |
|
44 } |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // CFscContactActionMenuListBox::~CFscContactActionMenuListBox |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 CFscContactActionMenuListBox::~CFscContactActionMenuListBox() |
|
51 { |
|
52 FUNC_LOG; |
|
53 if ( iBgContext ) |
|
54 { |
|
55 delete iBgContext; |
|
56 iBgContext = NULL; |
|
57 } |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // CFscContactActionMenuListBox::ConstructL |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 void CFscContactActionMenuListBox::ConstructL( |
|
65 const CCoeControl* aParent,TInt aFlags ) |
|
66 { |
|
67 FUNC_LOG; |
|
68 |
|
69 // Construct own item drawer |
|
70 CreateModelL(); |
|
71 ( ( CTextListBoxModel* )iModel )->ConstructL(); |
|
72 |
|
73 CColumnListBoxData* columnData = |
|
74 CColumnListBoxData::NewL(); |
|
75 |
|
76 CleanupStack::PushL( columnData ); |
|
77 iItemDrawer=new ( ELeave ) |
|
78 CFscContactActionMenuListBoxItemDrawer( |
|
79 Model(), iEikonEnv->NormalFont(), columnData ); |
|
80 CleanupStack::Pop( columnData ); |
|
81 iItemDrawer->SetDrawMark(EFalse); |
|
82 |
|
83 EnableExtendedDrawingL(); |
|
84 CEikListBox::ConstructL(aParent,aFlags); |
|
85 |
|
86 columnData->SetSkinEnabledL( ETrue ); |
|
87 |
|
88 //Create background control for skinning |
|
89 if (!iBgContext) |
|
90 { |
|
91 iBgContext = CAknsFrameBackgroundControlContext::NewL( KAknsIIDQsnFrPopup, iBackgroundRect, iBackgroundRect, EFalse ); |
|
92 } |
|
93 |
|
94 } |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // CFscContactActionMenuListBox::Draw |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 void CFscContactActionMenuListBox::Draw( const TRect& aRect ) const |
|
101 { |
|
102 FUNC_LOG; |
|
103 |
|
104 if ( iBgContext ) |
|
105 { |
|
106 //Set frame borders |
|
107 iBgContext->SetFrameRects( iBackgroundRect, Rect() ); |
|
108 //Draw background |
|
109 AknsDrawUtils::Background( AknsUtils::SkinInstance(), iBgContext, this, SystemGc(), iBackgroundRect ); |
|
110 } |
|
111 |
|
112 CFSCCONTACTACTIONMENULISTBOXBASE::Draw( aRect ); |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // CFscContactActionMenuListBox::MopSupplyObject() |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 |
|
120 TTypeUid::Ptr CFscContactActionMenuListBox::MopSupplyObject(TTypeUid aId) |
|
121 { |
|
122 FUNC_LOG; |
|
123 // For skinning |
|
124 if ( iBgContext && aId.iUid == MAknsControlContext::ETypeId ) |
|
125 { |
|
126 return MAknsControlContext::SupplyMopObject( aId, iBgContext ); |
|
127 } |
|
128 |
|
129 return CCoeControl::MopSupplyObject( aId ); |
|
130 } |
|
131 |
|
132 |
|
133 // --------------------------------------------------------------------------- |
|
134 // CFscContactActionMenuListBox::SetVisibleItemCount |
|
135 // --------------------------------------------------------------------------- |
|
136 // |
|
137 void CFscContactActionMenuListBox::SetBackgroundRect( const TRect& aRect ) |
|
138 { |
|
139 FUNC_LOG; |
|
140 iBackgroundRect = aRect; |
|
141 iBgContext->SetRect(aRect); |
|
142 } |
|
143 //</cmail> |
|
144 |