void CPositionDisplay::MakeVisible(TBool aVisible) { CCoeControl::MakeVisible(aVisible); for(TInt i = 0; i < CountComponentControls(); ++i){ ComponentControl(i)->MakeVisible(aVisible); } }
/** @SYMTestCaseID UIF-TCone6Step-TestRemoveControlById @SYMPREQ @SYMTestCaseDesc Removes a component with Id KChildTwoID using API RemoveComponentById.\n @SYMTestPriority High @SYMTestStatus Implemented @SYMTestActions : Removes a component control using Component Id.\n Removes a component with Id KChildTwoID using API RemoveComponentById.\n The API removes a component control from a component array. It also sets the component's parent to <code>NULL</code>.\n The component control is later deleted.\n @SYMTestExpectedResults : Boolean, True if Component control is deleted.\n @SYMTestType : CIT */ TBool CCtlContainer::TestRemoveControlById() { TBool seemsOK ; TInt count = CountComponentControls() ; CCoeControl* runt = NULL ; runt = Components().RemoveById( KChildTwoID ) ; seemsOK = ( ( runt != NULL ) && ( CountComponentControls() == (count - 1) )) ; // So far, so good. This is a good time to test RemoveComponent() for non-existant if ( seemsOK ) { TInt err = Components().Remove( runt ) ; // should return KErrNotFound seemsOK = ( err == KErrNotFound ) ; } delete runt ; return seemsOK ; }
//Recursively drill down to each control level and step their frame counters. void CComponentControl::AnimateComponents() { for (TInt i=0; i<CountComponentControls(); i++) { CTestRectGc* pComponent = (CTestRectGc*)ComponentControl(i); pComponent->NextFrame(); if (pComponent->CountComponentControls()) ((CComponentControl*)pComponent)->AnimateComponents(); } }
//Destroy component controls within this control CComponentControl::~CComponentControl() { while (CountComponentControls()) { CCoeControl *pControl; pControl = ComponentControl(0); Components().Remove(pControl); delete pControl; } }
/** Sets the size of the component objects based on the present size of the container window.\n Calculates the present size of the container control and also the number of component objects.\n Sets the component object dimensions accordingly.\n */ void CCtlContainer::SizeChanged() { // set the size of the children TRect rect = Rect() ; TSize size = rect.Size() ; TPoint tl = rect.iTl ; TInt childCount = CountComponentControls() ; if ( childCount > 0 ) { size.iWidth = size.iWidth/childCount ; size.iHeight = size.iHeight/childCount ; CCoeControl* child ; for ( TInt ii = 0; ii < childCount ; ++ii ) { child = ComponentControl( ii ) ; child->SetRect( TRect( tl, size ) ) ; tl.iX += size.iWidth ; tl.iY += size.iHeight ; } } }
/** @SYMTestCaseID UIF-TCone6Step-TestCleanupL @SYMPREQ @SYMTestCaseDesc The functions tests clean up after forced memory fail.\n @SYMTestPriority High @SYMTestStatus Implemented @SYMTestActions : The functions tests clean up after forced memory fail.\n The present number of component controls is obtained using CountComponentControls.\n The next memory allocation is caused to fail using macro "__UHEAP_FAILNEXT".\n A new component is added using AddComponentByIdLC API.\n The number of component controls should remain the same after memory allocation failure also .\n @SYMTestExpectedResults : Boolean, True if Clean up is successful after memory allocation failure.\n @SYMTestType : CIT */ TBool CCtlContainer::TestCleanupL() { TBool seemsOK = EFalse ; // Initial count of controls TInt count = CountComponentControls() ; // Create a new control to add to the array CCtlContainee* child = NULL ; child = new (ELeave) CCtlContainee ; // Set memory allocation to fail __UHEAP_MARK ; __UHEAP_SETFAIL((RHeap::EDeterministic),1); // Expect addition of the control to the array to fail TRAPD(err, { Components().AppendLC( child ); CleanupStack::Pop(child); } );
__UHEAP_SETFAIL((RHeap::EDeterministic),1); // Expect addition of the control to the array to fail TRAPD(err, { Components().AppendLC( child ); CleanupStack::Pop(child); } ); // Re-align the heap __UHEAP_RESET ; __UHEAP_MARKEND ; // The no of controls should be the same as at the start // as appending should have failed with KErrNoMemory seemsOK = ( (count == CountComponentControls()) && (err == KErrNoMemory)) ; return seemsOK ; } /** @SYMTestCaseID UIF-TCone6Step-TestGetControlL @SYMPREQ @SYMTestCaseDesc Tests the ability to obtain handle to the component control using Component Id.\n @SYMTestPriority High @SYMTestStatus Implemented
// ----------------------------------------------------------------------------- // CTestSettingPage::TestCountComponentControls // ----------------------------------------------------------------------------- // TInt CTestSettingPage::TestCountComponentControls() const { return CountComponentControls(); }
// ----------------------------------------------------------------------------- // CTestTitlePane::DoCountComponentControls // ----------------------------------------------------------------------------- // TInt CTestTitlePane::DoCountComponentControls() { return CountComponentControls(); }