|
1 /* |
|
2 * Copyright (c) 2003 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: Stores a single bitmap animation item: image with its |
|
15 * properties (position, timing et al) |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include <fbs.h> |
|
25 #include <bitdev.h> |
|
26 #include <gdi.h> |
|
27 |
|
28 #include "CBmpAnimItem.h" |
|
29 |
|
30 // default 0.20 secs |
|
31 const TInt KDefaultTiming = 200000; |
|
32 |
|
33 // Public constructor, doesn't need a two-phase construction |
|
34 CBmpAnimItem::CBmpAnimItem() |
|
35 : iFlags(BAIF_OWNSICON), |
|
36 iTiming(KDefaultTiming), |
|
37 iPosition(TPoint(0, 0)) |
|
38 { |
|
39 } |
|
40 |
|
41 |
|
42 // Destructor |
|
43 CBmpAnimItem::~CBmpAnimItem() |
|
44 { |
|
45 if (Flags() & BAIF_OWNSICON) |
|
46 { |
|
47 delete iIcon; |
|
48 } |
|
49 } |
|
50 |
|
51 |
|
52 // Set icon. If owned, an icon is deleted by the item |
|
53 void CBmpAnimItem::SetIcon( |
|
54 CGulIcon* aIcon, |
|
55 TBool aItemOwnsIcon /*= ETrue */) |
|
56 { |
|
57 // Get rid of old icon, if any and if owned |
|
58 if ((iIcon) && (Flags() & BAIF_OWNSICON)) |
|
59 { |
|
60 delete iIcon; |
|
61 } |
|
62 |
|
63 iIcon = aIcon; |
|
64 |
|
65 if (aItemOwnsIcon) |
|
66 { |
|
67 iFlags |= BAIF_OWNSICON; |
|
68 } |
|
69 else |
|
70 { |
|
71 iFlags &= ~BAIF_OWNSICON; |
|
72 } |
|
73 } |
|
74 |
|
75 |
|
76 // Set icon from bitmaps. If owned, an icon is deleted by the item |
|
77 void CBmpAnimItem::SetIconL( |
|
78 CFbsBitmap* aBitmap, |
|
79 CFbsBitmap* aMask /* = NULL */, |
|
80 TBool aItemOwnsIcon /* = ETrue */) |
|
81 { |
|
82 // Create a new icon |
|
83 CGulIcon* icon = CGulIcon::NewL(); |
|
84 |
|
85 // Plug the bitmaps in |
|
86 icon->SetBitmap(aBitmap); |
|
87 icon->SetMask(aMask); |
|
88 |
|
89 // Does icon own bitmaps? |
|
90 icon->SetBitmapsOwnedExternally(!aItemOwnsIcon); |
|
91 |
|
92 // Store the newly created icon |
|
93 SetIcon(icon, aItemOwnsIcon); |
|
94 } |
|
95 // End of File |