2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Implementation of CAknListQueryDialog
20 #ifndef AKNLISTQUERYDIALOG_H
21 #define AKNLISTQUERYDIALOG_H
23 #include <AknQueryDialog.h>
25 class CAknMessageQueryControl;
26 class CAknListQueryMediatorObserver;
31 * This class is be used for list or multiselection list queries.
33 class CAknListQueryDialog : public CAknQueryDialog,
34 public MEikListBoxObserver,
35 public MAknIntermediateState
39 * C++ default constructor.
41 * @param aIndex After the query is dismissed, the index will
42 * hold the value of selected item.
44 IMPORT_C CAknListQueryDialog(TInt* aIndex);
47 * C++ default constructor.
49 * @param aSelectionIndexArray Will hold the values of selected
50 * items (in multiselection list).
52 IMPORT_C CAknListQueryDialog(
53 CListBoxView::CSelectionIndexArray* aSelectionIndexArray);
58 IMPORT_C virtual ~CAknListQueryDialog();
63 * Sets the type and position of the list box.
65 * @param aSize Not used.
67 IMPORT_C void SetSizeAndPosition(const TSize &aSize);
70 * From @c CCoeControl.
72 * Handles key events. When a key event occurs, @c CONE calls this
73 * function for each control on the control stack, until one of them
74 * returns @c EKeyWasConsumed to indicate that it processed the key
77 * @param aKeyEvent The key event.
78 * @param aType The type of the event: @c EEventKey, @c EEventKeyUp or
80 * @return Indicates whether or not the key event was
81 * used by this control.
83 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
87 * From @c MEikListBoxObserver.
89 * Handles events from listbox.
91 * @param aListBox The listbox which caused the event.
92 * @param aEventType Type of the event.
94 IMPORT_C void HandleListBoxEventL(CEikListBox* aListBox,
95 TListBoxEvent aEventType);
98 * Sets item text array to the listbox.
100 * @param aItemTextArray Item text array to be added.
102 IMPORT_C void SetItemTextArray(MDesCArray* aItemTextArray);
105 * Sets ownership type of the item array.
107 * @param aOwnershipType Type of ownership.
109 IMPORT_C void SetOwnershipType(
110 TListBoxModelItemArrayOwnership aOwnershipType);
113 * Destroys a possible old icon array in the listbox and installs a new
114 * one and takes ownership of the new icon array.
116 * @param aIcons Icon pointer which will be installed.
118 IMPORT_C void SetIconArrayL(CArrayPtr<CGulIcon>* aIcons);
121 * Gets list query's listbox.
123 * @return The requested list box.
125 IMPORT_C CEikListBox* ListBox() const;
128 * Gets pointer to list query control or @c NULL.
130 * @return Pointer to list query control or in case that there is
131 * no such element a @c NULL pointer.
133 IMPORT_C CAknListQueryControl* ListControl() const;
136 * Gets pointer to message query control or @c NULL.
138 * @return Pointer to message query control or in case that there
139 * is no such element a @c NULL pointer.
141 IMPORT_C CAknMessageQueryControl* MessageBox() const;
144 * Gets pointer to query heading or @c NULL.
146 * @return Pointer to query heading or in case there is no such
147 * element a @c NULL pointer.
149 IMPORT_C CAknPopupHeadingPane* QueryHeading() const;
152 * From @c CCoeControl.
154 * Sets the control to be ready for drawing.
156 IMPORT_C void ActivateL();
159 * From @c CCoeControl.
161 * Handles pointer events.
163 * This function gets called whenever a pointer event occurs in the
164 * control, i.e. when the pointer is within the control's extent,
165 * or when the control has grabbed the pointer. The control should
166 * implement this function to handle pointer events.
168 * Note: events of type @c EButton1Down are processed before
169 * @c HandlePointerEventL() is called, in order to transfer keyboard
170 * focus to the control in which the @c EButton1Down event occurred.
172 * If overriding @c HandlePointerEventL(), the implementation must
173 * include a base call to @c CCoeControl's @c HandlePointerEventL().
175 * @param &aPointerEvent The pointer event.
177 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
181 * From @c CEikDialog.
183 * This function is called by the @c EIKON dialog framework just
184 * before the dialog is activated, but before it is sized,
185 * and before @c PostLayoutDynInitL() is called.
187 IMPORT_C void PreLayoutDynInitL(void);
190 * From @c CEikDialog.
192 * This function is called by the @c EIKON dialog framework
193 * just before the dialog is activated, after it has called
194 * @c PreLayoutDynInitL() and the dialog has been sized.
196 IMPORT_C void PostLayoutDynInitL();
199 * From @c CEikDialog.
201 * This function is called by the @c EIKON framework if the user
202 * activates a button in the button panel. It is not called if
203 * the @c Cancel button is activated, unless the
204 * @c EEikDialogFlagNotifyEsc flag is set.
206 * @param aButtonId The ID of the button that was activated
207 * @return @c ETrue if the dialog should exit,
208 * and @c EFalse if it should not.
210 IMPORT_C TBool OkToExitL(TInt aButtonId);
213 * Gets border style of the list query.
215 * @return Border style (@c AknBorderId type)
217 IMPORT_C TInt BorderStyle();
221 * From @c MAknIntermediateState.
223 * Tries to close the query with non-leaving way.
225 IMPORT_C void CloseState();
231 * Gets called by iIdle.
233 * @param aObj Target dialog to be closed.
234 * @return @c EFalse always.
236 static TInt ClosePopup(TAny *aObj);
239 * Closes the dialog and accepts selected item.
241 * Gets called by iIdle.
243 * @param aObj Target dialog to be closed.
244 * @return @c EFalse always.
246 static TInt ClosePopupAcceptingChanges(TAny *aObj);
250 * From @c CAknControl
252 IMPORT_C void* ExtensionInterface( TUid aInterface );
254 IMPORT_C virtual void CEikDialog_Reserved_1();
255 IMPORT_C virtual void CEikDialog_Reserved_2();
257 IMPORT_C virtual void CAknDialog_Reserved();
259 IMPORT_C virtual void CAknQueryDialog_Reserved();
261 // Will hold the index of the selected item
263 // Will hold the selected items' indexes
264 CListBoxView::CSelectionIndexArray *iSelectionIndexArray;
265 // Was the enter key pressed
266 TBool iEnterKeyPressed;
267 // Idle object to close the query if it there's no items to show
269 // Layout for List query control
270 TAknPopupWindowLayoutDef iLayout;
272 CAknListQueryMediatorObserver* iMediatorObs;
278 * Gets search field if it has been set.
280 * @return Pointer to search field. If no search field is used
283 IMPORT_C CAknSearchField* FindBox() const;
287 * Sets the tone for the dialog.
289 * @param aTone Tone to be used by the dialog.
291 IMPORT_C void SetTone(TInt aTone);
293 IMPORT_C void HandleResourceChange(TInt aType);
298 * Override to CEikDialog default functionality
299 * Instantiates mediator support and send a command with given parameters when a
300 * dialog is brought to display
301 * @param aDialogIndex Unique index to identify a dialog within the category
302 * 0 has special meaning, it causes implementation to omit all communication
303 * with secondary display. (use with sleeping dialogs only)
304 * @param aCatUid gategory uid, if default paramter is passed, application uid is used
308 IMPORT_C void PublishDialogL(TInt aDialogIndex, TUid aCatUid = KNullUid, CArrayFixFlat<TInt>* aItemIds = 0);
312 * Instantiates mediator support and passes possible feedback to given intance.
313 * If no observer is set, dialog tries to handle feedback by it self.
315 * Please note that no commands will be instantiated unless command identifiers are
316 * are set using PublishDialogL
318 * @param aObserver pointer to instance implementing MAknDialogMediatorObserver API
322 IMPORT_C void SetMediatorObserver(MAknDialogMediatorObserver* aObserver);
325 #endif // AKNLISTQUERYDIALOG_H