classicui_plat/physics_api/tsrc/src/testplatphysicscontrol.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Test aknphysics.h
       
    15 *
       
    16 */
       
    17 
       
    18 #include <coeaui.h>
       
    19 #include "testplatphysicscontrol.h"
       
    20 
       
    21 // -----------------------------------------------------------------------------
       
    22 // CPhysicsControl::CPhysicsControl
       
    23 // -----------------------------------------------------------------------------
       
    24 //
       
    25 CPhysicsControl::CPhysicsControl() : iControl(NULL)
       
    26 {}
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // CPhysicsControl::~CPhysicsControl
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 CPhysicsControl::~CPhysicsControl()
       
    33     {
       
    34     CCoeEnv::Static()->AppUi()->RemoveFromStack( this );
       
    35     }
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CPhysicsControl::NewL
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 CPhysicsControl* CPhysicsControl::NewL( TRect& aRect )
       
    42     {
       
    43     CPhysicsControl* self = new ( ELeave ) CPhysicsControl;
       
    44     CleanupStack::PushL( self );
       
    45     self->ConstructL( aRect );
       
    46     CCoeEnv::Static()->AppUi()->AddToStackL( self );
       
    47     CleanupStack::Pop( self );
       
    48     return self;
       
    49     }
       
    50 
       
    51 // -----------------------------------------------------------------------------
       
    52 // CPhysicsControl::ConsturnctL
       
    53 // -----------------------------------------------------------------------------
       
    54 //
       
    55 void CPhysicsControl::ConstructL( TRect& aRect )
       
    56     {
       
    57     CreateWindowL();
       
    58     SetRect( aRect );
       
    59     ActivateL();
       
    60     }
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // CPhysicsControl::SetComponentControlL
       
    64 // -----------------------------------------------------------------------------
       
    65 //
       
    66 void CPhysicsControl::SetComponentControlL( CCoeControl* aControl )
       
    67     {
       
    68     iControl = aControl;
       
    69     iControl->SetExtent( Rect().iTl, iControl->MinimumSize() );
       
    70     iControl->ActivateL();
       
    71     }
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // CPhysicsControl::ResetComponentControl
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 void CPhysicsControl::ResetComponentControl()
       
    78     {
       
    79     iControl = NULL;
       
    80     }
       
    81 // -----------------------------------------------------------------------------
       
    82 // CPhysicsControl::CountComponentControls
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 TInt CPhysicsControl::CountComponentControls() const
       
    86     {
       
    87     if ( iControl )
       
    88         {
       
    89         return 1;
       
    90         }
       
    91     else
       
    92         {
       
    93         return 0;
       
    94         }
       
    95     }
       
    96 
       
    97 // -----------------------------------------------------------------------------
       
    98 // CPhysicsControl::ComponentControl
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 CCoeControl* CPhysicsControl::ComponentControl( TInt /*aIndex*/ ) const
       
   102     {
       
   103     return iControl;
       
   104     }
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 // CPhysicsControl::ConsturnctL
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 void CPhysicsControl::ProcessCommandL( TInt /*aCommandId*/ )
       
   111     {
       
   112     // Nothing to do
       
   113     }
       
   114 // End of file
       
   115