|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : RegistrationListbox.cpp 00004 * Part of : Registration 00005 * Interface : 00006 * Description : 00007 * Version : 00008 * 00009 * Copyright (c) 2005-2006 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. 00013 * ============================================================================== 00014 */ 00015 00016 // INCLUDE FILES 00017 #include "RegistrationListbox.h" 00018 #include "RegistrationView.h" 00019 00020 // ============================ MEMBER FUNCTIONS ============================== 00021 00022 // ---------------------------------------------------------------------------- 00023 // CRegistrationListbox::CreateSettingItemL() 00024 // Updates descriptor array for list box 00025 // ---------------------------------------------------------------------------- 00026 // 00027 CAknSettingItem* CRegistrationListbox::CreateSettingItemL( TInt aIdentifier ) 00028 { 00029 00030 CAknSettingItem* settingItem = NULL; 00031 00032 switch ( aIdentifier ) 00033 { 00034 case ERegistrationSettingName: 00035 settingItem = new ( ELeave ) CAknTextSettingItem( aIdentifier, 00036 iItemData->iName ); 00037 break; 00038 00039 case ERegistrationSettingEmail: 00040 settingItem = new ( ELeave ) CAknTextSettingItem( aIdentifier, 00041 iItemData->iEmail ); 00042 break; 00043 00044 case ERegistrationSettingPhone: 00045 settingItem = new ( ELeave ) CAknTextSettingItem( aIdentifier, 00046 iItemData->iPhone ); 00047 break; 00048 00049 case ERegistrationSettingDate: 00050 settingItem = new ( ELeave ) CAknTimeOrDateSettingItem( 00051 aIdentifier, CAknTimeOrDateSettingItem::EDate, iItemData->iDate ); 00052 break; 00053 00054 case ERegistrationSettingGender: 00055 settingItem = new ( ELeave ) CAknBinaryPopupSettingItem( 00056 aIdentifier, iItemData->iGender ); 00057 break; 00058 00059 case ERegistrationSettingLogin: 00060 settingItem = new ( ELeave ) CAknTextSettingItem( aIdentifier, 00061 iItemData->iLogin ); 00062 break; 00063 00064 case ERegistrationSettingPassWord: 00065 settingItem = new ( ELeave ) CAknPasswordSettingItem( 00066 aIdentifier, CAknPasswordSettingItem::EAlpha, iItemData->iPw ); 00067 break; 00068 00069 case ERegistrationSettingAccept: 00070 settingItem = new ( ELeave ) CAknBinaryPopupSettingItem( 00071 aIdentifier, iItemData->iAccept ); 00072 break; 00073 00074 default: 00075 break; 00076 } 00077 return settingItem; 00078 } 00079 00080 // ---------------------------------------------------------------------------- 00081 // CRegistrationListbox::EditItemL(TInt aIndex, TBool aCalledFromMenu) 00082 // Edit data 00083 // ---------------------------------------------------------------------------- 00084 // 00085 void CRegistrationListbox::EditItemL( TInt aIndex, TBool aCalledFromMenu ) 00086 { 00087 CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu ); 00088 ( *SettingItemArray() )[aIndex]->UpdateListBoxTextL(); 00089 ( *SettingItemArray() )[aIndex]->StoreL(); 00090 } 00091 00092 // ---------------------------------------------------------------------------- 00093 // CRegistrationListbox::SetData() 00094 // Set ListItem data 00095 // ---------------------------------------------------------------------------- 00096 // 00097 void CRegistrationListbox::SetData( TRegistrationItemdata* aItemData ) 00098 { 00099 iItemData = aItemData; 00100 } 00101 00102 // ---------------------------------------------------------------------------- 00103 // TKeyResponse CRegistrationListbox::OfferKeyEventL() 00104 // Handles the key events. 00105 // ---------------------------------------------------------------------------- 00106 // 00107 TKeyResponse CRegistrationListbox::OfferKeyEventL( const TKeyEvent& aKeyEvent, 00108 TEventCode aType ) 00109 { 00110 // No action if not key event 00111 if ( aType != EEventKey ) 00112 { 00113 return EKeyWasNotConsumed; 00114 } 00115 00116 // The code of key event is checked 00117 switch ( aKeyEvent.iCode ) 00118 { 00119 // These events have no function in this application 00120 case EKeySpace: 00121 case EKeyRightArrow: 00122 case EKeyLeftArrow: 00123 break; 00124 00125 default: 00126 CAknSettingItemList::OfferKeyEventL( aKeyEvent, aType ); 00127 break; 00128 } 00129 return EKeyWasConsumed; 00130 } 00131 00132 // ---------------------------------------------------------------------------- 00133 // CRegistrationListbox::SizeChanged() 00134 // Called by framework when the view size is changed. 00135 // ---------------------------------------------------------------------------- 00136 // 00137 void CRegistrationListbox::SizeChanged() 00138 { 00139 if ( ListBox() ) 00140 { 00141 ListBox()->SetRect( Rect() ); 00142 } 00143 } 00144 00145 // End of File
|
© Nokia 2006 |