|
1 /* |
|
2 * Copyright (c) 2007-2008 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: base class for all image providers |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_HNATTRIMGPROVIDER_H |
|
21 #define C_HNATTRIMGPROVIDER_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <gulicon.h> |
|
25 #include <AknUtils.h> |
|
26 #include "SVGRequestObserver.h" |
|
27 #include "hniconholder.h" |
|
28 |
|
29 |
|
30 /** |
|
31 * Allows for removing an item from a cleanup stack without using |
|
32 * CleanupStack::Pop(). |
|
33 * This is useful when an item must be removed from the cleanup stack |
|
34 * but it is not possible to use Pop() because some other items have |
|
35 * been pushed onto cleanup stack after that item. |
|
36 */ |
|
37 NONSHARABLE_CLASS( TDismissableCleaner ) |
|
38 { |
|
39 public: |
|
40 /** |
|
41 * Constructor. |
|
42 * |
|
43 * @param aToBeDeletedOnLeave pointer to a memory to be freed on leave. |
|
44 */ |
|
45 TDismissableCleaner( TAny* aToBeDeletedOnLeave ); |
|
46 |
|
47 /** |
|
48 * The Close method - to be called during the cleanup process. |
|
49 * It simply deletes the object passed as parameter to constructor |
|
50 * unless Dismiss() has been called. |
|
51 */ |
|
52 void Close(); |
|
53 |
|
54 /** |
|
55 * Dismiss the deletion. |
|
56 * Call this method to prevent the memory freeing on leave. |
|
57 * This is an equivalent of removing item from cleanup stack with Pop(). |
|
58 */ |
|
59 void Dismiss(); |
|
60 private: |
|
61 /** |
|
62 * Pointer to memory to be deleted on leave. |
|
63 * Not own. |
|
64 */ |
|
65 TAny* mToBeDeletedOnLeave; |
|
66 }; |
|
67 |
|
68 /** |
|
69 * Image provider class interface. |
|
70 * Interface for attribute image classes. Provides methods |
|
71 * for obtainnig values and icons. |
|
72 * |
|
73 * @lib hnpresentationmodel |
|
74 * @since S60 5.0 |
|
75 * @ingroup group_hnpresentationmodel |
|
76 */ |
|
77 NONSHARABLE_CLASS( CHnAttrImgProvider ) : public CBase |
|
78 { |
|
79 |
|
80 public: |
|
81 |
|
82 /** |
|
83 * Standard destructor. |
|
84 * |
|
85 * @since S60 5.0 |
|
86 */ |
|
87 ~CHnAttrImgProvider(); |
|
88 |
|
89 /** |
|
90 * Gets icon. |
|
91 * |
|
92 * @since S60 5.0 |
|
93 * @param aDesiredSize Desired size of the icon. |
|
94 * @return Icon as a CGulIcon pointer. |
|
95 */ |
|
96 virtual CGulIcon* GetIcon( TSize* aDesiredIconSize ); |
|
97 |
|
98 /** |
|
99 * Gets icon holder which contains the icon that GetIcon returns. |
|
100 * |
|
101 * @param aDesiredSize Desired size of the icon. |
|
102 * @return icon hoder that contains the icon (may return NULL). |
|
103 */ |
|
104 virtual CHnIconHolder* GetIconHolder( TSize* aDesiredIconSize ); |
|
105 |
|
106 /** |
|
107 * Removes all LIW objects owned by this object. |
|
108 * |
|
109 * LIW objects owned by non-LIW objects that are owned by |
|
110 * this object are also removed. |
|
111 * @since S60 5.0 |
|
112 */ |
|
113 virtual void RemoveLiwObjects(); |
|
114 |
|
115 protected: |
|
116 |
|
117 /** |
|
118 * Standard constructor. |
|
119 * |
|
120 * @since S60 5.0 |
|
121 */ |
|
122 CHnAttrImgProvider(); |
|
123 |
|
124 /** |
|
125 * Creates icon. |
|
126 * |
|
127 * @since S60 5.0 |
|
128 * @param aBitmap bitmap |
|
129 * @param aMask mask |
|
130 */ |
|
131 void CreateIconL( CFbsBitmap* aBitmap, CFbsBitmap* aMask ); |
|
132 |
|
133 |
|
134 protected: |
|
135 |
|
136 /** |
|
137 * Icon holder - the object that owns the CGulIcon that this |
|
138 * provider creates. |
|
139 * Co-own(CHnIconHolder is ref-counted). |
|
140 */ |
|
141 CHnIconHolder* iIconHolder; |
|
142 |
|
143 }; |
|
144 |
|
145 |
|
146 #endif // C_HNATTRIMGPROVIDER_H |
|
147 |