1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/app/CPbkMemoryEntryAddItemDlg.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,214 @@
1.4 +/*
1.5 +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +* Field type selection dialog for Phonebook's Create New / Edit Memory entry
1.19 +* functions.
1.20 +*
1.21 +*/
1.22 +
1.23 +
1.24 +#ifndef __CPbkMemoryEntryAddItemDlg_H__
1.25 +#define __CPbkMemoryEntryAddItemDlg_H__
1.26 +
1.27 +// INCLUDES
1.28 +#include <e32base.h>
1.29 +
1.30 +// FORWARD DECLARATIONS
1.31 +class CPbkFieldInfo;
1.32 +class CEikFormattedCellListBox;
1.33 +class CAknPopupList;
1.34 +
1.35 +// CLASS DECLARATION
1.36 +
1.37 +/**
1.38 + * Field type selection dialog for Phonebook's Create New- and Edit Memory
1.39 + * entry-functions.
1.40 + * Also used externally for Create New Entry- and Add to Existing
1.41 + * Entry-services.
1.42 + */
1.43 +class CPbkMemoryEntryAddItemDlg : public CBase
1.44 + {
1.45 + public: // Interface
1.46 + /**
1.47 + * Constructor.
1.48 + */
1.49 + IMPORT_C CPbkMemoryEntryAddItemDlg();
1.50 +
1.51 + /**
1.52 + * Sets *aSelfPtr to NULL when this dialog is destroyed.
1.53 + * @precond !aSelfPtr || *aSelfPtr==this
1.54 + */
1.55 + IMPORT_C void ResetWhenDestroyed(CPbkMemoryEntryAddItemDlg** aSelfPtr);
1.56 +
1.57 + /**
1.58 + * Run the dialog and return selected field info.
1.59 + *
1.60 + * @param aFieldInfos An array of field info objects to select from.
1.61 + * @param aCbaResource Cba buttons to use with the dialog.
1.62 + * @return Pointer to a field info in aFieldInfos or NULL if canceled.
1.63 + */
1.64 + IMPORT_C CPbkFieldInfo* ExecuteLD
1.65 + (CArrayPtrFlat<CPbkFieldInfo>& aFieldInfos, TInt aCbaResource);
1.66 +
1.67 + /**
1.68 + * Run the dialog and return selected field info.
1.69 + *
1.70 + * @param aFieldInfos An array of field info objects to select from.
1.71 + * @param aCbaResource Cba buttons to use with the dialog.
1.72 + * @param aTitleText Text to put into popup list's title. No title
1.73 + * pane if aTitleText is empty.
1.74 + * @return Pointer to a field info in aFieldInfos or NULL if canceled.
1.75 + */
1.76 + IMPORT_C CPbkFieldInfo* ExecuteLD
1.77 + (CArrayPtr<CPbkFieldInfo>& aFieldInfos,
1.78 + TInt aCbaResource,
1.79 + const TDesC& aTitleText);
1.80 +
1.81 + /**
1.82 + * Basic ExecuteLD for derived classes to override.
1.83 + * @param aFieldInfos An array of field info objects to select from.
1.84 + */
1.85 + IMPORT_C virtual CPbkFieldInfo* ExecuteLD
1.86 + (CArrayPtr<CPbkFieldInfo>& aFieldInfos);
1.87 +
1.88 + /**
1.89 + * Destructor.
1.90 + * Also cancels and dismisses this popup list, in other words makes
1.91 + * ExecuteLD return just like cancel was pressed.
1.92 + */
1.93 + IMPORT_C ~CPbkMemoryEntryAddItemDlg();
1.94 +
1.95 + public: // internal implementation
1.96 + /**
1.97 + * @internal
1.98 + * Sorts the field info objects according to Phonebook specific rules.
1.99 + */
1.100 + void SortFieldInfoArray();
1.101 +
1.102 + protected: // Interface for derived classes
1.103 + /**
1.104 + * Creates list items, sets Cba and title.
1.105 + * Executed before RunLD.
1.106 + * First part of ExecuteLD.
1.107 + * @param aFieldInfos An array of field info objects to select from.
1.108 + * @param aCbaResource Cba buttons to use with the dialog
1.109 + * @param aTitle Text to put into popup list's title
1.110 + */
1.111 + void PrepareLC(CArrayPtr<CPbkFieldInfo>& aFieldInfos,
1.112 + TInt aCbaResource, const TDesC& aTitle);
1.113 +
1.114 + /**
1.115 + * Execute the initialized dialog.
1.116 + * Second part of ExecuteLD.
1.117 + * @return Pointer to a field info
1.118 + */
1.119 + CPbkFieldInfo* RunLD();
1.120 +
1.121 + private: // Spare virtual functions
1.122 + IMPORT_C virtual void Reserved_1();
1.123 + IMPORT_C virtual void Reserved_2();
1.124 +
1.125 + private: // Data types
1.126 + class CListBoxModel;
1.127 +
1.128 + private: // Data members
1.129 + /// Own: list box.
1.130 + CEikFormattedCellListBox* iListBox;
1.131 + /// Own: popup listbox.
1.132 + CAknPopupList* iPopupList;
1.133 + /// Ref: Referred boolean is set to ETrue when this object is destroyed.
1.134 + TBool* iDestroyedPtr;
1.135 + /// Ref: set to NULL from destructor
1.136 + CPbkMemoryEntryAddItemDlg** iSelfPtr;
1.137 + // Own: Sort Field Infos
1.138 + TBool iSortFieldInfos;
1.139 + };
1.140 +
1.141 +
1.142 +/**
1.143 + * Field type selection dialog for Phonebook's Create New service.
1.144 + * This service can be used to show a popup dialog of Phonebook field
1.145 + * types and then let the user select a particular field type from it.
1.146 + */
1.147 +class CPbkItemTypeSelectCreateNew : public CPbkMemoryEntryAddItemDlg
1.148 + {
1.149 + public: // Interface
1.150 + /**
1.151 + * Constructor.
1.152 + */
1.153 + IMPORT_C CPbkItemTypeSelectCreateNew();
1.154 +
1.155 + /**
1.156 + * Destructor.
1.157 + * Also cancels and dismisses this popup list, in other words makes
1.158 + * ExecuteLD return just like cancel was pressed.
1.159 + */
1.160 + IMPORT_C ~CPbkItemTypeSelectCreateNew();
1.161 +
1.162 + public: // from CPbkMemoryEntryAddItemDlg
1.163 + /**
1.164 + * Runs this dialog and returns the selected field info.
1.165 + *
1.166 + * @param aFieldInfos An array of field info objects to select from.
1.167 + * @return Pointer to a field info in aFieldInfos or NULL if canceled.
1.168 + */
1.169 + IMPORT_C CPbkFieldInfo* ExecuteLD(CArrayPtr<CPbkFieldInfo>& aFieldInfos);
1.170 +
1.171 + private: // Data
1.172 + /// Own: popup list title text
1.173 + HBufC* iTitleBuf;
1.174 + // Spare data
1.175 + TInt32 iSpare1;
1.176 + };
1.177 +
1.178 +
1.179 +/**
1.180 + * Field type selection dialog for Phonebook's Add to Existing-service.
1.181 + * This service can be used to show a popup dialog of Phonebook field
1.182 + * types and then let the user select a particular field type from it.
1.183 + */
1.184 +class CPbkItemTypeSelectAddToExisting : public CPbkMemoryEntryAddItemDlg
1.185 + {
1.186 + public: // Interface
1.187 + /**
1.188 + * Constructor.
1.189 + */
1.190 + IMPORT_C CPbkItemTypeSelectAddToExisting();
1.191 +
1.192 + /**
1.193 + * Destructor.
1.194 + * Also cancels and dismisses this popup list, in other words makes
1.195 + * ExecuteLD return just like cancel was pressed.
1.196 + */
1.197 + IMPORT_C ~CPbkItemTypeSelectAddToExisting();
1.198 +
1.199 + public: // from CPbkMemoryEntryAddItemDlg
1.200 + /**
1.201 + * Run this dialog and return selected field info.
1.202 + *
1.203 + * @param aFieldInfos An array of field info objects to select from.
1.204 + * @return Pointer to a field info in aFieldInfos or NULL if canceled.
1.205 + */
1.206 + IMPORT_C CPbkFieldInfo* ExecuteLD(CArrayPtr<CPbkFieldInfo>& aFieldInfos);
1.207 +
1.208 + private: // Data
1.209 + /// Own: popup list title text
1.210 + HBufC* iTitleBuf;
1.211 + // Spare data
1.212 + TInt32 iSpare1;
1.213 + };
1.214 +
1.215 +#endif // __CPbkMemoryEntryAddItemDlg_H__
1.216 +
1.217 +// End of File