|
1 /* |
|
2 * Copyright (c) 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __MENUENGOBJECTFACTORY_H__ |
|
19 #define __MENUENGOBJECTFACTORY_H__ |
|
20 |
|
21 #include "mcsdef.h" |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <gecodefaultobjectfactory.h> |
|
25 |
|
26 // FORWARD DECLARATION |
|
27 |
|
28 class CMenuEng; |
|
29 |
|
30 /** |
|
31 * Menu Engine Object factory. |
|
32 */ |
|
33 NONSHARABLE_CLASS( CMenuEngObjectFactory ): public CGECODefaultObjectFactory |
|
34 { |
|
35 |
|
36 public: // construction |
|
37 |
|
38 /** |
|
39 * Destructor. |
|
40 */ |
|
41 virtual ~CMenuEngObjectFactory(); |
|
42 |
|
43 /** |
|
44 * Two-phased constructor. |
|
45 * @param aEng Engine. |
|
46 * @return The created object. |
|
47 */ |
|
48 static CMenuEngObjectFactory* NewL( CMenuEng& aEng ); |
|
49 |
|
50 protected: // construction |
|
51 |
|
52 /** |
|
53 * Constructor. |
|
54 * @param aEng Engine. |
|
55 */ |
|
56 CMenuEngObjectFactory( CMenuEng& aEng ); |
|
57 |
|
58 public: // from CGECOObjectFactoryBase |
|
59 |
|
60 /** |
|
61 * Create object and set it current. |
|
62 * @param aTypeIdentifier Object type identifier. |
|
63 * @return CGECOObjectBase derived object. Caller takes ownership. |
|
64 */ |
|
65 CGECOObjectBase* GetContentObjectAndSetContextL( |
|
66 const TDesC& aTypeIdentifier ); |
|
67 |
|
68 /** |
|
69 * Initializes the current object with attribute provider data. |
|
70 * @param aAttributeProvider Attribute provider for data initialization. |
|
71 */ |
|
72 void InitializeObjectL( |
|
73 MGECOAttributeProvider& aAttributeProvider ); |
|
74 |
|
75 /** |
|
76 * Set context object for initialize and preparesave operations. |
|
77 * @param aContext Object to use in InitializeL operations. |
|
78 * @return Error code. |
|
79 */ |
|
80 TInt SetContext( CGECOObjectBase* aContext ); |
|
81 |
|
82 public: // from MGECOAttributeProvider |
|
83 |
|
84 /** |
|
85 * Get number of attributes (of current object). |
|
86 * @return Number of attributes. |
|
87 */ |
|
88 TInt NumAttributes(); |
|
89 |
|
90 /** |
|
91 * Get attribute by index (of current object). |
|
92 * @param aIndex Attribute index. |
|
93 * @param aAttrName Attribute name is returned here. |
|
94 * @param aAttrValue Attribute value is returned here. |
|
95 * @param aIsLocalized Localized status is returned here. |
|
96 */ |
|
97 void AttributeDetailsL( |
|
98 const TInt aIndex, |
|
99 TPtrC& aAttrName, |
|
100 TPtrC& aAttrValue, |
|
101 TBool& aIsLocalized ); |
|
102 |
|
103 /** |
|
104 * Get attribute by index (of current object). |
|
105 * @param aIndex Attribute index. |
|
106 * @param aAttrName Attribute name is returned here. |
|
107 * @param aAttrValue Attribute value is returned here. |
|
108 */ |
|
109 void AttributeDetailsL( |
|
110 const TInt aIndex, |
|
111 TPtrC& aAttrName, |
|
112 TPtrC& aAttrValue ); |
|
113 |
|
114 /** |
|
115 * Check if current object has text data. |
|
116 * @return ETrue if current object has text data. |
|
117 */ |
|
118 TBool HasTextData(); |
|
119 |
|
120 /** |
|
121 * Get text data of current object. |
|
122 * @param aText Text data is returned here. |
|
123 * @param aIsLocalized Localized status is returned here. |
|
124 */ |
|
125 void TextDetailsL( TPtrC& aText, TBool& aIsLocalized ); |
|
126 |
|
127 private: // data |
|
128 |
|
129 CMenuEng& iEng; ///< Engine. Not owned. |
|
130 TBuf<KMenuMaxAttrValueLen> iBuf; ///< Conversion buffer (flags -> string). |
|
131 |
|
132 }; |
|
133 |
|
134 #endif // __MENUENGOBJECTFACTORY_H__ |