1 /* |
|
2 * Copyright (c) 2007 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: The implementation for grid element with recycling of visuals supported. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "alf/alfrecyclinggridelement.h" |
|
19 #include "alfrecyclinggridelementimpl.h" |
|
20 |
|
21 #include <alf/alfenv.h> |
|
22 #include <alf/alfconstants.h> |
|
23 #include <alf/alfcommand.h> |
|
24 |
|
25 #include <alf/alfgridlayout.h> |
|
26 #include <alf/alflayout.h> |
|
27 #include <alf/alfcontrol.h> |
|
28 #include <alf/alfevent.h> |
|
29 |
|
30 #include "alf/ialfvisualtemplate.h" |
|
31 #include <alf/alfvarianttype.h> |
|
32 #include <alf/alfwidgetcontrol.h> |
|
33 #include <alf/alfwidgetevents.h> |
|
34 #include <osn/ustring.h> |
|
35 #include <memory> |
|
36 #include <osn/osnnew.h> |
|
37 |
|
38 using namespace osncore; |
|
39 |
|
40 namespace Alf |
|
41 { |
|
42 |
|
43 //---------------------------------------------------------------- |
|
44 // 1st phase Constructor. Leaves the newly created object |
|
45 // on the cleanup stack |
|
46 //---------------------------------------------------------------- |
|
47 OSN_EXPORT AlfRecyclingGridElement::AlfRecyclingGridElement( |
|
48 CAlfWidgetControl& aControl, |
|
49 const char* aName, |
|
50 int aNumColumns, |
|
51 int aNumRows) |
|
52 { |
|
53 construct(aControl,aName); |
|
54 |
|
55 mImpl.reset( new( EMM ) AlfRecyclingGridElementImpl( |
|
56 *this, aNumColumns, aNumRows ) ); |
|
57 |
|
58 control().addEventHandler(this); |
|
59 } |
|
60 |
|
61 //---------------------------------------------------------------- |
|
62 // Class Destructor |
|
63 //---------------------------------------------------------------- |
|
64 OSN_EXPORT AlfRecyclingGridElement::~AlfRecyclingGridElement() |
|
65 { |
|
66 control().removeEventHandler(*this); |
|
67 } |
|
68 |
|
69 //---------------------------------------------------------------- |
|
70 // Sets the fill style for the Recycle grid element |
|
71 //---------------------------------------------------------------- |
|
72 OSN_EXPORT void AlfRecyclingGridElement::setFillStyle(FillStyle aFillStyle, int aFillStyleParam) |
|
73 { |
|
74 mImpl->setFillStyle( aFillStyle, aFillStyleParam ); |
|
75 } |
|
76 |
|
77 |
|
78 OSN_EXPORT void AlfRecyclingGridElement::setAnimationTimes( |
|
79 int aScrollingTime, int aFadeInTime, int aFadeInDelay, |
|
80 int aFadeOutTime, int aFadeOutDelay ) |
|
81 { |
|
82 mImpl->setAnimationTimes( |
|
83 aScrollingTime, aFadeInTime, aFadeInDelay, |
|
84 aFadeOutTime, aFadeOutDelay ); |
|
85 } |
|
86 |
|
87 |
|
88 OSN_EXPORT CAlfVisual* AlfRecyclingGridElement::createVisualTree( |
|
89 IAlfVariantType& aData, uint aDataID, CAlfLayout* aParentLayout, int aLayoutIndex ) |
|
90 { |
|
91 return mImpl->createVisualTree( |
|
92 aData, aDataID, aParentLayout, aLayoutIndex ); |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // OfferEventL - Handle the Event. |
|
97 // ?implementation_description |
|
98 // --------------------------------------------------------------------------- |
|
99 OSN_EXPORT AlfEventStatus AlfRecyclingGridElement::offerEvent( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) |
|
100 { |
|
101 return mImpl->offerEvent( aControl, aEvent ) |
|
102 ?EEventHandled:EEventNotHandled; |
|
103 } |
|
104 |
|
105 // --------------------------------------------------------------------------- |
|
106 // ?implementation_description |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 OSN_EXPORT void AlfRecyclingGridElement::setActiveStates( unsigned int aStates ) |
|
110 { |
|
111 mImpl->setActiveStates( aStates ); |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // From class IAlfWidgetEventHandler. |
|
116 // sets event handler data. |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 OSN_EXPORT void AlfRecyclingGridElement::setEventHandlerData( const AlfWidgetEventHandlerInitData& aData ) |
|
120 { |
|
121 mImpl->setEventHandlerData(aData); |
|
122 } |
|
123 |
|
124 // --------------------------------------------------------------------------- |
|
125 // From class IAlfWidgetEventHandler. |
|
126 // returns the eventhandlertype . |
|
127 // --------------------------------------------------------------------------- |
|
128 // |
|
129 IAlfWidgetEventHandler::AlfEventHandlerType AlfRecyclingGridElement::eventHandlerType() |
|
130 { |
|
131 return IAlfWidgetEventHandler::EPresentationEventHandler; |
|
132 } |
|
133 |
|
134 // --------------------------------------------------------------------------- |
|
135 // From class IAlfWidgetEventHandler. |
|
136 // returns eventhandler excecutionphase. |
|
137 // --------------------------------------------------------------------------- |
|
138 // |
|
139 IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase AlfRecyclingGridElement::eventExecutionPhase() |
|
140 { |
|
141 return IAlfWidgetEventHandler::ETunnellingPhaseEventHandler; |
|
142 } |
|
143 // returns event handler data. |
|
144 // --------------------------------------------------------------------------- |
|
145 // |
|
146 OSN_EXPORT AlfWidgetEventHandlerInitData* AlfRecyclingGridElement::eventHandlerData() |
|
147 { |
|
148 return mImpl->eventHandlerData(); |
|
149 } |
|
150 |
|
151 // --------------------------------------------------------------------------- |
|
152 // From class IAlfInterfaceBase. |
|
153 // ?implementation_description |
|
154 // --------------------------------------------------------------------------- |
|
155 // |
|
156 OSN_EXPORT IAlfInterfaceBase* AlfRecyclingGridElement::makeInterface( const IfId& aType ) |
|
157 { |
|
158 IAlfInterfaceBase* ret(0); |
|
159 UString param(aType.mImplementationId); |
|
160 |
|
161 if (param == AlfRecyclingGridElement::type().mImplementationId ) |
|
162 { |
|
163 ret = static_cast<IAlfElement*>(this); |
|
164 } |
|
165 else if (param == IAlfWidgetEventHandler::type().mImplementationId ) |
|
166 { |
|
167 ret = static_cast<IAlfWidgetEventHandler*>(this); |
|
168 } |
|
169 else |
|
170 { |
|
171 ret = AlfElement::makeInterface(aType); |
|
172 } |
|
173 return ret; |
|
174 } |
|
175 |
|
176 |
|
177 OSN_EXPORT bool AlfRecyclingGridElement::accept( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const |
|
178 { |
|
179 return mImpl->accept( aControl, aEvent ); |
|
180 } |
|
181 |
|
182 OSN_EXPORT void AlfRecyclingGridElement::createChildVisualTree( |
|
183 IAlfElement* aElement, IAlfVariantType& aChildData, |
|
184 IAlfBranch& aData, int aIndex, uint aDataID ) |
|
185 { |
|
186 mImpl->createChildVisualTree( aElement, aChildData, aData, aIndex, aDataID ); |
|
187 } |
|
188 |
|
189 OSN_EXPORT void AlfRecyclingGridElement::removeChildVisualTree( |
|
190 IAlfElement* aElement, IAlfBranch& aData, int aIndex, uint aDataID ) |
|
191 { |
|
192 mImpl->removeChildVisualTree( aElement, aData, aIndex, aDataID ); |
|
193 } |
|
194 |
|
195 // --------------------------------------------------------------------------- |
|
196 // Description: Do not destroy visuals, because it's done elsewhere. |
|
197 // --------------------------------------------------------------------------- |
|
198 void AlfRecyclingGridElement::removeAndDestroyVisuals( int aTimeMilliseconds ) |
|
199 { |
|
200 mImpl->removeAndDestroyVisuals( aTimeMilliseconds ); |
|
201 } |
|
202 |
|
203 } //Alf |
|