|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Composite view extension. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CPbkMultiViewExtension.h" |
|
22 #include "ForEachUtil.h" |
|
23 |
|
24 #include <eikmenup.h> |
|
25 |
|
26 // CONSTANTS |
|
27 const TInt KExtensionGranularity = 1; |
|
28 |
|
29 // ==================== MEMBER FUNCTIONS ==================== |
|
30 CPbkMultiViewExtension::CPbkMultiViewExtension() : |
|
31 iViews(KExtensionGranularity) |
|
32 { |
|
33 } |
|
34 |
|
35 CPbkMultiViewExtension::~CPbkMultiViewExtension() |
|
36 { |
|
37 // This really cannot leave since this is a template |
|
38 // method and actually Release method is called |
|
39 ForEachL(iViews, |
|
40 &Release); |
|
41 iViews.Reset(); |
|
42 } |
|
43 |
|
44 CPbkMultiViewExtension* CPbkMultiViewExtension::NewL() |
|
45 { |
|
46 CPbkMultiViewExtension* self = new (ELeave) CPbkMultiViewExtension; |
|
47 return self; |
|
48 } |
|
49 |
|
50 void CPbkMultiViewExtension::AppendL(MPbkViewExtension* aView) |
|
51 { |
|
52 iViews.AppendL(aView); |
|
53 } |
|
54 |
|
55 void CPbkMultiViewExtension::DynInitMenuPaneL |
|
56 (TInt aResourceId, CEikMenuPane* aMenuPane) |
|
57 { |
|
58 ForEachL(iViews, |
|
59 VoidMemberFunction(&MPbkViewExtension::DynInitMenuPaneL), |
|
60 aResourceId, |
|
61 aMenuPane); |
|
62 } |
|
63 |
|
64 TBool CPbkMultiViewExtension::HandleCommandL(TInt aCommandId) |
|
65 { |
|
66 typedef TBool (MPbkViewExtension::* HandleCommandPtr)(TInt); |
|
67 HandleCommandPtr handleFunc = &MPbkViewExtension::HandleCommandL; |
|
68 return TryEachL(iViews, |
|
69 MemberFunction(handleFunc), |
|
70 aCommandId); |
|
71 } |
|
72 |
|
73 TBool CPbkMultiViewExtension::HandleCommandL |
|
74 (TInt aCommandId, MPbkMenuCommandObserver& aObserver) |
|
75 { |
|
76 typedef TBool (MPbkViewExtension::* HandleCommandPtr) |
|
77 (TInt,MPbkMenuCommandObserver&); |
|
78 HandleCommandPtr handleFunc = &MPbkViewExtension::HandleCommandL; |
|
79 return TryEachL(iViews, |
|
80 MemberFunction(handleFunc), |
|
81 aCommandId, |
|
82 aObserver); |
|
83 } |
|
84 |
|
85 void CPbkMultiViewExtension::SetContactUiControl |
|
86 (MPbkContactUiControl* aContactControl) |
|
87 { |
|
88 // This can't leave because the called method is |
|
89 // actually MPbkViewExtension::SetContactUiControl |
|
90 ForEachL(iViews, |
|
91 VoidMemberFunction(&MPbkViewExtension::SetContactUiControl), |
|
92 aContactControl); |
|
93 } |
|
94 |
|
95 void CPbkMultiViewExtension::DoRelease() |
|
96 { |
|
97 delete this; |
|
98 } |
|
99 |