phoneuis/dialer/tsrc/public/basic/T_VideoDtmfDialer/src/T_VideoDtmfDialerAppView.cpp
changeset 0 5f000ab63145
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Implementation of CT_VideoDtmfDialerAppView class.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <coemain.h>
       
    19 #include <aknutils.h> 
       
    20 #include <AknLayout.cdl.h>
       
    21 #include <LayoutMetaData.cdl.h>
       
    22 #include <AknLayoutScalable_Apps.cdl.h>
       
    23 #include <AknLayoutScalable_Avkon.cdl.h>
       
    24 #include <eikenv.h>
       
    25 #include <eikapp.h> 
       
    26 #include <eikappui.h>
       
    27 #include <AknAppUi.h>
       
    28 #include <eikspane.h>
       
    29 
       
    30 #include <mnumberentry.h>
       
    31 #include <cdialer.h>
       
    32 #include <cvideodtmfdialer.h>
       
    33 
       
    34 #include "T_VideoDtmfDialerAppView.h"
       
    35 
       
    36 const TUid KUidViewId = { 0x10282DDD };
       
    37 
       
    38 // Standard construction sequence
       
    39 CT_VideoDtmfDialerAppView* CT_VideoDtmfDialerAppView::NewL(const TRect& aRect)
       
    40     {
       
    41     CT_VideoDtmfDialerAppView* self = CT_VideoDtmfDialerAppView::NewLC(aRect);
       
    42     CleanupStack::Pop(self);
       
    43     return self;
       
    44     }
       
    45 
       
    46 CT_VideoDtmfDialerAppView* CT_VideoDtmfDialerAppView::NewLC(const TRect& aRect)
       
    47     {
       
    48     CT_VideoDtmfDialerAppView* self = new (ELeave) CT_VideoDtmfDialerAppView();
       
    49     CleanupStack::PushL(self);
       
    50     self->ConstructL(aRect);
       
    51     return self;
       
    52     }
       
    53 
       
    54 CT_VideoDtmfDialerAppView::CT_VideoDtmfDialerAppView() 
       
    55     {
       
    56     }
       
    57 
       
    58 CT_VideoDtmfDialerAppView::~CT_VideoDtmfDialerAppView()
       
    59     {
       
    60 	// no implementation required
       
    61     }
       
    62 
       
    63 void CT_VideoDtmfDialerAppView::ConstructL(const TRect& aRect)
       
    64     {
       
    65     // Create a window for this application view
       
    66     CreateWindowL();
       
    67 
       
    68     // Set the windows size
       
    69     SetRect(aRect);
       
    70 
       
    71     // Activate the window, which makes it ready to be drawn
       
    72     ActivateL();
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CT_VideoDtmfDialerAppView::ViewId
       
    77 // -----------------------------------------------------------------------------
       
    78 //
       
    79 TVwsViewId CT_VideoDtmfDialerAppView::ViewId() const
       
    80     {
       
    81     TVwsViewId id( 
       
    82         CEikonEnv::Static()->EikAppUi()->Application()->AppDllUid(), 
       
    83         KUidViewId );
       
    84     return id;
       
    85     }
       
    86 
       
    87 // -----------------------------------------------------------------------------
       
    88 // CT_VideoDtmfDialerAppView::ViewActivatedL
       
    89 // -----------------------------------------------------------------------------
       
    90 //
       
    91 void CT_VideoDtmfDialerAppView::ViewActivatedL( 
       
    92     const TVwsViewId& /*aPrevViewId*/, 
       
    93     TUid /*aCustomMessageId*/, 
       
    94     const TDesC8& /*aCustomMessage*/ )
       
    95     {
       
    96     MakeVisible( ETrue );
       
    97     SetFocus( IsFocused() );
       
    98     DrawDeferred();
       
    99     }
       
   100 
       
   101 // -----------------------------------------------------------------------------
       
   102 // CT_VideoDtmfDialerAppView::ViewDeactivated
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 void CT_VideoDtmfDialerAppView::ViewDeactivated()
       
   106     {
       
   107     DrawDeferred();
       
   108     }
       
   109 
       
   110 // -----------------------------------------------------------------------------
       
   111 // CT_VideoDtmfDialerAppView::CountComponentControls
       
   112 // -----------------------------------------------------------------------------
       
   113 //
       
   114 TInt CT_VideoDtmfDialerAppView::CountComponentControls() const
       
   115     {
       
   116     TInt count = 0;
       
   117 
       
   118     if ( iControl )
       
   119         {
       
   120         count++;
       
   121         }
       
   122         
       
   123     return count;
       
   124     }
       
   125 
       
   126 // -----------------------------------------------------------------------------
       
   127 // CT_VideoDtmfDialerAppView::ComponentControl
       
   128 // -----------------------------------------------------------------------------
       
   129 //
       
   130 CCoeControl* CT_VideoDtmfDialerAppView::ComponentControl( TInt /*aIndex*/ ) const
       
   131     {
       
   132     CCoeControl* control( NULL );
       
   133 
       
   134     if ( iControl )
       
   135         {
       
   136         control = iControl;
       
   137         }
       
   138 
       
   139     return control;        
       
   140     }
       
   141 
       
   142 // -----------------------------------------------------------------------------
       
   143 // CT_VideoDtmfDialerAppView::OfferKeyEventL
       
   144 // -----------------------------------------------------------------------------
       
   145 //    
       
   146 TKeyResponse CT_VideoDtmfDialerAppView::OfferKeyEventL(
       
   147     const TKeyEvent& aKeyEvent,
       
   148     TEventCode aType)
       
   149     {
       
   150     TKeyResponse response = EKeyWasNotConsumed;
       
   151     if( iControl && iNumberEntry)
       
   152         {
       
   153         CCoeControl* numberEntryControl = iNumberEntry->GetNumberEntry();
       
   154         if( numberEntryControl )
       
   155             {
       
   156             response = numberEntryControl->OfferKeyEventL( aKeyEvent, aType );    
       
   157             }
       
   158         }
       
   159     return response;
       
   160     }
       
   161     
       
   162 // -----------------------------------------------------------------------------
       
   163 // CT_VideoDtmfDialerAppView::SetControl
       
   164 // -----------------------------------------------------------------------------
       
   165 //    
       
   166 void CT_VideoDtmfDialerAppView::SetControl( CCoeControl* aControl, TBool aDrawNow )
       
   167     {
       
   168     if ( iControl )
       
   169         {
       
   170         iControl->SetFocus( EFalse );
       
   171         iPrevControl = iControl;    
       
   172         }
       
   173     
       
   174     iControl = aControl;
       
   175     
       
   176     if ( iControl )
       
   177         {
       
   178         UpdateControlRect();
       
   179         
       
   180         if ( iPrevControl )
       
   181             {
       
   182             iPrevControl->MakeVisible( EFalse );        
       
   183             iPrevControl = NULL;
       
   184             }
       
   185         
       
   186         iControl->MakeVisible( ETrue );
       
   187         DrawNow();
       
   188         iControl->SetFocus( IsFocused() );
       
   189         }
       
   190     
       
   191     if ( aDrawNow )        
       
   192         {
       
   193         DrawNow();    
       
   194         }
       
   195     }
       
   196     
       
   197 // -----------------------------------------------------------------------------
       
   198 // CT_VideoDtmfDialerAppView::Control
       
   199 // -----------------------------------------------------------------------------
       
   200 //    
       
   201 CCoeControl* CT_VideoDtmfDialerAppView::Control() const
       
   202     {
       
   203     return iControl;    
       
   204     }    
       
   205 
       
   206 // -----------------------------------------------------------------------------
       
   207 // CT_VideoDtmfDialerAppView::SetNumberEntry
       
   208 // -----------------------------------------------------------------------------
       
   209 //    
       
   210 void CT_VideoDtmfDialerAppView::SetNumberEntry( MNumberEntry* aNumberEntry )
       
   211     {
       
   212     iNumberEntry = aNumberEntry;
       
   213     }
       
   214 
       
   215 void CT_VideoDtmfDialerAppView::SizeChanged()
       
   216     {
       
   217     UpdateControlRect();
       
   218     }
       
   219 
       
   220 // -----------------------------------------------------------------------------
       
   221 // CT_VideoDtmfDialerAppView::UpdateControlRect
       
   222 // -----------------------------------------------------------------------------
       
   223 //
       
   224 void CT_VideoDtmfDialerAppView::UpdateControlRect()
       
   225     {    
       
   226     if ( iControl )
       
   227         {
       
   228         iControl->SetRect( Rect() );
       
   229         }
       
   230     }
       
   231     
       
   232 // -----------------------------------------------------------------------------
       
   233 // CT_VideoDtmfDialerAppView::ActivateL
       
   234 // -----------------------------------------------------------------------------
       
   235 //
       
   236 void CT_VideoDtmfDialerAppView::ActivateL()
       
   237     {
       
   238     CCoeControl::ActivateL();
       
   239     }
       
   240     
       
   241 // -----------------------------------------------------------------------------
       
   242 // CT_VideoDtmfDialerAppView::Draw
       
   243 // -----------------------------------------------------------------------------
       
   244 //    
       
   245 void CT_VideoDtmfDialerAppView::Draw(const TRect& aRect ) const
       
   246     {
       
   247     // Get the standard graphics context 
       
   248     CWindowGc& gc = SystemGc();
       
   249     gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   250     gc.SetBrushColor( KRgbGreen );
       
   251     // Gets the control's extent
       
   252     // Clears the screen
       
   253     gc.Clear(aRect);
       
   254     }
       
   255 
       
   256 // End of file 
       
   257