/** * Initialize each control upon creation. */ void CSettingList::InitializeControlsL() { iListBox = new ( ELeave ) CAknDoubleStyleListBox; iListBox->SetContainerWindowL( *this ); { TResourceReader reader; iEikonEnv->CreateResourceReaderLC( reader, R_SETTING_LIST_LIST_BOX ); iListBox->ConstructFromResourceL( reader ); CleanupStack::PopAndDestroy(); // reader internal state } // the listbox owns the items in the list and will free them iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray ); // setup the icon array so graphics-style boxes work SetupListBoxIconsL(); iListBox->SetListBoxObserver( this ); AddListBoxEventHandlerL( iListBox, EEventEnterKeyPressed, &CSettingList::HandleListBoxEnterKeyPressedL ); AddListBoxEventHandlerL( iListBox, EEventItemSingleClicked, &CSettingList::HandleListBoxItemClickedL ); // add list items AddListBoxResourceArrayItemL( R_SETTING_LIST_LISTBOX_ITEM1 ); AddListBoxResourceArrayItemL( R_SETTING_LIST_LISTBOX_ITEM2 ); AddListBoxResourceArrayItemL( R_SETTING_LIST_LISTBOX_ITEM3 ); iListBox->SetFocus( ETrue ); iFocusControl = iListBox; }
/** * Initialize each control upon creation. */ void CNPRListBox::InitializeControlsL() { iListBox = new ( ELeave ) CAknSingleLargeStyleListBox; iListBox->SetContainerWindowL( *this ); TResourceReader reader; iEikonEnv->CreateResourceReaderLC( reader, R_NPRLIST_BOX_LIST_BOX ); iListBox->ConstructFromResourceL( reader ); CleanupStack::PopAndDestroy(); // reader internal state // the listbox owns the items in the list and will free them iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray ); // setup the icon array so graphics-style boxes work SetupListBoxIconsL(); // add list items AddListBoxResourceArrayItemL( R_NPRLIST_BOX_LISTBOX_ITEM1, EListBoxNpr_0xeeb0e481Qgn_menu_nprIndex ); AddListBoxResourceArrayItemL( R_NPRLIST_BOX_LISTBOX_ITEM2, EListBoxNpr_0xeeb0e481Qgn_menu_nprIndex ); AddListBoxResourceArrayItemL( R_NPRLIST_BOX_LISTBOX_ITEM3, EListBoxNpr_0xeeb0e481Qgn_menu_nprIndex ); AddListBoxResourceArrayItemL( R_NPRLIST_BOX_LISTBOX_ITEM4, EListBoxNpr_0xeeb0e481Qgn_menu_nprIndex ); AddListBoxResourceArrayItemL( R_NPRLIST_BOX_LISTBOX_ITEM5, EListBoxNpr_0xeeb0e481Qgn_menu_nprIndex ); iListBox->SetFocus( ETrue ); iFocusControl = iListBox; }
/** * Initialize each control upon creation. */ void CMain::InitializeControlsL() { iListBox = new ( ELeave ) CAknDoubleStyleListBox; iListBox->SetContainerWindowL( *this ); { TResourceReader reader; iEikonEnv->CreateResourceReaderLC( reader, R_MAIN_LIST_BOX ); iListBox->ConstructFromResourceL( reader ); CleanupStack::PopAndDestroy(); // reader internal state } // the listbox owns the items in the list and will free them iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray ); // setup the icon array so graphics-style boxes work SetupListBoxIconsL(); iListBox->SetListBoxObserver( this ); AddListBoxEventHandlerL( iListBox, EEventEnterKeyPressed, &CMain::HandleListBoxEnterKeyPressedL ); if (BaflUtils::FileExists(CEikonEnv::Static()->FsSession(),_L("Z:\\System\\install\\Series60v5.3.sis"))) { AddListBoxEventHandlerL( iListBox, EEventItemSingleClicked, &CMain::HandleListBoxItemClickedL ); } else { AddListBoxEventHandlerL( iListBox, EEventItemClicked, &CMain::HandleListBoxItemClickedL ); } // add list items AddListBoxResourceArrayItemL( R_MAIN_LISTBOX_ITEM2 ); AddListBoxResourceArrayItemL( R_MAIN_LISTBOX_ITEM3 ); AddListBoxResourceArrayItemL( R_MAIN_LISTBOX_ITEM4 ); AddListBoxResourceArrayItemL( R_MAIN_LISTBOX_ITEM6 ); AddListBoxResourceArrayItemL( R_MAIN_LISTBOX_ITEM5 ); AddListBoxResourceArrayItemL( R_MAIN_LISTBOX_ITEM1 ); iListBox->SetFocus( ETrue ); iFocusControl = iListBox; }