|
1 /* |
|
2 * Copyright (c) 2007 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: Definition of menu item attribute |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __MENUSRVMATTR_H__ |
|
20 #define __MENUSRVMATTR_H__ |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 |
|
25 /** |
|
26 * Menu srv attribute. |
|
27 * @lib mcsmenu.lib |
|
28 * @since S60 v5.0 |
|
29 */ |
|
30 NONSHARABLE_CLASS( CMenuSrvAttr ): public CBase |
|
31 { |
|
32 |
|
33 public: |
|
34 |
|
35 /** |
|
36 * Destructor. |
|
37 */ |
|
38 virtual ~CMenuSrvAttr(); |
|
39 |
|
40 /** |
|
41 * Two-phased constructor. |
|
42 * @param aName Attribute name. |
|
43 * @return The created object. |
|
44 */ |
|
45 static CMenuSrvAttr* NewL( const TDesC& aName ); |
|
46 |
|
47 /** |
|
48 * Two-phased constructor. |
|
49 * @param aName Attribute name. |
|
50 * @return The created object. |
|
51 */ |
|
52 static CMenuSrvAttr* NewLC( const TDesC& aName ); |
|
53 |
|
54 /** |
|
55 * Get name. |
|
56 * @return Name. |
|
57 */ |
|
58 TPtrC Name() const { return iName; } |
|
59 |
|
60 /** |
|
61 * Get value. |
|
62 * @return Value, or NULL if attribute is not set. |
|
63 */ |
|
64 TPtrC Value() const { return iValue; } |
|
65 |
|
66 /** |
|
67 * Get id. |
|
68 * @return Value. |
|
69 */ |
|
70 TInt Id() const { return iId; } |
|
71 |
|
72 /** |
|
73 * Set value. Sets changed status as appropriate. |
|
74 * @param aValue Value, or NULL if attribute is not set (==remove attr). |
|
75 * Ownership taken. |
|
76 */ |
|
77 void SetValueL( const TDesC& aName ); |
|
78 |
|
79 /** |
|
80 * Set changed status. |
|
81 * @param Changed status. |
|
82 */ |
|
83 void SetId( TInt aId ) { iId = aId; } |
|
84 |
|
85 protected: |
|
86 |
|
87 /** |
|
88 * Second phased constructor. |
|
89 * @param aName Attribute name. |
|
90 */ |
|
91 void ConstructL( const TDesC& aName ); |
|
92 |
|
93 private: // data |
|
94 |
|
95 RBuf iName; ///< Name. Own. |
|
96 RBuf iValue; ///< Value (or NULL). Own. |
|
97 TInt iId; |
|
98 |
|
99 }; |
|
100 |
|
101 /** |
|
102 * Attribute array. |
|
103 * @lib mcsmenu.lib |
|
104 * @since S60 v5.0 |
|
105 */ |
|
106 NONSHARABLE_CLASS( RMenuSrvAttrArray ) : public RPointerArray<CMenuSrvAttr> |
|
107 { |
|
108 |
|
109 public: |
|
110 |
|
111 /** |
|
112 * Find attribute by name. |
|
113 * @param aId Id. |
|
114 * @param aName Name. |
|
115 * @param aAttr Attribute value. |
|
116 * @return TBool ,ETrue if attribute was found |
|
117 */ |
|
118 TBool Find( TInt aId, const TDesC& aName, TDes& aAttrVal ); |
|
119 |
|
120 TBool Exist( TInt aId, const TDesC& aName ); |
|
121 |
|
122 /** |
|
123 * Remove attributes by id. |
|
124 * @param aId Id. |
|
125 */ |
|
126 void RemoveId( TInt aId ); |
|
127 |
|
128 void RemoveAttribute( TInt aId, const TDesC& aAttrName ); |
|
129 |
|
130 /** |
|
131 * Remove not exist items. |
|
132 */ |
|
133 //void RemoveNotExistItems(); |
|
134 |
|
135 }; |
|
136 |
|
137 /** |
|
138 * Push a ResetAndDestroy() on the cleanup stack. |
|
139 * @param aArray Array. |
|
140 */ |
|
141 void CleanupResetAndDestroyPushL( RMenuSrvAttrArray& aArray ); |
|
142 |
|
143 #endif // __MENUITEMATTR_H__ |