|
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 aBinding->SetObserver( *this ); |
|
65 } |
|
66 |
|
67 // ---------------------------------------------------------------------------- |
|
68 // PopulateT |
|
69 // ---------------------------------------------------------------------------- |
|
70 // |
|
71 void CGlxBindingSet::PopulateT( Alf::MulVisualItem& aItem, |
|
72 const TGlxMedia& aMedia, TBool aIsFocused, TInt aTextureId) const |
|
73 { |
|
74 TRACER("CGlxBindingSet::PopulateT"); |
|
75 const TInt count = iBindings.Count(); |
|
76 for ( TInt i = 0; i < count; i++ ) |
|
77 { |
|
78 iBindings[i]->PopulateT( aItem, aMedia, aIsFocused, aTextureId ); |
|
79 } |
|
80 } |
|
81 |
|
82 // ---------------------------------------------------------------------------- |
|
83 // HasRelevantAttributes |
|
84 // ---------------------------------------------------------------------------- |
|
85 // |
|
86 TBool CGlxBindingSet::HasRelevantAttributes( const RArray< TMPXAttribute >& |
|
87 aAttributes ) const |
|
88 { |
|
89 TRACER("CGlxBindingSet::HasRelevantAttributes"); |
|
90 TBool isRelevant = EFalse; |
|
91 TInt count = iBindings.Count(); |
|
92 TInt i = -1; |
|
93 while( ++i < count && !isRelevant ) |
|
94 { |
|
95 isRelevant = iBindings[i]->HasRelevantAttributes( aAttributes ); |
|
96 } |
|
97 GLX_LOG_INFO1("HasRelevantAttributes::isRelevant %d", isRelevant); |
|
98 return isRelevant; |
|
99 } |
|
100 |
|
101 // ---------------------------------------------------------------------------- |
|
102 // HandleFocusChanged |
|
103 // ---------------------------------------------------------------------------- |
|
104 // |
|
105 CGlxBinding::TResponse CGlxBindingSet::HandleFocusChanged( TBool aIsGained) |
|
106 { |
|
107 TRACER("CGlxBindingSet::HandleFocusChanged"); |
|
108 TResponse response = ENoUpdateNeeded; |
|
109 TInt count = iBindings.Count(); |
|
110 TInt i = -1; |
|
111 while( ++i < count ) |
|
112 { |
|
113 TResponse singleResponse = iBindings[i]->HandleFocusChanged( aIsGained ); |
|
114 if ( ENoUpdateNeeded != singleResponse ) |
|
115 { |
|
116 response = singleResponse; |
|
117 } |
|
118 } |
|
119 return response; |
|
120 } |
|
121 |
|
122 // ---------------------------------------------------------------------------- |
|
123 // HandleItemChanged |
|
124 // ---------------------------------------------------------------------------- |
|
125 // |
|
126 void CGlxBindingSet::HandleItemChangedL(const CMPXCollectionPath& aPath ) |
|
127 { |
|
128 TRACER("CGlxBindingSet::HandleItemChangedL"); |
|
129 TInt count = iBindings.Count(); |
|
130 TInt i = -1; |
|
131 while( ++i < count ) |
|
132 { |
|
133 |
|
134 iBindings[i]->HandleItemChangedL(aPath); |
|
135 } |
|
136 } |
|
137 // ---------------------------------------------------------------------------- |
|
138 // HandleBindingChanged |
|
139 // ---------------------------------------------------------------------------- |
|
140 // |
|
141 void CGlxBindingSet::HandleBindingChanged( const CGlxBinding& /*aBinding*/ ) |
|
142 { |
|
143 TRACER("CGlxBindingSet::HandleBindingChanged"); |
|
144 iObserver.HandleBindingChanged( *this ); |
|
145 } |
|
146 |
|
147 // ---------------------------------------------------------------------------- |
|
148 // AddRequirementsL |
|
149 // ---------------------------------------------------------------------------- |
|
150 // |
|
151 void CGlxBindingSet::AddRequirementsL( CGlxAttributeRequirements& |
|
152 aAttributeRequirement,TSize aSize ) |
|
153 { |
|
154 TRACER("CGlxBindingSet::AddRequirementsL"); |
|
155 for(TInt i = 0; i < iBindings.Count(); i++ ) |
|
156 { |
|
157 iBindings.operator[](i)->AddRequestL( aAttributeRequirement,aSize); |
|
158 } |
|
159 } |
|
160 |