// ---------------------------------------------------------------------------
// CAknPointerEventModifier::Push
// ---------------------------------------------------------------------------
//
EXPORT_C void CAknPointerEventModifier::Push( CCoeControl& aControl, 
    const TRect& aRect )
    {
    // Figure out aControl's window-owning parent. This will also work as a
    // sanity check for the aControl argument.
    CCoeControl* parent = aControl.Parent();
    
    while ( parent && !parent->OwnsWindow() )
        {
        parent = parent->Parent();
        }
        
    if ( !parent )
        {
        return;
        }
    
    if ( !ControlIsInStack( aControl ) )
        {
        TStackItem item;
        item.iControl = &aControl;
        item.iParent = parent;
        item.iExtensionArea = aRect;
        
        if ( iStack.Insert( item, 0 ) == KErrNone )
            {
            iIsValid = EFalse;
            }
        }
    }
Пример #2
0
/**
   Auxiliary function for all Test Cases
  
   The method is an override from CTestAppUi. The method initiates border
   drawing tests.
   
 */
void CSimpleParentAppUi::RunTestStepL(TInt aNextStep)
	{
	switch(aNextStep)
		{
		case 1:	
			{
			INFO_PRINTF1(_L("Test Parent - does the control have the view as its parent?"));
			
			// Get the control on the appview
			CCoeControl *control = iParentAppView->GetControl();
			
			if (control == NULL)
				{
				TEST(control != NULL); // generates a fail automatically
				INFO_PRINTF1(_L("Could not get control from appview - test failed"));
				break;
				}
				
			// Get the parent of that control
			CCoeControl *parent = control->Parent();
			
			// Check that there is a parent to begin with
			if (parent==NULL)
				{
				TEST(parent != NULL); // generates a fail automatically
				INFO_PRINTF1(_L("Control does not have a parent - test failed"));
				break;
				}
				
			// Check that the parent is the same as the view
			TEST(parent == iParentAppView);
				
			if (parent != iParentAppView)
				{
				INFO_PRINTF1(_L("View is not parent of Control - test failed"));
				}
				else
				{
				INFO_PRINTF1(_L("View is parent of Control - test PASSED"));
				}
				
			}
			break;
			
		case 2:
			AutoTestManager().FinishAllTestCases(CAutoTestManager::EPass);
			break;
		default:
			break;
		}
	}