|
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: Image loading animation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #include "glxanimationimageloading.h" |
|
23 |
|
24 #include <alf/alfvisual.h> |
|
25 #include <alf/alfimage.h> |
|
26 #include <alf/alftexture.h> |
|
27 #include <alf/alfimagebrush.h> |
|
28 #include <alf/alfbrusharray.h> |
|
29 |
|
30 #include "glxuiutility.h" |
|
31 |
|
32 // ----------------------------------------------------------------------------- |
|
33 // NewL |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 CGlxAnimationImageLoading* CGlxAnimationImageLoading::NewL( |
|
37 CAlfVisual& aVisual, |
|
38 CAlfTexture& aFlashTexture) |
|
39 { |
|
40 CGlxAnimationImageLoading* self = new (ELeave) CGlxAnimationImageLoading(aVisual, aFlashTexture); |
|
41 CleanupStack::PushL(self); |
|
42 self->ConstructL(); |
|
43 CleanupStack::Pop(self); |
|
44 return self; |
|
45 } |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // Constructor |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 CGlxAnimationImageLoading::CGlxAnimationImageLoading(CAlfVisual& aVisual, |
|
52 CAlfTexture& aFlashTexture) |
|
53 : iVisual(aVisual), |
|
54 iFlashTexture(aFlashTexture) |
|
55 { |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // ConstructL |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 void CGlxAnimationImageLoading::ConstructL() |
|
63 { |
|
64 |
|
65 // Create brush |
|
66 CGlxUiUtility* utility = CGlxUiUtility::UtilityL(); |
|
67 CleanupClosePushL(*utility); |
|
68 |
|
69 // Rowland 30/10/07 Now need to get the environment |
|
70 CAlfEnv* env = utility->Env(); |
|
71 |
|
72 TAlfImage img(iFlashTexture); |
|
73 |
|
74 iImageBrush = CAlfImageBrush::NewL(*env, img); |
|
75 |
|
76 CleanupStack::PopAndDestroy(utility); |
|
77 |
|
78 iImageBrush->SetLayer(EAlfBrushLayerForeground); |
|
79 iImageBrush->SetBorders(1,1,1,1); |
|
80 /// @todo check is this is correct? Rowland 30/10/07 SetClipToVisual is no longer defined |
|
81 //iImageBrush->SetClipToVisual(ETrue); |
|
82 iImageBrush->SetScaleMode(CAlfImageVisual::EScaleFit); |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // Destructor |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 CGlxAnimationImageLoading::~CGlxAnimationImageLoading() |
|
90 { |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // StartTimedAnimationL |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 void CGlxAnimationImageLoading::StartTimedAnimationL( TInt aTime ) |
|
98 { |
|
99 iVisual.EnableBrushesL(); |
|
100 iVisual.Brushes()->AppendL(iImageBrush, EAlfHasOwnership); |
|
101 TAlfTimedValue opacity; |
|
102 opacity.SetValueNow( 1.0 ); // immediate change |
|
103 opacity.SetTarget(0.0, aTime ); // target |
|
104 iImageBrush->SetOpacity(opacity); |
|
105 } |
|
106 |
|
107 |