|
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: Data container to icons and their unique identifiers. |
|
15 */ |
|
16 |
|
17 #ifndef CCUSTOMICONIDMAP_H |
|
18 #define CCUSTOMICONIDMAP_H |
|
19 |
|
20 #include <gulicon.h> |
|
21 #include <ContactCustomIconPluginDefs.h> |
|
22 |
|
23 /** |
|
24 * Container for the icon pointer and its identifier. |
|
25 * This is used by CCustomIconIdMap. |
|
26 * |
|
27 * Note that this class does not control ownership of the |
|
28 * icon in any way. |
|
29 */ |
|
30 class TCustomIconIdMapItem |
|
31 { |
|
32 public: // Construction |
|
33 |
|
34 /** |
|
35 * Constructor. |
|
36 */ |
|
37 TCustomIconIdMapItem(); |
|
38 |
|
39 /** |
|
40 * Constructor. |
|
41 * |
|
42 * @param aIcon Icon. |
|
43 * @param aId Icon id. |
|
44 */ |
|
45 TCustomIconIdMapItem( |
|
46 CGulIcon* aIcon, |
|
47 TCustomIconId aId ); |
|
48 |
|
49 public: // Data |
|
50 /// Ref: Icon |
|
51 CGulIcon* iIconPtr; |
|
52 /// Ref: Icon id |
|
53 TCustomIconId iId; |
|
54 }; |
|
55 |
|
56 /** |
|
57 * Array of custom icons and their identifiers. |
|
58 * The class holds TCustomIconIdMapItem items. |
|
59 * |
|
60 * For leave covery purposes the class deletes any icons referenced in the |
|
61 * items. If an owner of this class wants to take an ownership of an icon, |
|
62 * it must also remove the corresponding icon item. |
|
63 */ |
|
64 class CCustomIconIdMap : public CArrayFixFlat<TCustomIconIdMapItem> |
|
65 { |
|
66 public: // Construction and destruction |
|
67 |
|
68 /** |
|
69 * Constructor. |
|
70 * |
|
71 * @param aGranularity Array granularity. |
|
72 */ |
|
73 CCustomIconIdMap( TInt aGranularity ); |
|
74 |
|
75 /** |
|
76 * Destructor. |
|
77 */ |
|
78 ~CCustomIconIdMap(); |
|
79 |
|
80 public: // Interface |
|
81 |
|
82 /** |
|
83 * Convenience method for adding an item. |
|
84 * |
|
85 * Use this method to add all the icons, which potentially replace |
|
86 * original contact related icons during their life time. |
|
87 * Note that one icon must not be added twice. |
|
88 * |
|
89 * aIcon may be NULL. This indicates the application that when the |
|
90 * plug-in refers to an icon with aId, the application should |
|
91 * use its default icon. |
|
92 * |
|
93 * @param aIcon The icon instance. Ownership is taken, if the method |
|
94 * does not leave. The value may be NULL. |
|
95 * |
|
96 * @param aId Unique identifier for identifying an icon. Plug-in needs |
|
97 * to remember the ids since application uses the id to later |
|
98 * refer to an icon. The id could be for example |
|
99 * - unique id in database, or |
|
100 * - predefined enum value, if the icons are well known |
|
101 * during customization build time and won't change |
|
102 */ |
|
103 void AppendL( |
|
104 CGulIcon* aIcon, |
|
105 TCustomIconId aId ); |
|
106 }; |
|
107 |
|
108 #include <CCustomIconIdMap.inl> |
|
109 |
|
110 #endif // CCUSTOMICONIDMAP_H |
|
111 |
|
112 // End of File |