|
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: List query dialog adapter and data interface |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __XNLISTQUERYDIALOGADAPTER_H__ |
|
19 #define __XNLISTQUERYDIALOGADAPTER_H__ |
|
20 |
|
21 // INCLUDES |
|
22 #include "xncontroladapter.h" |
|
23 #include <e32base.h> |
|
24 |
|
25 #include "xncomponent.h" |
|
26 #include "xnnode.h" |
|
27 #include "mxncomponentinterface.h" |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CXnNodePluginIf; |
|
31 class CXnUiEngine; |
|
32 class CAknListQueryDialog; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 namespace XnListQueryDialogInterface |
|
37 { |
|
38 _LIT8(KType, "listquerydialog"); |
|
39 class MXnListQueryDialogInterface : public XnComponentInterface::MXnComponentInterface |
|
40 { |
|
41 |
|
42 public: |
|
43 |
|
44 static inline const TDesC8& Type() |
|
45 { |
|
46 return KType; |
|
47 } |
|
48 |
|
49 public: // New functions |
|
50 |
|
51 /** |
|
52 * Replaces or appends new item into list |
|
53 * @param aText The new text line |
|
54 * @param aIndex index |
|
55 */ |
|
56 virtual void ReplaceItemL(const TDesC& aText, TInt aIndex ) = 0; |
|
57 |
|
58 /** |
|
59 * Inserts or appends new item into list |
|
60 * @param aText The new text line |
|
61 * @param aIndex index |
|
62 */ |
|
63 virtual void InsertItemL(const TDesC& aText, TInt aIndex ) = 0; |
|
64 |
|
65 /** |
|
66 * Deletes the item from the given index |
|
67 * @param aIndex list index |
|
68 */ |
|
69 virtual void DeleteItem( TInt aIndex ) = 0; |
|
70 }; |
|
71 } |
|
72 |
|
73 /** |
|
74 * List query dialog data interface |
|
75 * @ingroup group_xnlayoutengine |
|
76 * @lib xnlayoutengine.lib |
|
77 * @since 9.2 |
|
78 */ |
|
79 class CXnListQueryDialog : public CXnComponent, public XnListQueryDialogInterface::MXnListQueryDialogInterface |
|
80 { |
|
81 |
|
82 public: |
|
83 |
|
84 |
|
85 /** |
|
86 * 2 phase construction. |
|
87 */ |
|
88 static CXnListQueryDialog* NewL(); |
|
89 |
|
90 |
|
91 /** |
|
92 * Destructor. |
|
93 */ |
|
94 virtual ~CXnListQueryDialog(); |
|
95 |
|
96 public: // From MXnListQueryDialogInterface |
|
97 |
|
98 /** |
|
99 * Replaces or appends new item into list |
|
100 * @param aText The new text line |
|
101 * @param aIndex index |
|
102 */ |
|
103 void ReplaceItemL(const TDesC& aText, TInt aIndex ); |
|
104 |
|
105 /** |
|
106 * Inserts or appends new item into list |
|
107 * @param aText The new text line |
|
108 * @param aIndex index |
|
109 */ |
|
110 void InsertItemL(const TDesC& aText, TInt aIndex ); |
|
111 |
|
112 /** |
|
113 * Deletes the item from the given index |
|
114 * @param aIndex list index |
|
115 */ |
|
116 void DeleteItem( TInt aIndex ); |
|
117 |
|
118 |
|
119 public: // from MXnComponentInterface |
|
120 |
|
121 /** |
|
122 * Create a component interface according to the given type. |
|
123 * @param aType Type of the interface to create |
|
124 * @return Created interface or NULL if the provided type is not supported. |
|
125 */ |
|
126 XnComponentInterface::MXnComponentInterface* MakeInterfaceL(const TDesC8& aType); |
|
127 |
|
128 private: |
|
129 |
|
130 CXnListQueryDialog(); |
|
131 void ConstructL(); |
|
132 |
|
133 }; |
|
134 |
|
135 // CLASS DECLARATION |
|
136 |
|
137 /** |
|
138 * @ingroup group_xnlayoutengine |
|
139 * List query dialog adapter interface class |
|
140 * @lib xnlayoutengine.lib |
|
141 * @since Series 60 5.0 |
|
142 */ |
|
143 NONSHARABLE_CLASS( CXnListQueryDialogAdapter ) : public CXnControlAdapter |
|
144 { |
|
145 public: // Constructors and destructor |
|
146 /** |
|
147 * Two-phased constructor. |
|
148 */ |
|
149 static CXnListQueryDialogAdapter* NewL( CXnNodePluginIf& aNode ); |
|
150 |
|
151 /** |
|
152 * Destructor. |
|
153 */ |
|
154 ~CXnListQueryDialogAdapter(); |
|
155 |
|
156 /** |
|
157 * Replaces or appends new item into list |
|
158 * @param aText The new text line |
|
159 * @param aIndex index |
|
160 */ |
|
161 void ReplaceItemL(const TDesC& aText, TInt aIndex ); |
|
162 |
|
163 /** |
|
164 * Inserts or appends new item into list |
|
165 * @param aText The new text line |
|
166 * @param aIndex index |
|
167 */ |
|
168 void InsertItemL(const TDesC& aText, TInt aIndex ); |
|
169 |
|
170 /** |
|
171 * Deletes the item from the given index |
|
172 * @param aIndex list index |
|
173 */ |
|
174 void DeleteItem( TInt aIndex ); |
|
175 |
|
176 /** |
|
177 * Displays the dialog |
|
178 */ |
|
179 void TryDisplayingDialogL(); |
|
180 |
|
181 private: // Constructors |
|
182 /** |
|
183 * C++ default constructor. |
|
184 */ |
|
185 CXnListQueryDialogAdapter( CXnNodePluginIf& aNode ); |
|
186 |
|
187 /** |
|
188 * Two-phased constructor. |
|
189 */ |
|
190 void ConstructL(); |
|
191 |
|
192 private: // New functions |
|
193 /** |
|
194 * Sets the selected item active, which runs associated event. |
|
195 */ |
|
196 void ActivateItemL( TInt aIndex ); |
|
197 |
|
198 /** |
|
199 * Inserts the index into event. |
|
200 */ |
|
201 void ModifyDynamicEventL( TInt aIndex ); |
|
202 |
|
203 private: // Data |
|
204 |
|
205 // Dialog |
|
206 CAknListQueryDialog* iDialog; |
|
207 |
|
208 // Node |
|
209 CXnNodePluginIf& iNode; |
|
210 /** |
|
211 * List items |
|
212 * own |
|
213 */ |
|
214 CDesCArrayFlat* iItemArray; |
|
215 |
|
216 /** |
|
217 * Array of static item nodes |
|
218 * Not own |
|
219 */ |
|
220 RPointerArray< CXnNodePluginIf > iStaticItems; |
|
221 |
|
222 /** |
|
223 * Dynamic item node |
|
224 * Not own |
|
225 */ |
|
226 CXnNodePluginIf* iDynamicItem; |
|
227 |
|
228 }; |
|
229 |
|
230 #endif // __XNLISTQUERYDIALOGADAPTER_H__ |
|
231 |
|
232 // End of File |