classicui_pub/buttons_api/tsrc/src/testsdkbuttonscontainer.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:  functions implement in container.h
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <coeaui.h>
       
    20 #include "testsdkbuttonscontainer.h"
       
    21 
       
    22 // -----------------------------------------------------------------------------
       
    23 // CButtonControl::CButtonControl
       
    24 // -----------------------------------------------------------------------------
       
    25 //
       
    26 CButtonControl::CButtonControl() : iControl(NULL)
       
    27 {}
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CButtonControl::~CButtonControl
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 CButtonControl::~CButtonControl()
       
    34     {
       
    35     CCoeEnv::Static()->AppUi()->RemoveFromStack( this );
       
    36     }
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // CButtonControl::NewL
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 CButtonControl* CButtonControl::NewL( TRect& aRect )
       
    43     {
       
    44     CButtonControl* self = new ( ELeave ) CButtonControl;
       
    45     CleanupStack::PushL( self );
       
    46     self->ConstructL( aRect );
       
    47     CCoeEnv::Static()->AppUi()->AddToStackL( self );
       
    48     CleanupStack::Pop( self );
       
    49     return self;
       
    50     }
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CButtonControl::ConsturnctL
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 void CButtonControl::ConstructL( TRect& aRect )
       
    57     {
       
    58     CreateWindowL();
       
    59     SetRect( aRect );
       
    60     ActivateL();
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // CButtonControl::SetComponentControlL
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 void CButtonControl::SetComponentControlL( CCoeControl* aControl )
       
    68     {
       
    69     iControl = aControl;
       
    70     iControl->SetExtent( Rect().iTl, iControl->MinimumSize() );
       
    71     iControl->ActivateL();
       
    72     }
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 // CButtonControl::ResetComponentControl
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 void CButtonControl::ResetComponentControl()
       
    79     {
       
    80     iControl = NULL;
       
    81     }
       
    82 // -----------------------------------------------------------------------------
       
    83 // CButtonControl::CountComponentControls
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 TInt CButtonControl::CountComponentControls() const
       
    87     {
       
    88     if ( iControl )
       
    89         {
       
    90         return 1;
       
    91         }
       
    92     else
       
    93         {
       
    94         return 0;
       
    95         }
       
    96     }
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // CButtonControl::ComponentControl
       
   100 // -----------------------------------------------------------------------------
       
   101 //
       
   102 CCoeControl* CButtonControl::ComponentControl( TInt /*aIndex*/ ) const
       
   103     {
       
   104     return iControl;
       
   105     }
       
   106 
       
   107 // -----------------------------------------------------------------------------
       
   108 // CButtonControl::ConsturnctL
       
   109 // -----------------------------------------------------------------------------
       
   110 //
       
   111 void CButtonControl::ProcessCommandL( TInt /*aCommandId*/ )
       
   112     {
       
   113     // Nothing to do
       
   114     }
       
   115 
       
   116 // -----------------------------------------------------------------------------
       
   117 // CButtonControl::ActivateGc
       
   118 // -----------------------------------------------------------------------------
       
   119 //
       
   120 void CButtonControl::ActivateGc()
       
   121     {
       
   122     CCoeControl::ActivateGc();
       
   123     }
       
   124 
       
   125 // -----------------------------------------------------------------------------
       
   126 // CButtonControl::DeactivateGc
       
   127 // -----------------------------------------------------------------------------
       
   128 //
       
   129 void CButtonControl::DeactivateGc()
       
   130     {
       
   131     CCoeControl::DeactivateGc();
       
   132     }
       
   133 
       
   134 // End of file
       
   135