9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: Implementation for wrapper for a box |
14 * Description: View control adapter |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 // System includes |
18 // System includes |
19 #include <gfxtranseffect/gfxtranseffect.h> |
|
20 #include <akntransitionutils.h> |
|
21 |
19 |
22 // User includes |
20 // User includes |
23 #include "xnappuiadapter.h" |
21 #include "xnappuiadapter.h" |
24 #include "xnuiengine.h" |
22 #include "xnuiengine.h" |
|
23 #include "xnnodepluginif.h" |
25 #include "xnnode.h" |
24 #include "xnnode.h" |
|
25 |
|
26 #include "xndomdocument.h" |
26 #include "xndomnode.h" |
27 #include "xndomnode.h" |
27 #include "xnnodepluginif.h" |
|
28 #include "xnproperty.h" |
28 #include "xnproperty.h" |
29 #include "xnviewadapter.h" |
29 |
30 #include "xnbackgroundmanager.h" |
|
31 #include "xnviewdata.h" |
|
32 #include "xnviewmanager.h" |
|
33 #include "xnviewcontroladapter.h" |
30 #include "xnviewcontroladapter.h" |
34 |
31 |
35 // Constants |
32 // Constants |
36 |
33 |
|
34 // ============================ LOCAL FUNCTIONS ================================ |
|
35 // ----------------------------------------------------------------------------- |
|
36 // ResetGrabbingL |
|
37 // Removes recursively grabbing controls |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 static void ResetGrabbingL( CXnControlAdapter* aControl, |
|
41 const TPointerEvent& aEvent ) |
|
42 { |
|
43 if ( aControl ) |
|
44 { |
|
45 CCoeControl* grabber( aControl->GrabbingComponent() ); |
|
46 |
|
47 if ( grabber ) |
|
48 { |
|
49 grabber->IgnoreEventsUntilNextPointerUp(); |
|
50 |
|
51 aControl->CCoeControl::HandlePointerEventL( aEvent ); |
|
52 |
|
53 CXnControlAdapter* adapter = |
|
54 dynamic_cast< CXnControlAdapter* >( grabber ); |
|
55 |
|
56 ResetGrabbingL( adapter, aEvent ); |
|
57 } |
|
58 } |
|
59 } |
|
60 |
37 // ============================ MEMBER FUNCTIONS =============================== |
61 // ============================ MEMBER FUNCTIONS =============================== |
38 |
62 |
39 // ----------------------------------------------------------------------------- |
63 // ----------------------------------------------------------------------------- |
40 // CXnViewControlAdapter::NewL |
64 // CXnViewControlAdapter::NewL |
41 // Symbian static 1st phase constructor |
65 // Symbian static 1st phase constructor |
75 ActivateL(); |
99 ActivateL(); |
76 |
100 |
77 SetComponentsToInheritVisibility( ETrue ); |
101 SetComponentsToInheritVisibility( ETrue ); |
78 |
102 |
79 iAppUi.UiStateListener().AddObserver( *this ); |
103 iAppUi.UiStateListener().AddObserver( *this ); |
|
104 |
|
105 // By default all views are invisible during construction phase |
|
106 CXnDomStringPool* sp( aNode.Node().DomNode()->StringPool() ); |
|
107 |
|
108 CXnProperty* prop = CXnProperty::NewL( |
|
109 XnPropertyNames::style::common::KDisplay, |
|
110 XnPropertyNames::style::common::display::KNone, |
|
111 CXnDomPropertyValue::EString, *sp ); |
|
112 CleanupStack::PushL( prop ); |
|
113 |
|
114 aNode.SetPropertyWithoutNotificationL( prop ); |
|
115 CleanupStack::Pop( prop ); |
80 } |
116 } |
81 |
117 |
82 // ----------------------------------------------------------------------------- |
118 // ----------------------------------------------------------------------------- |
83 // CXnViewControlAdapter::CXnViewControlAdapter |
119 // CXnViewControlAdapter::CXnViewControlAdapter |
84 // C++ default constructor |
120 // C++ default constructor |
85 // ----------------------------------------------------------------------------- |
121 // ----------------------------------------------------------------------------- |
86 // |
122 // |
87 CXnViewControlAdapter::CXnViewControlAdapter( CXnNodePluginIf& aNode ) |
123 CXnViewControlAdapter::CXnViewControlAdapter( CXnNodePluginIf& aNode ) |
88 : iNode( aNode ), iAppUi( static_cast< CXnAppUiAdapter& >( *iAvkonAppUi ) ), |
124 : iNode( aNode ), iAppUi( static_cast< CXnAppUiAdapter& >( *iAvkonAppUi ) ) |
89 iHitpoint( TPoint( -1,-1 ) ) |
|
90 { |
125 { |
91 } |
126 } |
92 |
127 |
93 // ----------------------------------------------------------------------------- |
128 // ----------------------------------------------------------------------------- |
94 // CXnViewControlAdapter::~CXnViewControlAdapter |
129 // CXnViewControlAdapter::~CXnViewControlAdapter |
144 // |
179 // |
145 // ----------------------------------------------------------------------------- |
180 // ----------------------------------------------------------------------------- |
146 // |
181 // |
147 void CXnViewControlAdapter::HandlePointerEventL( |
182 void CXnViewControlAdapter::HandlePointerEventL( |
148 const TPointerEvent& aPointerEvent ) |
183 const TPointerEvent& aPointerEvent ) |
149 { |
184 { |
150 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
151 { |
|
152 iHitpoint = aPointerEvent.iPosition; |
|
153 } |
|
154 |
|
155 iAppUi.UiEngine().DisableRenderUiLC(); |
185 iAppUi.UiEngine().DisableRenderUiLC(); |
156 |
186 |
157 CXnControlAdapter::HandlePointerEventL( aPointerEvent ); |
187 CXnControlAdapter::HandlePointerEventL( aPointerEvent ); |
158 |
188 |
159 iAppUi.UiEngine().RenderUIL(); |
189 iAppUi.UiEngine().RenderUIL(); |
160 |
190 |
161 CleanupStack::PopAndDestroy(); |
191 CleanupStack::PopAndDestroy(); |
167 // ----------------------------------------------------------------------------- |
197 // ----------------------------------------------------------------------------- |
168 // |
198 // |
169 void CXnViewControlAdapter::ResetGrabbing() |
199 void CXnViewControlAdapter::ResetGrabbing() |
170 { |
200 { |
171 TPointerEvent event; |
201 TPointerEvent event; |
|
202 |
|
203 event.iModifiers = 0; |
|
204 event.iPosition = TPoint(); |
|
205 event.iParentPosition = TPoint(); |
172 event.iType = TPointerEvent::EButton1Up; |
206 event.iType = TPointerEvent::EButton1Up; |
173 |
207 |
174 TRAP_IGNORE( RemoveGrabbingControL( this, event ) ); |
208 TRAP_IGNORE( ResetGrabbingL( this, event ) ); |
175 |
|
176 iHitpoint.SetXY( -1, -1 ); |
|
177 } |
|
178 |
|
179 // ----------------------------------------------------------------------------- |
|
180 // CXnViewControlAdapter::RemoveGrabbingControL() |
|
181 // Removes recursively grabbing controls |
|
182 // ----------------------------------------------------------------------------- |
|
183 // |
|
184 void CXnViewControlAdapter::RemoveGrabbingControL( const CCoeControl* aControl, |
|
185 const TPointerEvent& aEvent ) const |
|
186 { |
|
187 TInt count( aControl->CountComponentControls() ); |
|
188 |
|
189 for( TInt i = 0; i < count; i++ ) |
|
190 { |
|
191 CCoeControl* child( aControl->ComponentControl( i ) ); |
|
192 |
|
193 if( child && child->Rect().Contains( iHitpoint ) ) |
|
194 { |
|
195 child->CCoeControl::HandlePointerEventL( aEvent ); |
|
196 RemoveGrabbingControL( child, aEvent ); |
|
197 } |
|
198 } |
|
199 } |
209 } |
200 |
210 |
201 // ----------------------------------------------------------------------------- |
211 // ----------------------------------------------------------------------------- |
202 // CXnViewControlAdapter::NotifyForegroundChanged() |
212 // CXnViewControlAdapter::NotifyForegroundChanged() |
203 // |
213 // |