64
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 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: Visual base class.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#include "alf/alfvisual.h"
|
|
21 |
#include "alf/alfenv.h"
|
|
22 |
#include "alf/alflayout.h"
|
|
23 |
#include "alf/alfcontrol.h"
|
|
24 |
#include "alf/alfbrusharray.h"
|
|
25 |
#include "alfclient.h"
|
|
26 |
#include "alf/alfdisplay.h"
|
|
27 |
#include "alf/alfroster.h"
|
|
28 |
#include "alf/alfgencomponent.h"
|
|
29 |
#include "alf/alftimedvalue.h"
|
|
30 |
#include "alf/alfconstants.h"
|
|
31 |
#include "alflogger.h"
|
|
32 |
#include "alf/alfmappingfunctions.h"
|
|
33 |
#include "alf/alftransformation.h"
|
|
34 |
#include "alf/alfstatic.h"
|
|
35 |
#include "alf/alfutil.h"
|
|
36 |
#include "alf/alfdropshadow.h"
|
|
37 |
|
|
38 |
#include <uiacceltk/HuiUtil.h>
|
|
39 |
|
|
40 |
NONSHARABLE_CLASS(CAlfVisualOwnerNotification) : public CBase, public MAlfAsyncOpObserver
|
|
41 |
{
|
|
42 |
public:
|
|
43 |
CAlfVisualOwnerNotification( CAlfVisual& aVisual );
|
|
44 |
~CAlfVisualOwnerNotification();
|
|
45 |
protected:
|
|
46 |
void AlfAsyncOpCompleted(TInt aCommandId, TInt aStatus);
|
|
47 |
private:
|
|
48 |
CAlfVisual& iVisual;
|
|
49 |
TInt iCommandId;
|
|
50 |
TBuf8<1> iDumBuffer;
|
|
51 |
};
|
|
52 |
|
|
53 |
CAlfVisualOwnerNotification::CAlfVisualOwnerNotification( CAlfVisual& aVisual )
|
|
54 |
: iVisual( aVisual )
|
|
55 |
{
|
|
56 |
iCommandId = 0;
|
|
57 |
TRAPD( err, iCommandId = iVisual.Comms()->DoAsynchronousCmdL( EAlfVisualLayoutUpdatedNotification, iDumBuffer, iDumBuffer, this ) );
|
|
58 |
__ASSERT_ALWAYS( err == KErrNone, USER_INVARIANT() );
|
|
59 |
}
|
|
60 |
|
|
61 |
CAlfVisualOwnerNotification::~CAlfVisualOwnerNotification()
|
|
62 |
{
|
|
63 |
TBuf8<1> dum;
|
|
64 |
if ( iCommandId )
|
|
65 |
{
|
|
66 |
iVisual.Comms()->DoSynchronousCmd( EAlfVisualLayoutUpdatedNotificationCancel, dum, dum );
|
|
67 |
iVisual.Comms()->CancelAsynchCmd( iCommandId );
|
|
68 |
iCommandId = 0;
|
|
69 |
}
|
|
70 |
}
|
|
71 |
|
|
72 |
void CAlfVisualOwnerNotification::AlfAsyncOpCompleted(TInt /*aCommandId*/, TInt aStatus)
|
|
73 |
{
|
|
74 |
iCommandId = 0;
|
|
75 |
if ( aStatus == KErrNone )
|
|
76 |
{
|
|
77 |
TRAPD( err, iCommandId = iVisual.Comms()->DoAsynchronousCmdL( EAlfVisualLayoutUpdatedNotification, iDumBuffer, iDumBuffer, this ) );
|
|
78 |
__ASSERT_ALWAYS( err == KErrNone, USER_INVARIANT() );
|
|
79 |
iVisual.Owner().VisualLayoutUpdated( iVisual );
|
|
80 |
}
|
|
81 |
}
|
|
82 |
|
|
83 |
// Private data
|
|
84 |
struct CAlfVisual::TPrivateData
|
|
85 |
{
|
|
86 |
CAlfLayout* iLayout; // Not owned.
|
|
87 |
CAlfDisplay* iDisplay; // Not Owned.
|
|
88 |
TAlfTimedValue iOpacity; // Owned.
|
|
89 |
CAlfControl* iOwner; // Not owned.
|
|
90 |
HBufC8* iTag; // Owned.
|
|
91 |
CAlfBrushArray* iBrushes; // Owned.
|
|
92 |
CAlfGenComponent* iComms; // owned
|
|
93 |
CAlfTransformation* iTransform; // Owned.
|
|
94 |
TAlfBoxMetric iPadding;// Owned
|
|
95 |
CAlfVisualOwnerNotification* iVisualOwnerNotification; // Own
|
|
96 |
CAlfDropShadow* iDropShadowHandler;
|
|
97 |
};
|
|
98 |
|
|
99 |
// ======== MACRO DEFINITIONS ========
|
|
100 |
|
|
101 |
void AssertPaddingsWereSetUsingDeprecatedPixelAPIs(const TAlfBoxMetric& aMetric)
|
|
102 |
{
|
|
103 |
__ASSERT_DEBUG(
|
|
104 |
(aMetric.iLeft.iMagnitude == aMetric.iRight.iMagnitude) &&
|
|
105 |
(aMetric.iTop.iMagnitude == aMetric.iBottom.iMagnitude) &&
|
|
106 |
(aMetric.iLeft.iUnit == EAlfUnitPixel) &&
|
|
107 |
(aMetric.iRight.iUnit == EAlfUnitPixel) &&
|
|
108 |
(aMetric.iTop.iUnit == EAlfUnitPixel) &&
|
|
109 |
(aMetric.iBottom.iUnit == EAlfUnitPixel)
|
|
110 |
, USER_INVARIANT());
|
|
111 |
#ifndef _DEBUG // Remove compile warnings
|
|
112 |
TAlfBoxMetric tmp = aMetric;
|
|
113 |
tmp = tmp;
|
|
114 |
#endif
|
|
115 |
}
|
|
116 |
|
|
117 |
|
|
118 |
// ======== MEMBER FUNCTIONS ========
|
|
119 |
|
|
120 |
// ---------------------------------------------------------------------------
|
|
121 |
// Constructor
|
|
122 |
// ---------------------------------------------------------------------------
|
|
123 |
//
|
|
124 |
EXPORT_C CAlfVisual::CAlfVisual()
|
|
125 |
{
|
|
126 |
}
|
|
127 |
|
|
128 |
// ---------------------------------------------------------------------------
|
|
129 |
// ConstructL
|
|
130 |
// ---------------------------------------------------------------------------
|
|
131 |
//
|
|
132 |
EXPORT_C void CAlfVisual::ConstructL(CAlfControl& aOwner)
|
|
133 |
{
|
|
134 |
iData = new (ELeave) TPrivateData;
|
|
135 |
|
|
136 |
iData->iLayout = NULL;
|
|
137 |
iData->iDisplay = NULL;
|
|
138 |
iData->iOwner = &aOwner;
|
|
139 |
iData->iTag = NULL;
|
|
140 |
iData->iBrushes = NULL;
|
|
141 |
iData->iComms = NULL;
|
|
142 |
iData->iTransform = NULL;
|
|
143 |
iData->iPadding = TAlfBoxMetric(TAlfMetric(0));
|
|
144 |
iData->iVisualOwnerNotification = NULL;
|
|
145 |
iData->iDropShadowHandler = NULL;
|
|
146 |
}
|
|
147 |
|
|
148 |
|
|
149 |
// ---------------------------------------------------------------------------
|
|
150 |
// ConstructL
|
|
151 |
// ---------------------------------------------------------------------------
|
|
152 |
//
|
|
153 |
EXPORT_C void CAlfVisual::ConstructL(CAlfControl& aOwner, TInt aImplementationId, TInt aImplementationUid, const TDesC8& aConstructionParams )
|
|
154 |
{
|
|
155 |
|
|
156 |
ConstructL(aOwner);
|
|
157 |
|
|
158 |
if (!iData->iComms)
|
|
159 |
{
|
|
160 |
iData->iComms = CAlfGenComponent::NewL(
|
|
161 |
aOwner.Env(),
|
|
162 |
aImplementationId,
|
|
163 |
aImplementationUid,
|
|
164 |
aConstructionParams);
|
|
165 |
}
|
|
166 |
|
|
167 |
}
|
|
168 |
|
|
169 |
|
|
170 |
|
|
171 |
|
|
172 |
// ---------------------------------------------------------------------------
|
|
173 |
// Destructor
|
|
174 |
// ---------------------------------------------------------------------------
|
|
175 |
//
|
|
176 |
EXPORT_C CAlfVisual::~CAlfVisual()
|
|
177 |
{
|
|
178 |
if ( iData )
|
|
179 |
{
|
|
180 |
delete iData->iDropShadowHandler;
|
|
181 |
iData->iDropShadowHandler = NULL;
|
|
182 |
|
|
183 |
delete iData->iVisualOwnerNotification;
|
|
184 |
iData->iVisualOwnerNotification = NULL;
|
|
185 |
|
|
186 |
// If the visual is still attached to a layout, it is time to remove it.
|
|
187 |
if(iData->iLayout)
|
|
188 |
{
|
|
189 |
iData->iLayout->Remove(this);
|
|
190 |
}
|
|
191 |
|
|
192 |
delete iData->iBrushes;
|
|
193 |
iData->iBrushes = NULL;
|
|
194 |
|
|
195 |
delete iData->iTransform;
|
|
196 |
iData->iTransform = NULL;
|
|
197 |
|
|
198 |
delete iData->iTag;
|
|
199 |
iData->iTag = NULL;
|
|
200 |
|
|
201 |
delete iData->iComms;
|
|
202 |
}
|
|
203 |
delete iData;
|
|
204 |
iData = NULL;
|
|
205 |
}
|
|
206 |
|
|
207 |
// ---------------------------------------------------------------------------
|
|
208 |
// Destroys a hierarchy of visuals, along with this visual. The visuals
|
|
209 |
// are first removed from their owner.
|
|
210 |
// ---------------------------------------------------------------------------
|
|
211 |
//
|
|
212 |
EXPORT_C void CAlfVisual::RemoveAndDestroyAllD()
|
|
213 |
{
|
|
214 |
TBuf8<1> dum;
|
|
215 |
// Remove and destory from the server side
|
|
216 |
TInt err = iData->iComms->DoSynchronousCmd( EAlfVisualRemoveAndDestroyAll,KNullDesC8, dum);
|
|
217 |
|
|
218 |
if ( err != KErrNone )
|
|
219 |
{
|
|
220 |
__ALFLOGSTRING1( "CAlfVisual::RemoveAndDestroyAllD ignore error %d", err )
|
|
221 |
}
|
|
222 |
|
|
223 |
DoRemoveAndDestroyAllD();
|
|
224 |
}
|
|
225 |
|
|
226 |
EXPORT_C void CAlfVisual::DoRemoveAndDestroyAllD()
|
|
227 |
{
|
|
228 |
__ASSERT_ALWAYS( iData->iOwner, USER_INVARIANT() );
|
|
229 |
|
|
230 |
iData->iOwner->VisualDestroyed(*this);
|
|
231 |
delete this;
|
|
232 |
}
|
|
233 |
|
|
234 |
// ---------------------------------------------------------------------------
|
|
235 |
// Returns subsession identifier, 0 by default.
|
|
236 |
// ---------------------------------------------------------------------------
|
|
237 |
//
|
|
238 |
EXPORT_C TInt CAlfVisual::Identifier() const
|
|
239 |
{
|
|
240 |
return iData->iComms->Identifier();
|
|
241 |
}
|
|
242 |
|
|
243 |
// ---------------------------------------------------------------------------
|
|
244 |
// Sets layout for the visual.
|
|
245 |
// ---------------------------------------------------------------------------
|
|
246 |
//
|
|
247 |
void CAlfVisual::SetLayout(CAlfLayout* aLayout)
|
|
248 |
{
|
|
249 |
iData->iLayout = aLayout;
|
|
250 |
}
|
|
251 |
|
|
252 |
// ---------------------------------------------------------------------------
|
|
253 |
// Returns current opacity
|
|
254 |
// ---------------------------------------------------------------------------
|
|
255 |
//
|
|
256 |
EXPORT_C const TAlfTimedValue& CAlfVisual::Opacity() const
|
|
257 |
{
|
|
258 |
TPckg<TAlfTimedValue> buf(iData->iOpacity);
|
|
259 |
TInt err = iData->iComms->DoSynchronousCmd( EAlfVisualGetOpacity, KNullDesC8, buf);
|
|
260 |
|
|
261 |
if ( err != KErrNone )
|
|
262 |
{
|
|
263 |
__ALFLOGSTRING1( "CAlfVisual::Opacity panic error %d", err )
|
|
264 |
USER_INVARIANT();
|
|
265 |
}
|
|
266 |
|
|
267 |
return iData->iOpacity;
|
|
268 |
}
|
|
269 |
|
|
270 |
// ---------------------------------------------------------------------------
|
|
271 |
// Sets opacity.
|
|
272 |
// ---------------------------------------------------------------------------
|
|
273 |
//
|
|
274 |
EXPORT_C void CAlfVisual::SetOpacity( const TAlfTimedValue& aOpacity )
|
|
275 |
{
|
|
276 |
TPckgC<TAlfTimedValue> buf(aOpacity);
|
|
277 |
TInt err = iData->iComms->DoCmdNoReply( EAlfVisualSetOpacity, buf);
|
|
278 |
|
|
279 |
if ( err == KErrNone )
|
|
280 |
{
|
|
281 |
iData->iOpacity = aOpacity;
|
|
282 |
}
|
|
283 |
else
|
|
284 |
{
|
|
285 |
__ALFLOGSTRING1( "CAlfVisual::SetOpacity panic error %d", err )
|
|
286 |
USER_INVARIANT();
|
|
287 |
}
|
|
288 |
}
|
|
289 |
|
|
290 |
// ---------------------------------------------------------------------------
|
|
291 |
// Returns position
|
|
292 |
// ---------------------------------------------------------------------------
|
|
293 |
//
|
|
294 |
EXPORT_C TAlfTimedPoint CAlfVisual::Pos() const
|
|
295 |
{
|
|
296 |
TAlfTimedPoint point;
|
|
297 |
TPckg<TAlfTimedPoint> buf(point);
|
|
298 |
TInt err = iData->iComms->DoSynchronousCmd( EAlfVisualPos, KNullDesC8, buf);
|
|
299 |
|
|
300 |
if (err)
|
|
301 |
{
|
|
302 |
__ALFLOGSTRING1( "CAlfVisual::Pos panic error %d", err )
|
|
303 |
USER_INVARIANT();
|
|
304 |
}
|
|
305 |
|
|
306 |
return point;
|
|
307 |
}
|
|
308 |
|
|
309 |
|
|
310 |
// ---------------------------------------------------------------------------
|
|
311 |
// Sets the position of the visual.
|
|
312 |
// ---------------------------------------------------------------------------
|
|
313 |
//
|
|
314 |
EXPORT_C void CAlfVisual::SetPos(const TAlfRealPoint& aPos, TInt aTransitionTime)
|
|
315 |
{
|
|
316 |
TAlfVisualPos pos = { aPos, aTransitionTime };
|
|
317 |
|
|
318 |
TPckgC<TAlfVisualPos> buf(pos);
|
|
319 |
TInt err = iData->iComms->DoCmdNoReply( EAlfVisualSetPos, buf);
|
|
320 |
|
|
321 |
if (err) // for now
|
|
322 |
{
|
|
323 |
__ALFLOGSTRING1( "CAlfVisual::SetPos panic error %d", err )
|
|
324 |
USER_INVARIANT();
|
|
325 |
}
|
|
326 |
}
|
|
327 |
|
|
328 |
// ---------------------------------------------------------------------------
|
|
329 |
// Returns the size of the visual.
|
|
330 |
// ---------------------------------------------------------------------------
|
|
331 |
//
|
|
332 |
EXPORT_C const TAlfTimedPoint CAlfVisual::Size() const
|
|
333 |
{
|
|
334 |
TAlfTimedPoint size;
|
|
335 |
TPckg<TAlfTimedPoint> buf(size);
|
|
336 |
TInt err = iData->iComms->DoSynchronousCmd( EAlfVisualSize, KNullDesC8, buf);
|
|
337 |
|
|
338 |
if (err)
|
|
339 |
{
|
|
340 |
__ALFLOGSTRING1( "CAlfVisual::Size panic error %d", err )
|
|
341 |
USER_INVARIANT();
|
|
342 |
}
|
|
343 |
|
|
344 |
return size;
|
|
345 |
}
|
|
346 |
|
|
347 |
// ---------------------------------------------------------------------------
|
|
348 |
// Sets the size of the visual.
|
|
349 |
// ---------------------------------------------------------------------------
|
|
350 |
//
|
|
351 |
EXPORT_C void CAlfVisual::SetSize(const TAlfRealSize& aSize, TInt aTransitionTime)
|
|
352 |
{
|
|
353 |
TAlfVisualSize size = { aSize, aTransitionTime };
|
|
354 |
|
|
355 |
TPckgC<TAlfVisualSize> buf(size);
|
|
356 |
TInt err = iData->iComms->DoCmdNoReply( EAlfVisualSetSize, buf );
|
|
357 |
|
|
358 |
if (err) // for now
|
|
359 |
{
|
|
360 |
__ALFLOGSTRING1( "CAlfVisual::SetSize panic error %d", err )
|
|
361 |
USER_INVARIANT();
|
|
362 |
}
|
|
363 |
}
|
|
364 |
|
|
365 |
// ---------------------------------------------------------------------------
|
|
366 |
//
|
|
367 |
// ---------------------------------------------------------------------------
|
|
368 |
//
|
|
369 |
EXPORT_C void CAlfVisual::SetFlag(TAlfVisualFlags aFlag)
|
|
370 |
{
|
|
371 |
TPckgC<TAlfVisualFlags> inBuf(aFlag);
|
|
372 |
TInt err = iData->iComms->DoCmdNoReply( EAlfVisualSetFlag, inBuf );
|
|
373 |
|
|
374 |
if (err) // for now
|
|
375 |
{
|
|
376 |
__ALFLOGSTRING1( "CAlfVisual::SetFlag panic error %d", err )
|
|
377 |
USER_INVARIANT();
|
|
378 |
}
|
|
379 |
|
|
380 |
if ( aFlag == EAlfVisualFlagLayoutUpdateNotification && !iData->iVisualOwnerNotification )
|
|
381 |
{
|
|
382 |
iData->iVisualOwnerNotification = new CAlfVisualOwnerNotification( *this );
|
|
383 |
__ASSERT_ALWAYS( iData->iVisualOwnerNotification , USER_INVARIANT() );
|
|
384 |
}
|
|
385 |
}
|
|
386 |
|
|
387 |
// ---------------------------------------------------------------------------
|
|
388 |
//
|
|
389 |
// ---------------------------------------------------------------------------
|
|
390 |
//
|
|
391 |
EXPORT_C void CAlfVisual::SetFlags(TUint aAnyFlags)
|
|
392 |
{
|
|
393 |
TPckgC<TUint> inBuf(aAnyFlags);
|
|
394 |
TInt err = iData->iComms->DoCmdNoReply( EAlfVisualSetFlags, inBuf );
|
|
395 |
|
|
396 |
if (err) // for now
|
|
397 |
{
|
|
398 |
__ALFLOGSTRING1( "CAlfVisual::SetFlags panic error %d", err )
|
|
399 |
USER_INVARIANT();
|
|
400 |
}
|
|
401 |
|
|
402 |
if ( aAnyFlags & EAlfVisualFlagLayoutUpdateNotification && !iData->iVisualOwnerNotification )
|
|
403 |
{
|
|
404 |
iData->iVisualOwnerNotification = new CAlfVisualOwnerNotification( *this );
|
|
405 |
__ASSERT_ALWAYS( iData->iVisualOwnerNotification , USER_INVARIANT() );
|
|
406 |
}
|
|
407 |
}
|
|
408 |
|
|
409 |
// ---------------------------------------------------------------------------
|
|
410 |
//
|
|
411 |
// ---------------------------------------------------------------------------
|
|
412 |
//
|
|
413 |
EXPORT_C void CAlfVisual::ClearFlag(TAlfVisualFlags aFlag)
|
|
414 |
{
|
|
415 |
TPckgC<TAlfVisualFlags> inBuf(aFlag);
|
|
416 |
TInt err = iData->iComms->DoCmdNoReply( EAlfVisualClearFlag, inBuf );
|
|
417 |
|
|
418 |
if (err) // for now
|
|
419 |
{
|
|
420 |
__ALFLOGSTRING1( "CAlfVisual::ClearFlag panic error %d", err )
|
|
421 |
USER_INVARIANT();
|
|
422 |
}
|
|
423 |
|
|
424 |
if ( aFlag == EAlfVisualFlagLayoutUpdateNotification && iData->iVisualOwnerNotification )
|
|
425 |
{
|
|
426 |
delete iData->iVisualOwnerNotification;
|
|
427 |
iData->iVisualOwnerNotification = NULL;
|
|
428 |
}
|
|
429 |
}
|
|
430 |
|
|
431 |
// ---------------------------------------------------------------------------
|
|
432 |
//
|
|
433 |
// ---------------------------------------------------------------------------
|
|
434 |
//
|
|
435 |
EXPORT_C void CAlfVisual::ClearFlags(TUint aAnyFlags)
|
|
436 |
{
|
|
437 |
TPckgC<TUint> inBuf(aAnyFlags);
|
|
438 |
TInt err = iData->iComms->DoCmdNoReply( EAlfVisualClearFlags, inBuf );
|
|
439 |
|
|
440 |
if (err) // for now
|
|
441 |
{
|
|
442 |
__ALFLOGSTRING1( "CAlfVisual::ClearFlags panic error %d", err )
|
|
443 |
USER_INVARIANT();
|
|
444 |
}
|
|
445 |
|
|
446 |
if ( aAnyFlags & EAlfVisualFlagLayoutUpdateNotification && iData->iVisualOwnerNotification )
|
|
447 |
{
|
|
448 |
delete iData->iVisualOwnerNotification;
|
|
449 |
iData->iVisualOwnerNotification = NULL;
|
|
450 |
}
|
|
451 |
}
|
|
452 |
|
|
453 |
// ---------------------------------------------------------------------------
|
|
454 |
//
|
|
455 |
// ---------------------------------------------------------------------------
|
|
456 |
//
|
|
457 |
EXPORT_C TUint CAlfVisual::Flags() const
|
|
458 |
{
|
|
459 |
TUint flags = 0;
|
|
460 |
TPckg<TUint> outBuf(flags);
|
|
461 |
TInt err = iData->iComms->DoSynchronousCmd( EAlfVisualFlags, KNullDesC8, outBuf);
|
|
462 |
|
|
463 |
if (err)
|
|
464 |
{
|
|
465 |
__ALFLOGSTRING1( "CAlfVisual::Flags panic error %d", err )
|
|
466 |
USER_INVARIANT();
|
|
467 |
}
|
|
468 |
|
|
469 |
return flags;
|
|
470 |
}
|
|
471 |
|
|
472 |
// ---------------------------------------------------------------------------
|
|
473 |
// Returns layout
|
|
474 |
// ---------------------------------------------------------------------------
|
|
475 |
//
|
|
476 |
EXPORT_C CAlfLayout* CAlfVisual::Layout() const
|
|
477 |
{
|
|
478 |
return iData->iLayout;
|
|
479 |
}
|
|
480 |
|
|
481 |
// ---------------------------------------------------------------------------
|
|
482 |
// Returns env.
|
|
483 |
// ---------------------------------------------------------------------------
|
|
484 |
//
|
|
485 |
EXPORT_C CAlfEnv& CAlfVisual::Env() const
|
|
486 |
{
|
|
487 |
if (!iData || !iData->iOwner) // try to save what there's left to save
|
|
488 |
{
|
|
489 |
return CAlfStatic::Env();
|
|
490 |
}
|
|
491 |
|
|
492 |
return iData->iOwner->Env();
|
|
493 |
}
|
|
494 |
|
|
495 |
// ---------------------------------------------------------------------------
|
|
496 |
// Returns tag.
|
|
497 |
// ---------------------------------------------------------------------------
|
|
498 |
//
|
|
499 |
EXPORT_C const TDesC8& CAlfVisual::Tag() const
|
|
500 |
{
|
|
501 |
if(iData && iData->iTag)
|
|
502 |
{
|
|
503 |
return *iData->iTag;
|
|
504 |
}
|
|
505 |
|
|
506 |
return KNullDesC8;
|
|
507 |
}
|
|
508 |
|
|
509 |
// ---------------------------------------------------------------------------
|
|
510 |
// Returns display
|
|
511 |
// ---------------------------------------------------------------------------
|
|
512 |
//
|
|
513 |
EXPORT_C CAlfDisplay* CAlfVisual::Display() const
|
|
514 |
{
|
|
515 |
const CAlfVisual* iter = this;
|
|
516 |
|
|
517 |
while(iter)
|
|
518 |
{
|
|
519 |
if(iter->iData->iDisplay)
|
|
520 |
{
|
|
521 |
return iter->iData->iDisplay;
|
|
522 |
}
|
|
523 |
iter = iter->Layout();
|
|
524 |
}
|
|
525 |
|
|
526 |
// Not shown on any display.
|
|
527 |
return NULL;
|
|
528 |
}
|
|
529 |
|
|
530 |
// ---------------------------------------------------------------------------
|
|
531 |
// Update child layout to the server
|
|
532 |
// ---------------------------------------------------------------------------
|
|
533 |
//
|
|
534 |
EXPORT_C void CAlfVisual::UpdateChildrenLayout(TInt aTransitionTime)
|
|
535 |
{
|
|
536 |
TPckgC<TInt> buf(aTransitionTime);
|
|
537 |
TBuf8<1> dum;
|
|
538 |
|
|
539 |
TInt err = iData->iComms->DoSynchronousCmd( EAlfVisualUpdateChildrenLayout, buf, dum);
|
|
540 |
|
|
541 |
if (err) // for now
|
|
542 |
{
|
|
543 |
__ALFLOGSTRING1( "CAlfVisual::UpdateChildrenLayout panic error %d", err )
|
|
544 |
USER_INVARIANT();
|
|
545 |
}
|
|
546 |
}
|
|
547 |
|
|
548 |
// ---------------------------------------------------------------------------
|
|
549 |
// Enables brush usage.
|
|
550 |
// ---------------------------------------------------------------------------
|
|
551 |
//
|
|
552 |
EXPORT_C void CAlfVisual::EnableBrushesL(TBool aEnabled)
|
|
553 |
{
|
|
554 |
if(aEnabled && !iData->iBrushes)
|
|
555 |
{
|
|
556 |
iData->iBrushes = CAlfBrushArray::NewL(*this);
|
|
557 |
}
|
|
558 |
else if(!aEnabled && iData->iBrushes)
|
|
559 |
{
|
|
560 |
delete iData->iBrushes;
|
|
561 |
iData->iBrushes = NULL;
|
|
562 |
}
|
|
563 |
else
|
|
564 |
{
|
|
565 |
// for PC lint
|
|
566 |
}
|
|
567 |
}
|
|
568 |
|
|
569 |
// ---------------------------------------------------------------------------
|
|
570 |
// Returns brush array
|
|
571 |
// ---------------------------------------------------------------------------
|
|
572 |
//
|
|
573 |
EXPORT_C CAlfBrushArray* CAlfVisual::Brushes()
|
|
574 |
{
|
|
575 |
return iData->iBrushes;
|
|
576 |
}
|
|
577 |
|
|
578 |
// ---------------------------------------------------------------------------
|
|
579 |
// Converts point.
|
|
580 |
// ---------------------------------------------------------------------------
|
|
581 |
//
|
|
582 |
EXPORT_C TPoint CAlfVisual::LocalToDisplay(const TPoint& aPoint) const
|
|
583 |
{
|
|
584 |
const TAlfRealPoint realPoint = LocalToDisplay(TAlfRealPoint(aPoint));
|
|
585 |
return TPoint( AlfUtil::RoundFloatToInt( realPoint.iX ),AlfUtil::RoundFloatToInt( realPoint.iY ) );
|
|
586 |
}
|
|
587 |
|
|
588 |
// ---------------------------------------------------------------------------
|
|
589 |
// Converts point.
|
|
590 |
// ---------------------------------------------------------------------------
|
|
591 |
//
|
|
592 |
EXPORT_C TAlfRealPoint CAlfVisual::LocalToDisplay(
|
|
593 |
const TAlfRealPoint& aPoint) const
|
|
594 |
{
|
|
595 |
TPckgC<TAlfRealPoint> pointPckg(aPoint);
|
|
596 |
TAlfRealPoint result;
|
|
597 |
TPckg<TAlfRealPoint> resultPckg(result);
|
|
598 |
|
|
599 |
TInt err = iData->iComms->DoSynchronousCmd(EAlfVisualLocalToDisplay, pointPckg, resultPckg);
|
|
600 |
if ( err != KErrNone )
|
|
601 |
{
|
|
602 |
__ALFLOGSTRING1( "CAlfVisual::LocalToDisplay panic error %d", err )
|
|
603 |
USER_INVARIANT();
|
|
604 |
}
|
|
605 |
|
|
606 |
return result;
|
|
607 |
}
|
|
608 |
|
|
609 |
// ---------------------------------------------------------------------------
|
|
610 |
// Converts point.
|
|
611 |
// ---------------------------------------------------------------------------
|
|
612 |
//
|
|
613 |
EXPORT_C TPoint CAlfVisual::DisplayToLocal(const TPoint& aPoint) const
|
|
614 |
{
|
|
615 |
const TAlfRealPoint realPoint = DisplayToLocal(TAlfRealPoint(aPoint));
|
|
616 |
return TPoint( AlfUtil::RoundFloatToInt( realPoint.iX ),AlfUtil::RoundFloatToInt( realPoint.iY ) );
|
|
617 |
}
|
|
618 |
|
|
619 |
// ---------------------------------------------------------------------------
|
|
620 |
// Converts point.
|
|
621 |
// ---------------------------------------------------------------------------
|
|
622 |
//
|
|
623 |
EXPORT_C TAlfRealPoint CAlfVisual::DisplayToLocal(const TAlfRealPoint& aPoint) const
|
|
624 |
{
|
|
625 |
TPckgC<TAlfRealPoint> pointPckg(aPoint);
|
|
626 |
TAlfRealPoint result;
|
|
627 |
TPckg<TAlfRealPoint> resultPckg(result);
|
|
628 |
|
|
629 |
TInt err = iData->iComms->DoSynchronousCmd(EAlfVisualDisplayToLocal, pointPckg, resultPckg);
|
|
630 |
|
|
631 |
if ( err != KErrNone )
|
|
632 |
{
|
|
633 |
__ALFLOGSTRING1( "CAlfVisual::DisplayToLocal panic error %d", err )
|
|
634 |
USER_INVARIANT();
|
|
635 |
}
|
|
636 |
|
|
637 |
return result;
|
|
638 |
}
|
|
639 |
|
|
640 |
// ---------------------------------------------------------------------------
|
|
641 |
// Gets display rect
|
|
642 |
// ---------------------------------------------------------------------------
|
|
643 |
//
|
|
644 |
EXPORT_C TAlfRealRect CAlfVisual::DisplayRectTarget() const
|
|
645 |
{
|
|
646 |
TAlfRealRect rect;
|
|
647 |
TPckg<TAlfRealRect> rectPckg(rect);
|
|
648 |
|
|
649 |
TInt err = iData->iComms->DoSynchronousCmd(EAlfVisualDisplayRectTarget, KNullDesC8, rectPckg);
|
|
650 |
|
|
651 |
if ( err != KErrNone )
|
|
652 |
{
|
|
653 |
__ALFLOGSTRING1( "CAlfVisual::DisplayRectTarget panic error %d", err )
|
|
654 |
USER_INVARIANT();
|
|
655 |
}
|
|
656 |
|
|
657 |
return rect;
|
|
658 |
}
|
|
659 |
|
|
660 |
// ---------------------------------------------------------------------------
|
|
661 |
// Moves visual to front.
|
|
662 |
// ---------------------------------------------------------------------------
|
|
663 |
//
|
|
664 |
EXPORT_C void CAlfVisual::MoveToFront( TInt aTransitionTime )
|
|
665 |
{
|
|
666 |
if (iData->iLayout)
|
|
667 |
{
|
|
668 |
iData->iLayout->MoveVisualToFront(*this, aTransitionTime);
|
|
669 |
}
|
|
670 |
}
|
|
671 |
|
|
672 |
// ---------------------------------------------------------------------------
|
|
673 |
// Enables transformation.
|
|
674 |
// ---------------------------------------------------------------------------
|
|
675 |
//
|
|
676 |
EXPORT_C void CAlfVisual::EnableTransformationL(TBool aIsTransformed)
|
|
677 |
{
|
|
678 |
if ( aIsTransformed && iData->iTransform )
|
|
679 |
{
|
|
680 |
// Already enabled
|
|
681 |
return;
|
|
682 |
}
|
|
683 |
|
|
684 |
if ( !aIsTransformed && !iData->iTransform )
|
|
685 |
{
|
|
686 |
// Already disabled
|
|
687 |
return;
|
|
688 |
}
|
|
689 |
|
|
690 |
if ( aIsTransformed )
|
|
691 |
{
|
|
692 |
iData->iTransform = CAlfTransformation::NewL( Env() );
|
|
693 |
}
|
|
694 |
|
|
695 |
// use the server handle from the transformation object if present
|
|
696 |
TInt transformationHandle =
|
|
697 |
iData->iTransform ?
|
|
698 |
iData->iTransform->ServerHandle() :
|
|
699 |
0 ;
|
|
700 |
|
|
701 |
TInt2 inData(transformationHandle,aIsTransformed);
|
|
702 |
TPckgC<TInt2> inPckg(inData);
|
|
703 |
|
|
704 |
TBuf8<1> outDum;
|
|
705 |
|
|
706 |
TInt err = iData->iComms->DoSynchronousCmd(EAlfVisualEnableTransformation, inPckg, outDum);
|
|
707 |
|
|
708 |
if ( err == KErrNone && !aIsTransformed )
|
|
709 |
{
|
|
710 |
delete iData->iTransform;
|
|
711 |
iData->iTransform = NULL;
|
|
712 |
}
|
|
713 |
|
|
714 |
if ( err != KErrNone )
|
|
715 |
{
|
|
716 |
__ALFLOGSTRING1( "CAlfVisual::EnableTransformationL leave error %d", err )
|
|
717 |
delete iData->iTransform;
|
|
718 |
iData->iTransform = NULL;
|
|
719 |
User::Leave( err );
|
|
720 |
}
|
|
721 |
}
|
|
722 |
|
|
723 |
// ---------------------------------------------------------------------------
|
|
724 |
// Returns transformation
|
|
725 |
// ---------------------------------------------------------------------------
|
|
726 |
//
|
|
727 |
EXPORT_C CAlfTransformation& CAlfVisual::Transformation()
|
|
728 |
{
|
|
729 |
__ASSERT_ALWAYS( iData->iTransform, USER_INVARIANT() );
|
|
730 |
return *iData->iTransform;
|
|
731 |
}
|
|
732 |
|
|
733 |
|
|
734 |
|
|
735 |
// ---------------------------------------------------------------------------
|
|
736 |
//
|
|
737 |
// ---------------------------------------------------------------------------
|
|
738 |
//
|
|
739 |
EXPORT_C void CAlfVisual::SetPadding(TInt aPadding)
|
|
740 |
{
|
|
741 |
TPckgC<TInt> inBuf(aPadding);
|
|
742 |
TInt err = iData->iComms->DoCmdNoReply( EAlfVisualSetPaddingInt, inBuf );
|
|
743 |
|
|
744 |
if (err) // for now
|
|
745 |
{
|
|
746 |
__ALFLOGSTRING1( "CAlfVisual::SetPadding panic error %d", err )
|
|
747 |
USER_INVARIANT();
|
|
748 |
}
|
|
749 |
|
|
750 |
iData->iPadding = TAlfBoxMetric(TAlfMetric(aPadding));
|
|
751 |
}
|
|
752 |
|
|
753 |
// ---------------------------------------------------------------------------
|
|
754 |
//
|
|
755 |
// ---------------------------------------------------------------------------
|
|
756 |
//
|
|
757 |
EXPORT_C void CAlfVisual::SetPadding(const TPoint& aPadding)
|
|
758 |
{
|
|
759 |
TPckgC<TPoint> inBuf(aPadding);
|
|
760 |
TInt err = iData->iComms->DoCmdNoReply( EAlfVisualSetPaddingPoint, inBuf );
|
|
761 |
|
|
762 |
if (err) // for now
|
|
763 |
{
|
|
764 |
__ALFLOGSTRING1( "CAlfVisual::SetPadding panic error %d", err )
|
|
765 |
USER_INVARIANT();
|
|
766 |
}
|
|
767 |
|
|
768 |
iData->iPadding = TAlfBoxMetric(TAlfXYMetric(TAlfMetric(aPadding.iX), TAlfMetric(aPadding.iY)));
|
|
769 |
}
|
|
770 |
|
|
771 |
// ---------------------------------------------------------------------------
|
|
772 |
//
|
|
773 |
// ---------------------------------------------------------------------------
|
|
774 |
//
|
|
775 |
EXPORT_C void CAlfVisual::SetPadding(const TAlfBoxMetric& aPadding)
|
|
776 |
{
|
|
777 |
TPckgC<TAlfBoxMetric> inBuf(aPadding);
|
|
778 |
TInt err = iData->iComms->DoCmdNoReply( EAlfVisualSetPaddingBox, inBuf );
|
|
779 |
|
|
780 |
if (err) // for now
|
|
781 |
{
|
|
782 |
__ALFLOGSTRING1( "CAlfVisual::SetPadding panic error %d", err )
|
|
783 |
USER_INVARIANT();
|
|
784 |
}
|
|
785 |
|
|
786 |
iData->iPadding = aPadding;
|
|
787 |
}
|
|
788 |
|
|
789 |
|
|
790 |
// ---------------------------------------------------------------------------
|
|
791 |
//
|
|
792 |
// ---------------------------------------------------------------------------
|
|
793 |
//
|
|
794 |
EXPORT_C TAlfRealRect CAlfVisual::PaddingInPixels() const
|
|
795 |
{
|
|
796 |
TBufC8<1> inDum;
|
|
797 |
TAlfRealRect value;
|
|
798 |
TPckg<TAlfRealRect> outBuf(value);
|
|
799 |
TInt err = Comms()->DoSynchronousCmd(EAlfVisualPaddingInPixels, inDum, outBuf);
|
|
800 |
|
|
801 |
if ( err )
|
|
802 |
{
|
|
803 |
__ALFLOGSTRING1( "CAlfVisual::DisplayRect ignore error %d", err )
|
|
804 |
}
|
|
805 |
|
|
806 |
return value;
|
|
807 |
}
|
|
808 |
|
|
809 |
|
|
810 |
// ---------------------------------------------------------------------------
|
|
811 |
//
|
|
812 |
// ---------------------------------------------------------------------------
|
|
813 |
//
|
|
814 |
EXPORT_C void CAlfVisual::SetTagL(const TDesC8& aTag)
|
|
815 |
{
|
|
816 |
ASSERT(iData);
|
|
817 |
|
|
818 |
delete iData->iTag;
|
|
819 |
iData->iTag = 0;
|
|
820 |
|
|
821 |
iData->iTag = aTag.AllocL();
|
|
822 |
}
|
|
823 |
|
|
824 |
// ---------------------------------------------------------------------------
|
|
825 |
//
|
|
826 |
// ---------------------------------------------------------------------------
|
|
827 |
//
|
|
828 |
EXPORT_C TBool CAlfVisual::IsTagged() const
|
|
829 |
{
|
|
830 |
return (iData && iData->iTag);
|
|
831 |
}
|
|
832 |
|
|
833 |
// ---------------------------------------------------------------------------
|
|
834 |
//
|
|
835 |
// ---------------------------------------------------------------------------
|
|
836 |
//
|
|
837 |
EXPORT_C CAlfVisual* CAlfVisual::FindTag(const TDesC8& aTag)
|
|
838 |
{
|
|
839 |
// Look for the tag in this visual's tag descriptor.
|
|
840 |
if(iData && iData->iTag && TagMatches(aTag))
|
|
841 |
{
|
|
842 |
return this;
|
|
843 |
}
|
|
844 |
else
|
|
845 |
{
|
|
846 |
// Could not find it.
|
|
847 |
return NULL;
|
|
848 |
}
|
|
849 |
}
|
|
850 |
|
|
851 |
// ---------------------------------------------------------------------------
|
|
852 |
// Returns comms module for accessing the client-server APIs.
|
|
853 |
// ---------------------------------------------------------------------------
|
|
854 |
//
|
|
855 |
EXPORT_C CAlfGenComponent* CAlfVisual::Comms() const
|
|
856 |
{
|
|
857 |
ASSERT(iData);
|
|
858 |
return iData->iComms;
|
|
859 |
}
|
|
860 |
|
|
861 |
// ---------------------------------------------------------------------------
|
|
862 |
//
|
|
863 |
// ---------------------------------------------------------------------------
|
|
864 |
//
|
|
865 |
TBool CAlfVisual::TagMatches(const TDesC8& aTag) const
|
|
866 |
{
|
|
867 |
if(!aTag.Length() || !iData || !iData->iTag )
|
|
868 |
{
|
|
869 |
// No tag specified; doesn't match anything.
|
|
870 |
return EFalse;
|
|
871 |
}
|
|
872 |
|
|
873 |
TPtrC8 region = iData->iTag->Des();
|
|
874 |
TPtrC8 tag;
|
|
875 |
TInt index = 0;
|
|
876 |
|
|
877 |
while(region.Length() > 0)
|
|
878 |
{
|
|
879 |
// Is there a colon in the region?
|
|
880 |
index = region.Locate(KAlfTagSeparator);
|
|
881 |
if(index != KErrNotFound)
|
|
882 |
{
|
|
883 |
// A separator exists in the region.
|
|
884 |
tag.Set(region.Left(index));
|
|
885 |
region.Set(region.Right(region.Length() - index - 1));
|
|
886 |
}
|
|
887 |
else
|
|
888 |
{
|
|
889 |
tag.Set(region);
|
|
890 |
region.Set(region.Right(0));
|
|
891 |
}
|
|
892 |
|
|
893 |
if(!tag.Compare(aTag))
|
|
894 |
{
|
|
895 |
// Matches.
|
|
896 |
return ETrue;
|
|
897 |
}
|
|
898 |
}
|
|
899 |
|
|
900 |
// No match could be found.
|
|
901 |
return EFalse;
|
|
902 |
}
|
|
903 |
|
|
904 |
// ---------------------------------------------------------------------------
|
|
905 |
//
|
|
906 |
// ---------------------------------------------------------------------------
|
|
907 |
//
|
|
908 |
EXPORT_C TAlfTimedValue CAlfVisual::DepthOffset() const
|
|
909 |
{
|
|
910 |
TBufC8<1> inDum;
|
|
911 |
TAlfTimedValue value;
|
|
912 |
TPckg<TAlfTimedValue> outBuf(value);
|
|
913 |
TInt err = Comms()->DoSynchronousCmd(EAlfVisualDepthOffset, inDum,
|
|
914 |
outBuf);
|
|
915 |
|
|
916 |
if ( err )
|
|
917 |
{
|
|
918 |
__ALFLOGSTRING1( "CAlfVisual::DepthOffset ignore error %d", err )
|
|
919 |
}
|
|
920 |
return value;
|
|
921 |
}
|
|
922 |
|
|
923 |
// ---------------------------------------------------------------------------
|
|
924 |
//
|
|
925 |
// ---------------------------------------------------------------------------
|
|
926 |
//
|
|
927 |
EXPORT_C void CAlfVisual::SetDepthOffset(const TAlfTimedValue& aDepthOffset)
|
|
928 |
{
|
|
929 |
TPckgC<TAlfTimedValue> inPckg(aDepthOffset);
|
|
930 |
TInt err = Comms()->DoCmdNoReply(EAlfVisualSetDepthOffset, inPckg );
|
|
931 |
|
|
932 |
if ( err )
|
|
933 |
{
|
|
934 |
__ALFLOGSTRING1( "CAlfVisual::SetDepthOffset ignore error %d", err )
|
|
935 |
}
|
|
936 |
}
|
|
937 |
|
|
938 |
// ---------------------------------------------------------------------------
|
|
939 |
//
|
|
940 |
// ---------------------------------------------------------------------------
|
|
941 |
//
|
|
942 |
EXPORT_C CAlfControl& CAlfVisual::Owner() const
|
|
943 |
{
|
|
944 |
return *iData->iOwner;
|
|
945 |
}
|
|
946 |
|
|
947 |
// ---------------------------------------------------------------------------
|
|
948 |
//
|
|
949 |
// ---------------------------------------------------------------------------
|
|
950 |
//
|
|
951 |
EXPORT_C void CAlfVisual::SetOwner(CAlfControl& aOwner)
|
|
952 |
{
|
|
953 |
iData->iOwner = &aOwner;
|
|
954 |
}
|
|
955 |
|
|
956 |
// ---------------------------------------------------------------------------
|
|
957 |
//
|
|
958 |
// ---------------------------------------------------------------------------
|
|
959 |
//
|
|
960 |
EXPORT_C void CAlfVisual::SetOrigin(TAlfVisualHOrigin aHoriz,
|
|
961 |
TAlfVisualVOrigin aVert)
|
|
962 |
{
|
|
963 |
ClearFlags(EAlfVisualFlagHOriginCenter | EAlfVisualFlagHOriginRight);
|
|
964 |
switch(aHoriz)
|
|
965 |
{
|
|
966 |
case EAlfVisualHOriginCenter:
|
|
967 |
SetFlag(EAlfVisualFlagHOriginCenter);
|
|
968 |
break;
|
|
969 |
|
|
970 |
case EAlfVisualHOriginRight:
|
|
971 |
SetFlag(EAlfVisualFlagHOriginRight);
|
|
972 |
break;
|
|
973 |
|
|
974 |
default:
|
|
975 |
break;
|
|
976 |
}
|
|
977 |
|
|
978 |
ClearFlags(EAlfVisualFlagVOriginCenter | EAlfVisualFlagVOriginBottom);
|
|
979 |
switch(aVert)
|
|
980 |
{
|
|
981 |
case EAlfVisualVOriginCenter:
|
|
982 |
SetFlag(EAlfVisualFlagVOriginCenter);
|
|
983 |
break;
|
|
984 |
|
|
985 |
case EAlfVisualVOriginBottom:
|
|
986 |
SetFlag(EAlfVisualFlagVOriginBottom);
|
|
987 |
break;
|
|
988 |
|
|
989 |
default:
|
|
990 |
break;
|
|
991 |
}
|
|
992 |
}
|
|
993 |
|
|
994 |
// ---------------------------------------------------------------------------
|
|
995 |
//
|
|
996 |
// ---------------------------------------------------------------------------
|
|
997 |
//
|
|
998 |
EXPORT_C TAlfVisualHOrigin CAlfVisual::HorizontalOrigin() const
|
|
999 |
{
|
|
1000 |
TUint flags = Flags();
|
|
1001 |
if(flags & EAlfVisualFlagHOriginCenter)
|
|
1002 |
{
|
|
1003 |
return EAlfVisualHOriginCenter;
|
|
1004 |
}
|
|
1005 |
if(flags & EAlfVisualFlagHOriginRight)
|
|
1006 |
{
|
|
1007 |
return EAlfVisualHOriginRight;
|
|
1008 |
}
|
|
1009 |
return EAlfVisualHOriginLeft;
|
|
1010 |
}
|
|
1011 |
|
|
1012 |
// ---------------------------------------------------------------------------
|
|
1013 |
//
|
|
1014 |
// ---------------------------------------------------------------------------
|
|
1015 |
//
|
|
1016 |
EXPORT_C TAlfVisualVOrigin CAlfVisual::VerticalOrigin() const
|
|
1017 |
{
|
|
1018 |
TUint flags = Flags();
|
|
1019 |
if(flags & EAlfVisualFlagVOriginCenter)
|
|
1020 |
{
|
|
1021 |
return EAlfVisualVOriginCenter;
|
|
1022 |
}
|
|
1023 |
if(flags & EAlfVisualFlagVOriginBottom)
|
|
1024 |
{
|
|
1025 |
return EAlfVisualVOriginBottom;
|
|
1026 |
}
|
|
1027 |
return EAlfVisualVOriginTop;
|
|
1028 |
}
|
|
1029 |
|
|
1030 |
// ---------------------------------------------------------------------------
|
|
1031 |
//
|
|
1032 |
// ---------------------------------------------------------------------------
|
|
1033 |
//
|
|
1034 |
EXPORT_C void CAlfVisual::AlignByOrigin(TAlfRealRect& aRect) const
|
|
1035 |
{
|
|
1036 |
switch(HorizontalOrigin())
|
|
1037 |
{
|
|
1038 |
case EAlfVisualHOriginCenter:
|
|
1039 |
aRect.Move(-aRect.Width()/2.0, 0.0);
|
|
1040 |
break;
|
|
1041 |
|
|
1042 |
case EAlfVisualHOriginRight:
|
|
1043 |
aRect.Move(-aRect.Width(), 0.0);
|
|
1044 |
break;
|
|
1045 |
|
|
1046 |
default:
|
|
1047 |
break;
|
|
1048 |
}
|
|
1049 |
|
|
1050 |
switch(VerticalOrigin())
|
|
1051 |
{
|
|
1052 |
case EAlfVisualVOriginCenter:
|
|
1053 |
aRect.Move(0.0, -aRect.Height()/2.0);
|
|
1054 |
break;
|
|
1055 |
|
|
1056 |
case EAlfVisualVOriginBottom:
|
|
1057 |
aRect.Move(0.0, -aRect.Height());
|
|
1058 |
break;
|
|
1059 |
|
|
1060 |
default:
|
|
1061 |
break;
|
|
1062 |
}
|
|
1063 |
}
|
|
1064 |
|
|
1065 |
// ---------------------------------------------------------------------------
|
|
1066 |
// deprecated
|
|
1067 |
// ---------------------------------------------------------------------------
|
|
1068 |
//
|
|
1069 |
EXPORT_C void CAlfVisual::SetMinSize(const TSize& aMinSize)
|
|
1070 |
{
|
|
1071 |
TPckgC<TSize> inPckg(aMinSize);
|
|
1072 |
TInt err = Comms()->DoCmdNoReply(EAlfVisualSetMinSize, inPckg );
|
|
1073 |
|
|
1074 |
if ( err )
|
|
1075 |
{
|
|
1076 |
__ALFLOGSTRING1( "CAlfVisual::SetMinSize ignore error %d", err )
|
|
1077 |
}
|
|
1078 |
}
|
|
1079 |
|
|
1080 |
// ---------------------------------------------------------------------------
|
|
1081 |
//
|
|
1082 |
// ---------------------------------------------------------------------------
|
|
1083 |
//
|
|
1084 |
EXPORT_C void CAlfVisual::SetMinSize(const TAlfRealSize& aMinSize)
|
|
1085 |
{
|
|
1086 |
TPckgC<TAlfRealSize> inPckg(aMinSize);
|
|
1087 |
TInt err = Comms()->DoCmdNoReply(EAlfVisualSetMinSizeInBaseUnits, inPckg );
|
|
1088 |
|
|
1089 |
if ( err )
|
|
1090 |
{
|
|
1091 |
__ALFLOGSTRING1( "CAlfVisual::SetMinSize ignore error %d", err )
|
|
1092 |
}
|
|
1093 |
}
|
|
1094 |
|
|
1095 |
|
|
1096 |
// ---------------------------------------------------------------------------
|
|
1097 |
// deprecated
|
|
1098 |
// ---------------------------------------------------------------------------
|
|
1099 |
//
|
|
1100 |
EXPORT_C TSize CAlfVisual::MinSize() const
|
|
1101 |
{
|
|
1102 |
TBufC8<1> inDum;
|
|
1103 |
TSize value;
|
|
1104 |
TPckg<TSize> outBuf(value);
|
|
1105 |
TInt err = Comms()->DoSynchronousCmd(EAlfVisualGetMinSize, inDum,
|
|
1106 |
outBuf);
|
|
1107 |
|
|
1108 |
if ( err )
|
|
1109 |
{
|
|
1110 |
__ALFLOGSTRING1( "CAlfVisual::MinSize ignore error %d", err )
|
|
1111 |
}
|
|
1112 |
|
|
1113 |
return value;
|
|
1114 |
}
|
|
1115 |
|
|
1116 |
// ---------------------------------------------------------------------------
|
|
1117 |
//
|
|
1118 |
// ---------------------------------------------------------------------------
|
|
1119 |
//
|
|
1120 |
EXPORT_C TAlfRealSize CAlfVisual::MinSizeInBaseUnits() const
|
|
1121 |
{
|
|
1122 |
TBufC8<1> inDum;
|
|
1123 |
TAlfRealSize value;
|
|
1124 |
TPckg<TAlfRealSize> outBuf(value);
|
|
1125 |
TInt err = Comms()->DoSynchronousCmd(EAlfVisualGetMinSizeInBaseUnits, inDum,
|
|
1126 |
outBuf);
|
|
1127 |
|
|
1128 |
if ( err )
|
|
1129 |
{
|
|
1130 |
__ALFLOGSTRING1( "CAlfVisual::MinSizeInBaseUnit ignore error %d", err )
|
|
1131 |
}
|
|
1132 |
|
|
1133 |
return value;
|
|
1134 |
}
|
|
1135 |
|
|
1136 |
// ---------------------------------------------------------------------------
|
|
1137 |
// deprecated
|
|
1138 |
// ---------------------------------------------------------------------------
|
|
1139 |
//
|
|
1140 |
EXPORT_C void CAlfVisual::SetMaxSize(const TSize& aMaxSize)
|
|
1141 |
{
|
|
1142 |
TPckgC<TSize> inPckg(aMaxSize);
|
|
1143 |
TInt err = Comms()->DoCmdNoReply(EAlfVisualSetMaxSize, inPckg);
|
|
1144 |
|
|
1145 |
if ( err )
|
|
1146 |
{
|
|
1147 |
__ALFLOGSTRING1( "CAlfVisual::SetMaxSize ignore error %d", err )
|
|
1148 |
}
|
|
1149 |
}
|
|
1150 |
|
|
1151 |
// ---------------------------------------------------------------------------
|
|
1152 |
//
|
|
1153 |
// ---------------------------------------------------------------------------
|
|
1154 |
//
|
|
1155 |
EXPORT_C void CAlfVisual::SetMaxSize(const TAlfRealSize& aMaxSize)
|
|
1156 |
{
|
|
1157 |
TPckgC<TAlfRealSize> inPckg(aMaxSize);
|
|
1158 |
TInt err = Comms()->DoCmdNoReply(EAlfVisualSetMaxSizeInBaseUnits, inPckg);
|
|
1159 |
|
|
1160 |
if ( err )
|
|
1161 |
{
|
|
1162 |
__ALFLOGSTRING1( "CAlfVisual::SetMaxSize ignore error %d", err )
|
|
1163 |
}
|
|
1164 |
}
|
|
1165 |
|
|
1166 |
// ---------------------------------------------------------------------------
|
|
1167 |
// deprecated
|
|
1168 |
// ---------------------------------------------------------------------------
|
|
1169 |
//
|
|
1170 |
EXPORT_C TSize CAlfVisual::MaxSize() const
|
|
1171 |
{
|
|
1172 |
TBufC8<1> inDum;
|
|
1173 |
TSize value;
|
|
1174 |
TPckg<TSize> outBuf(value);
|
|
1175 |
TInt err = Comms()->DoSynchronousCmd(EAlfVisualGetMaxSize, inDum,
|
|
1176 |
outBuf);
|
|
1177 |
|
|
1178 |
if ( err )
|
|
1179 |
{
|
|
1180 |
__ALFLOGSTRING1( "CAlfVisual::MaxSize ignore error %d", err )
|
|
1181 |
}
|
|
1182 |
|
|
1183 |
return value;
|
|
1184 |
}
|
|
1185 |
|
|
1186 |
// ---------------------------------------------------------------------------
|
|
1187 |
//
|
|
1188 |
// ---------------------------------------------------------------------------
|
|
1189 |
//
|
|
1190 |
EXPORT_C TAlfRealSize CAlfVisual::MaxSizeInBaseUnits() const
|
|
1191 |
{
|
|
1192 |
TBufC8<1> inDum;
|
|
1193 |
TAlfRealSize value;
|
|
1194 |
TPckg<TAlfRealSize> outBuf(value);
|
|
1195 |
TInt err = Comms()->DoSynchronousCmd(EAlfVisualGetMaxSizeInBaseUnits, inDum,
|
|
1196 |
outBuf);
|
|
1197 |
|
|
1198 |
if ( err )
|
|
1199 |
{
|
|
1200 |
__ALFLOGSTRING1( "CAlfVisual::MaxSizeInBaseUnits ignore error %d", err )
|
|
1201 |
}
|
|
1202 |
|
|
1203 |
return value;
|
|
1204 |
}
|
|
1205 |
|
|
1206 |
|
|
1207 |
// ---------------------------------------------------------------------------
|
|
1208 |
//
|
|
1209 |
// ---------------------------------------------------------------------------
|
|
1210 |
//
|
|
1211 |
EXPORT_C void CAlfVisual::SetRect(const TAlfRealRect& aRect, TInt aTransitionTime)
|
|
1212 |
{
|
|
1213 |
SetPos(aRect.iTl, aTransitionTime);
|
|
1214 |
SetSize(TAlfRealSize(aRect.Size().iWidth, aRect.Size().iHeight),
|
|
1215 |
aTransitionTime);
|
|
1216 |
}
|
|
1217 |
|
|
1218 |
// ---------------------------------------------------------------------------
|
|
1219 |
// deprecated
|
|
1220 |
// ---------------------------------------------------------------------------
|
|
1221 |
//
|
|
1222 |
EXPORT_C void CAlfVisual::Move(const TPoint& aOffset, TInt aTransitionTime)
|
|
1223 |
{
|
|
1224 |
TAlfTimedPoint pos = Pos();
|
|
1225 |
TReal32 xpos = pos.Target().iX + aOffset.iX;
|
|
1226 |
TReal32 ypos = pos.Target().iY + aOffset.iY;
|
|
1227 |
TAlfRealPoint newPos(xpos, ypos);
|
|
1228 |
SetPos(newPos, aTransitionTime);
|
|
1229 |
}
|
|
1230 |
|
|
1231 |
// ---------------------------------------------------------------------------
|
|
1232 |
//
|
|
1233 |
// ---------------------------------------------------------------------------
|
|
1234 |
//
|
|
1235 |
EXPORT_C void CAlfVisual::Move(const TAlfRealPoint& aOffset, TInt aTransitionTime)
|
|
1236 |
{
|
|
1237 |
TAlfVisualPos pos = { aOffset, aTransitionTime };
|
|
1238 |
|
|
1239 |
TPckgC<TAlfVisualPos> buf(pos);
|
|
1240 |
|
|
1241 |
TInt err = iData->iComms->DoCmdNoReply( EAlfVisualMove, buf );
|
|
1242 |
|
|
1243 |
if (err)
|
|
1244 |
{
|
|
1245 |
__ALFLOGSTRING1( "CAlfVisual::Move ignore error %d", err )
|
|
1246 |
}
|
|
1247 |
}
|
|
1248 |
|
|
1249 |
// ---------------------------------------------------------------------------
|
|
1250 |
//
|
|
1251 |
// ---------------------------------------------------------------------------
|
|
1252 |
//
|
|
1253 |
EXPORT_C void CAlfVisual::Mimic(CAlfVisual& aVisual, TInt aTransitionTime)
|
|
1254 |
{
|
|
1255 |
SetPos(aVisual.Pos().Target(), aTransitionTime);
|
|
1256 |
SetSize(aVisual.Size().Target(), aTransitionTime);
|
|
1257 |
}
|
|
1258 |
|
|
1259 |
// ---------------------------------------------------------------------------
|
|
1260 |
// deprecated
|
|
1261 |
// ---------------------------------------------------------------------------
|
|
1262 |
//
|
|
1263 |
EXPORT_C void CAlfVisual::SetCenteredPosAndSize(const TPoint& aCenterPoint,
|
|
1264 |
const TSize& aSize,
|
|
1265 |
TInt aTransitionTime)
|
|
1266 |
{
|
|
1267 |
SetPos(TPoint(aCenterPoint.iX - aSize.iWidth/2,
|
|
1268 |
aCenterPoint.iY - aSize.iHeight/2), aTransitionTime);
|
|
1269 |
SetSize(aSize, aTransitionTime);
|
|
1270 |
}
|
|
1271 |
|
|
1272 |
// ---------------------------------------------------------------------------
|
|
1273 |
//
|
|
1274 |
// ---------------------------------------------------------------------------
|
|
1275 |
//
|
|
1276 |
EXPORT_C void CAlfVisual::SetCenteredPosAndSize(const TAlfRealPoint& aCenterPoint,
|
|
1277 |
const TAlfRealSize& aSize,
|
|
1278 |
TInt aTransitionTime)
|
|
1279 |
{
|
|
1280 |
TAlfVisualPosSize posSize = { aCenterPoint, aSize, aTransitionTime };
|
|
1281 |
|
|
1282 |
TPckgC<TAlfVisualPosSize> buf(posSize);
|
|
1283 |
|
|
1284 |
TInt err = iData->iComms->DoCmdNoReply( EAlfVisualSetCenteredPosAndSize, buf);
|
|
1285 |
|
|
1286 |
if (err)
|
|
1287 |
{
|
|
1288 |
__ALFLOGSTRING1( "CAlfVisual::SetCenteredPosAndSize ignore error %d", err )
|
|
1289 |
}
|
|
1290 |
}
|
|
1291 |
|
|
1292 |
// ---------------------------------------------------------------------------
|
|
1293 |
//
|
|
1294 |
// ---------------------------------------------------------------------------
|
|
1295 |
//
|
|
1296 |
EXPORT_C TAlfRealRect CAlfVisual::DisplayRect() const
|
|
1297 |
{
|
|
1298 |
TBufC8<1> inDum;
|
|
1299 |
TAlfRealRect value;
|
|
1300 |
TPckg<TAlfRealRect> outBuf(value);
|
|
1301 |
TInt err = Comms()->DoSynchronousCmd(EAlfVisualDisplayRect, inDum, outBuf);
|
|
1302 |
|
|
1303 |
if ( err )
|
|
1304 |
{
|
|
1305 |
__ALFLOGSTRING1( "CAlfVisual::DisplayRect ignore error %d", err )
|
|
1306 |
}
|
|
1307 |
|
|
1308 |
return value;
|
|
1309 |
}
|
|
1310 |
|
|
1311 |
// ---------------------------------------------------------------------------
|
|
1312 |
//
|
|
1313 |
// ---------------------------------------------------------------------------
|
|
1314 |
//
|
|
1315 |
EXPORT_C TReal32 CAlfVisual::EffectiveOpacity() const __SOFTFP
|
|
1316 |
{
|
|
1317 |
// We could do this locally, but because Opacity()-method calls anyway
|
|
1318 |
// server we do one server call here instead of multiple Opacity()-calls.
|
|
1319 |
TBufC8<1> inDum;
|
|
1320 |
TReal32 value = 1.0;
|
|
1321 |
TPckg<TReal32> outBuf(value);
|
|
1322 |
TInt err = Comms()->DoSynchronousCmd(EAlfVisualEffectiveOpacity, inDum,
|
|
1323 |
outBuf);
|
|
1324 |
|
|
1325 |
if ( err )
|
|
1326 |
{
|
|
1327 |
__ALFLOGSTRING1( "CAlfVisual::EffectiveOpacity ignore error %d", err )
|
|
1328 |
}
|
|
1329 |
|
|
1330 |
return value;
|
|
1331 |
}
|
|
1332 |
|
|
1333 |
// ---------------------------------------------------------------------------
|
|
1334 |
//
|
|
1335 |
// ---------------------------------------------------------------------------
|
|
1336 |
//
|
|
1337 |
EXPORT_C void CAlfVisual::SetClipping(TBool aClipping)
|
|
1338 |
{
|
|
1339 |
if(aClipping)
|
|
1340 |
{
|
|
1341 |
SetFlag(EAlfVisualFlagClipping);
|
|
1342 |
}
|
|
1343 |
else
|
|
1344 |
{
|
|
1345 |
ClearFlag(EAlfVisualFlagClipping);
|
|
1346 |
}
|
|
1347 |
}
|
|
1348 |
|
|
1349 |
// ---------------------------------------------------------------------------
|
|
1350 |
//
|
|
1351 |
// ---------------------------------------------------------------------------
|
|
1352 |
//
|
|
1353 |
EXPORT_C TBool CAlfVisual::Clipping() const
|
|
1354 |
{
|
|
1355 |
return (Flags() & EAlfVisualFlagClipping) != 0;
|
|
1356 |
}
|
|
1357 |
|
|
1358 |
// ---------------------------------------------------------------------------
|
|
1359 |
//
|
|
1360 |
// ---------------------------------------------------------------------------
|
|
1361 |
//
|
|
1362 |
EXPORT_C TPoint CAlfVisual::Padding() const
|
|
1363 |
{
|
|
1364 |
AssertPaddingsWereSetUsingDeprecatedPixelAPIs(iData->iPadding);
|
|
1365 |
return TPoint(iData->iPadding.iLeft.iMagnitude, iData->iPadding.iTop.iMagnitude);
|
|
1366 |
}
|
|
1367 |
|
|
1368 |
// ---------------------------------------------------------------------------
|
|
1369 |
//
|
|
1370 |
// ---------------------------------------------------------------------------
|
|
1371 |
//
|
|
1372 |
EXPORT_C const TAlfBoxMetric& CAlfVisual::PaddingAsMetric() const
|
|
1373 |
{
|
|
1374 |
return iData->iPadding;
|
|
1375 |
}
|
|
1376 |
|
|
1377 |
// ---------------------------------------------------------------------------
|
|
1378 |
//
|
|
1379 |
// ---------------------------------------------------------------------------
|
|
1380 |
//
|
|
1381 |
EXPORT_C TInt CAlfVisual::HorizontalPadding() const
|
|
1382 |
{
|
|
1383 |
AssertPaddingsWereSetUsingDeprecatedPixelAPIs(iData->iPadding);
|
|
1384 |
return iData->iPadding.iLeft.iMagnitude;
|
|
1385 |
}
|
|
1386 |
|
|
1387 |
// ---------------------------------------------------------------------------
|
|
1388 |
//
|
|
1389 |
// ---------------------------------------------------------------------------
|
|
1390 |
//
|
|
1391 |
EXPORT_C TInt CAlfVisual::VerticalPadding() const
|
|
1392 |
{
|
|
1393 |
AssertPaddingsWereSetUsingDeprecatedPixelAPIs(iData->iPadding);
|
|
1394 |
return iData->iPadding.iTop.iMagnitude;
|
|
1395 |
}
|
|
1396 |
|
|
1397 |
// ---------------------------------------------------------------------------
|
|
1398 |
//
|
|
1399 |
// ---------------------------------------------------------------------------
|
|
1400 |
//
|
|
1401 |
void CAlfVisual::SetDisplay(CAlfDisplay* aDisplay)
|
|
1402 |
{
|
|
1403 |
iData->iDisplay = aDisplay;
|
|
1404 |
}
|
|
1405 |
|
|
1406 |
// ---------------------------------------------------------------------------
|
|
1407 |
//
|
|
1408 |
// ---------------------------------------------------------------------------
|
|
1409 |
//
|
|
1410 |
EXPORT_C void CAlfVisual::SetPos(const TAlfTimedPoint& aPos)
|
|
1411 |
{
|
|
1412 |
TPckgC<TAlfTimedPoint> buf(aPos);
|
|
1413 |
TInt err = iData->iComms->DoCmdNoReply( EAlfVisualSetPosTimed, buf);
|
|
1414 |
|
|
1415 |
if ( err != KErrNone )
|
|
1416 |
{
|
|
1417 |
__ALFLOGSTRING1( "CAlfVisual::SetPos panic error %d", err )
|
|
1418 |
USER_INVARIANT();
|
|
1419 |
}
|
|
1420 |
}
|
|
1421 |
|
|
1422 |
// ---------------------------------------------------------------------------
|
|
1423 |
//
|
|
1424 |
// ---------------------------------------------------------------------------
|
|
1425 |
//
|
|
1426 |
EXPORT_C void CAlfVisual::SetSize(const TAlfTimedPoint& aSize)
|
|
1427 |
{
|
|
1428 |
TPckgC<TAlfTimedPoint> buf(aSize);
|
|
1429 |
TInt err = iData->iComms->DoCmdNoReply( EAlfVisualSetSizeTimed, buf );
|
|
1430 |
|
|
1431 |
if ( err != KErrNone )
|
|
1432 |
{
|
|
1433 |
__ALFLOGSTRING1( "CAlfVisual::SetSize panic error %d", err )
|
|
1434 |
USER_INVARIANT();
|
|
1435 |
}
|
|
1436 |
}
|
|
1437 |
|
|
1438 |
// ---------------------------------------------------------------------------
|
|
1439 |
//
|
|
1440 |
// ---------------------------------------------------------------------------
|
|
1441 |
//
|
|
1442 |
EXPORT_C TInt CAlfVisual::CopyValues(const CAlfVisual& aVisual, TInt aBitmask, TInt aTransitionTime )
|
|
1443 |
{
|
|
1444 |
if (aVisual.Identifier())
|
|
1445 |
{
|
|
1446 |
return KErrArgument;
|
|
1447 |
}
|
|
1448 |
|
|
1449 |
TInt3 inData(aVisual.Identifier(),aBitmask,aTransitionTime);
|
|
1450 |
TPckgC<TInt3> inPckg(inData);
|
|
1451 |
TBuf8<1> dum;
|
|
1452 |
|
|
1453 |
return iData->iComms->DoSynchronousCmd( EAlfVisualCopyValuesFromOtherVisual, inPckg, dum );
|
|
1454 |
}
|
|
1455 |
|
|
1456 |
// ---------------------------------------------------------------------------
|
|
1457 |
// future proofing
|
|
1458 |
// ---------------------------------------------------------------------------
|
|
1459 |
//
|
|
1460 |
EXPORT_C void CAlfVisual::PropertyOwnerExtension(const TUid& aExtensionUid, TAny** aExtensionParams)
|
|
1461 |
{
|
|
1462 |
CAlfPropertyOwner::PropertyOwnerExtension(aExtensionUid,aExtensionParams);
|
|
1463 |
}
|
|
1464 |
|
|
1465 |
// ---------------------------------------------------------------------------
|
|
1466 |
//
|
|
1467 |
// ---------------------------------------------------------------------------
|
|
1468 |
//
|
|
1469 |
EXPORT_C void CAlfVisual::SetTactileFeedbackL( TInt aEventType, TInt aFeedbackType )
|
|
1470 |
{
|
|
1471 |
__ASSERT_ALWAYS( aFeedbackType >= 0, USER_INVARIANT() );
|
|
1472 |
__ASSERT_ALWAYS( aEventType >= 0, USER_INVARIANT() );
|
|
1473 |
|
|
1474 |
TInt2 inData(aEventType,aFeedbackType);
|
|
1475 |
TPckgC<TInt2> inPckg(inData);
|
|
1476 |
TBuf8<1> dum;
|
|
1477 |
|
|
1478 |
TInt err = iData->iComms->DoSynchronousCmd( EAlfVisualSetTactileFeedback, inPckg, dum );
|
|
1479 |
|
|
1480 |
if ( err != KErrNone )
|
|
1481 |
{
|
|
1482 |
__ALFLOGSTRING1( "CAlfVisual::SetTactileFeedbackL leave error %d", err )
|
|
1483 |
User::Leave( err );
|
|
1484 |
}
|
|
1485 |
}
|
|
1486 |
|
|
1487 |
// ---------------------------------------------------------------------------
|
|
1488 |
//
|
|
1489 |
// ---------------------------------------------------------------------------
|
|
1490 |
//
|
|
1491 |
EXPORT_C TBool CAlfVisual::HasTactileFeedback( TInt aEventType ) const
|
|
1492 |
{
|
|
1493 |
TInt inData(aEventType);
|
|
1494 |
TPckgC<TInt> inPckg(inData);
|
|
1495 |
|
|
1496 |
TBool answer = EFalse;
|
|
1497 |
TPckg<TBool> outPckg(answer);
|
|
1498 |
|
|
1499 |
TInt err = iData->iComms->DoSynchronousCmd( EAlfVisualHasTactileFeedback, inPckg, outPckg );
|
|
1500 |
if ( err != KErrNone )
|
|
1501 |
{
|
|
1502 |
__ALFLOGSTRING1( "CAlfVisual::HasTactileFeedback ignore error %d", err )
|
|
1503 |
}
|
|
1504 |
return answer;
|
|
1505 |
}
|
|
1506 |
|
|
1507 |
// ---------------------------------------------------------------------------
|
|
1508 |
//
|
|
1509 |
// ---------------------------------------------------------------------------
|
|
1510 |
//
|
|
1511 |
EXPORT_C void CAlfVisual::RemoveTactileFeedback( TInt aEventType )
|
|
1512 |
{
|
|
1513 |
TInt inData(aEventType);
|
|
1514 |
TPckgC<TInt> inPckg(inData);
|
|
1515 |
|
|
1516 |
TInt err = iData->iComms->DoCmdNoReply( EAlfVisualRemoveTactileFeedback, inPckg );
|
|
1517 |
if ( err != KErrNone )
|
|
1518 |
{
|
|
1519 |
__ALFLOGSTRING1( "CAlfVisual::RemoveTactileFeedback ignore error %d", err )
|
|
1520 |
}
|
|
1521 |
}
|
|
1522 |
|
|
1523 |
// ---------------------------------------------------------------------------
|
|
1524 |
//
|
|
1525 |
// ---------------------------------------------------------------------------
|
|
1526 |
//
|
|
1527 |
EXPORT_C void CAlfVisual::Pause(TInt aPropertiesBitmask)
|
|
1528 |
{
|
|
1529 |
TPckgC<TInt> inPckg(aPropertiesBitmask);
|
|
1530 |
TBuf8<1> dum;
|
|
1531 |
|
|
1532 |
TInt err = iData->iComms->DoSynchronousCmd( EAlfVisualPauseProperties, inPckg, dum );
|
|
1533 |
if ( err != KErrNone )
|
|
1534 |
{
|
|
1535 |
__ALFLOGSTRING1( "CAlfVisual::Pause ignored error %d", err )
|
|
1536 |
}
|
|
1537 |
}
|
|
1538 |
|
|
1539 |
// ---------------------------------------------------------------------------
|
|
1540 |
//
|
|
1541 |
// ---------------------------------------------------------------------------
|
|
1542 |
//
|
|
1543 |
EXPORT_C void CAlfVisual::Resume(TInt aPropertiesBitmask)
|
|
1544 |
{
|
|
1545 |
TPckgC<TInt> inPckg(aPropertiesBitmask);
|
|
1546 |
TBuf8<1> dum;
|
|
1547 |
|
|
1548 |
TInt err = iData->iComms->DoSynchronousCmd( EAlfVisualResumeProperties, inPckg, dum );
|
|
1549 |
if ( err != KErrNone )
|
|
1550 |
{
|
|
1551 |
__ALFLOGSTRING1( "CAlfVisual::Resume ignored error %d", err )
|
|
1552 |
}
|
|
1553 |
}
|
|
1554 |
|
|
1555 |
// ---------------------------------------------------------------------------
|
|
1556 |
//
|
|
1557 |
// ---------------------------------------------------------------------------
|
|
1558 |
//
|
|
1559 |
EXPORT_C void CAlfVisual::EnableDropShadowL( TBool aEnable )
|
|
1560 |
{
|
|
1561 |
if ( aEnable && !iData->iDropShadowHandler )
|
|
1562 |
{
|
|
1563 |
// create instance.
|
|
1564 |
CAlfDropShadow* dropShadowHandler = CAlfDropShadow::NewL( *Comms() );
|
|
1565 |
|
|
1566 |
TPckgC<TBool> inPckg(aEnable);
|
|
1567 |
TBuf8<1> dum;
|
|
1568 |
TInt err = iData->iComms->DoSynchronousCmd( EAlfVisualEnableDropShadow, inPckg, dum );
|
|
1569 |
|
|
1570 |
if (err!=KErrNone)
|
|
1571 |
{
|
|
1572 |
__ALFLOGSTRING1( "CAlfVisual::EnableDropShadowL leave error %d", err )
|
|
1573 |
delete dropShadowHandler;
|
|
1574 |
User::Leave( err );
|
|
1575 |
}
|
|
1576 |
iData->iDropShadowHandler = dropShadowHandler;
|
|
1577 |
}
|
|
1578 |
else if ( !aEnable && iData->iDropShadowHandler )
|
|
1579 |
{
|
|
1580 |
// delete the instance.
|
|
1581 |
TPckgC<TBool> inPckg(aEnable);
|
|
1582 |
TBuf8<1> dum;
|
|
1583 |
TInt err = iData->iComms->DoSynchronousCmd( EAlfVisualEnableDropShadow, inPckg, dum );
|
|
1584 |
|
|
1585 |
if (err!=KErrNone)
|
|
1586 |
{
|
|
1587 |
__ALFLOGSTRING1( "CAlfVisual::EnableDropShadowL leave error %d", err )
|
|
1588 |
User::Leave( err );
|
|
1589 |
}
|
|
1590 |
|
|
1591 |
delete iData->iDropShadowHandler;
|
|
1592 |
iData->iDropShadowHandler = NULL;
|
|
1593 |
}
|
|
1594 |
else
|
|
1595 |
{
|
|
1596 |
// For PC lint
|
|
1597 |
}
|
|
1598 |
}
|
|
1599 |
|
|
1600 |
// ---------------------------------------------------------------------------
|
|
1601 |
//
|
|
1602 |
// ---------------------------------------------------------------------------
|
|
1603 |
//
|
|
1604 |
EXPORT_C CAlfDropShadow* CAlfVisual::DropShadowHandler() const
|
|
1605 |
{
|
|
1606 |
return iData->iDropShadowHandler;
|
|
1607 |
}
|
|
1608 |
|
|
1609 |
EXPORT_C void CAlfVisual::SetEffectL( const TDesC& aEffectFile )
|
|
1610 |
{
|
|
1611 |
TBuf8<1> dumDum;
|
|
1612 |
TAlfVisualEffectParams params;
|
|
1613 |
params.iFileName = aEffectFile;
|
|
1614 |
params.iHandle = Identifier();
|
|
1615 |
|
|
1616 |
TPckg<TAlfVisualEffectParams> paramsPckg(params);
|
|
1617 |
|
|
1618 |
TInt err = KErrNone;
|
|
1619 |
if ( aEffectFile.Length() == 0 )
|
|
1620 |
{
|
|
1621 |
err = iData->iComms->DoSynchronousCmd(EAlfVisualRemoveEffect, paramsPckg, dumDum);
|
|
1622 |
}
|
|
1623 |
else
|
|
1624 |
{
|
|
1625 |
err = iData->iComms->DoSynchronousCmd(EAlfVisualSetEffect, paramsPckg, dumDum);
|
|
1626 |
}
|
|
1627 |
if (err)
|
|
1628 |
{
|
|
1629 |
__ALFLOGSTRING1( "CAlfVisual::SetEffectL leave error %d", err )
|
|
1630 |
User::Leave( err );
|
|
1631 |
}
|
|
1632 |
}
|
|
1633 |
|
|
1634 |
// ---------------------------------------------------------------------------
|
|
1635 |
// SetGroupEffectL
|
|
1636 |
// ---------------------------------------------------------------------------
|
|
1637 |
//
|
|
1638 |
EXPORT_C void CAlfVisual::SetGroupEffectL( const TDesC& aEffectFile, TInt aGroupHandle )
|
|
1639 |
{
|
|
1640 |
TBuf8<1> dumDum;
|
|
1641 |
TAlfVisualEffectParams params;
|
|
1642 |
params.iFileName = aEffectFile;
|
|
1643 |
params.iGroupHandle = aGroupHandle;
|
|
1644 |
params.iHandle = Identifier();
|
|
1645 |
|
|
1646 |
TPckg<TAlfVisualEffectParams> paramsPckg(params);
|
|
1647 |
|
|
1648 |
TInt err = KErrNone;
|
|
1649 |
if ( aEffectFile.Length() == 0 )
|
|
1650 |
{
|
|
1651 |
err = iData->iComms->DoSynchronousCmd(EAlfVisualRemoveEffect, paramsPckg, dumDum);
|
|
1652 |
}
|
|
1653 |
else
|
|
1654 |
{
|
|
1655 |
err = iData->iComms->DoSynchronousCmd(EAlfVisualSetGroupEffect, paramsPckg, dumDum);
|
|
1656 |
}
|
|
1657 |
if (err)
|
|
1658 |
{
|
|
1659 |
__ALFLOGSTRING1( "CAlfVisual::SetGroupEffectL leave error %d", err )
|
|
1660 |
User::Leave( err );
|
|
1661 |
}
|
|
1662 |
}
|
|
1663 |
|