|
1 /* |
|
2 * Copyright (c) 2008-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: Implemention of bindings required to populate the visual item |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #include "glxbindingset.h" // holds the bindings required to populate the visual item |
|
22 #include <glxlog.h> // Logging |
|
23 #include <glxtracer.h> |
|
24 // ---------------------------------------------------------------------------- |
|
25 // NewLC |
|
26 // ---------------------------------------------------------------------------- |
|
27 // |
|
28 CGlxBindingSet* CGlxBindingSet::NewLC( MGlxBindingObserver& aObserver ) |
|
29 { |
|
30 TRACER("CGlxBindingSet::NewLC"); |
|
31 CGlxBindingSet* set = new ( ELeave ) CGlxBindingSet( aObserver ); |
|
32 CleanupStack::PushL( set ); |
|
33 return set; |
|
34 } |
|
35 |
|
36 // ---------------------------------------------------------------------------- |
|
37 // constructor |
|
38 // ---------------------------------------------------------------------------- |
|
39 // |
|
40 CGlxBindingSet::CGlxBindingSet( MGlxBindingObserver& aObserver ) |
|
41 : iObserver( aObserver ) |
|
42 { |
|
43 } |
|
44 |
|
45 // ---------------------------------------------------------------------------- |
|
46 // destructor |
|
47 // ---------------------------------------------------------------------------- |
|
48 // |
|
49 CGlxBindingSet::~CGlxBindingSet() |
|
50 { |
|
51 TRACER("CGlxBindingSet::~CGlxBindingSet"); |
|
52 iBindings.ResetAndDestroy(); |
|
53 } |
|
54 |
|
55 // ---------------------------------------------------------------------------- |
|
56 // AddBindingL |
|
57 // ---------------------------------------------------------------------------- |
|
58 // |
|
59 void CGlxBindingSet::AddBindingL( CGlxBinding* aBinding ) |
|
60 { |
|
61 TRACER("CGlxBindingSet::AddBindingL"); |
|
62 __ASSERT_DEBUG( aBinding, User::Invariant() ); // null binding not accepted |
|
63 iBindings.AppendL( aBinding ); |
|
64 //CleanupStack ::Pop( aBinding ); |
|
65 aBinding->SetObserver( *this ); |
|
66 } |
|
67 |
|
68 // ---------------------------------------------------------------------------- |
|
69 // PopulateT |
|
70 // ---------------------------------------------------------------------------- |
|
71 // |
|
72 void CGlxBindingSet::PopulateT( Alf::MulVisualItem& aItem, |
|
73 const TGlxMedia& aMedia, TBool aIsFocused ) const |
|
74 { |
|
75 TRACER("CGlxBindingSet::PopulateT"); |
|
76 const TInt count = iBindings.Count(); |
|
77 for ( TInt i = 0; i < count; i++ ) |
|
78 { |
|
79 iBindings[i]->PopulateT( aItem, aMedia, aIsFocused ); |
|
80 } |
|
81 } |
|
82 |
|
83 // ---------------------------------------------------------------------------- |
|
84 // HasRelevantAttributes |
|
85 // ---------------------------------------------------------------------------- |
|
86 // |
|
87 TBool CGlxBindingSet::HasRelevantAttributes( const RArray< TMPXAttribute >& |
|
88 aAttributes ) const |
|
89 { |
|
90 TRACER("CGlxBindingSet::HasRelevantAttributes"); |
|
91 TBool isRelevant = EFalse; |
|
92 TInt count = iBindings.Count(); |
|
93 TInt i = -1; |
|
94 while( ++i < count && !isRelevant ) |
|
95 { |
|
96 isRelevant = iBindings[i]->HasRelevantAttributes( aAttributes ); |
|
97 } |
|
98 GLX_LOG_INFO1("HasRelevantAttributes::isRelevant %d", isRelevant); |
|
99 return isRelevant; |
|
100 } |
|
101 |
|
102 // ---------------------------------------------------------------------------- |
|
103 // HandleFocusChanged |
|
104 // ---------------------------------------------------------------------------- |
|
105 // |
|
106 CGlxBinding::TResponse CGlxBindingSet::HandleFocusChanged( TBool aIsGained) |
|
107 { |
|
108 TRACER("CGlxBindingSet::HandleFocusChanged"); |
|
109 TResponse response = ENoUpdateNeeded; |
|
110 TInt count = iBindings.Count(); |
|
111 TInt i = -1; |
|
112 while( ++i < count ) |
|
113 { |
|
114 TResponse singleResponse = iBindings[i]->HandleFocusChanged( aIsGained ); |
|
115 if ( ENoUpdateNeeded != singleResponse ) |
|
116 { |
|
117 response = singleResponse; |
|
118 } |
|
119 } |
|
120 return response; |
|
121 } |
|
122 |
|
123 // ---------------------------------------------------------------------------- |
|
124 // HandleItemChanged |
|
125 // ---------------------------------------------------------------------------- |
|
126 // |
|
127 void CGlxBindingSet::HandleItemChangedL(const CMPXCollectionPath& aPath ) |
|
128 { |
|
129 TRACER("CGlxBindingSet::HandleItemChangedL"); |
|
130 TInt count = iBindings.Count(); |
|
131 TInt i = -1; |
|
132 while( ++i < count ) |
|
133 { |
|
134 |
|
135 iBindings[i]->HandleItemChangedL(aPath); |
|
136 } |
|
137 } |
|
138 // ---------------------------------------------------------------------------- |
|
139 // HandleBindingChanged |
|
140 // ---------------------------------------------------------------------------- |
|
141 // |
|
142 void CGlxBindingSet::HandleBindingChanged( const CGlxBinding& /*aBinding*/ ) |
|
143 { |
|
144 TRACER("CGlxBindingSet::HandleBindingChanged"); |
|
145 iObserver.HandleBindingChanged( *this ); |
|
146 } |
|
147 |
|
148 // ---------------------------------------------------------------------------- |
|
149 // AddRequirementsL |
|
150 // ---------------------------------------------------------------------------- |
|
151 // |
|
152 void CGlxBindingSet::AddRequirementsL( CGlxAttributeRequirements& |
|
153 aAttributeRequirement,TSize aSize ) |
|
154 { |
|
155 TRACER("CGlxBindingSet::AddRequirementsL"); |
|
156 for(TInt i = 0; i < iBindings.Count(); i++ ) |
|
157 { |
|
158 iBindings.operator[](i)->AddRequestL( aAttributeRequirement,aSize); |
|
159 } |
|
160 } |
|
161 |