browserui/browser/BrowserAppSrc/BrowserInitialContainer.cpp
branchRCL_3
changeset 48 8e6fa1719340
parent 0 84ad3b177aa3
equal deleted inserted replaced
47:6385c4c93049 48:8e6fa1719340
       
     1 /*
       
     2 * Copyright (c) 2006 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 the License "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: 
       
    15 *      Implementation of CBrowserInitialContainer.
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 
       
    23 #include <AknLists.h>
       
    24 #include <BrowserNG.rsg>
       
    25 #include <barsread.h>
       
    26 #include <browser.mbg>
       
    27 #include <AknsUtils.h>
       
    28 #include <data_caging_path_literals.hrh>
       
    29 #include "BrowserInitialContainer.h"
       
    30 #include "CommonConstants.h"
       
    31 #include "BrowserInitialView.h"
       
    32 #include "BrowserAppUi.h"
       
    33 #include "BrowserUIVariant.hrh"
       
    34 #include "Display.h"
       
    35 #include "BrowserGotoPane.h"
       
    36 
       
    37 
       
    38 // ================= MEMBER FUNCTIONS =======================
       
    39 
       
    40 // ---------------------------------------------------------
       
    41 // CBrowserInitialContainer::CBrowserInitialContainer
       
    42 // ---------------------------------------------------------
       
    43 //
       
    44 CBrowserInitialContainer::CBrowserInitialContainer( CBrowserInitialView *aView ) : iView( aView )
       
    45     {
       
    46     // 
       
    47     }
       
    48     
       
    49 // ---------------------------------------------------------
       
    50 // CBrowserInitialContainer::ConstructL
       
    51 // ---------------------------------------------------------
       
    52 //
       
    53 void CBrowserInitialContainer::ConstructL(const TRect& aRect)
       
    54     {
       
    55     CreateWindowL();	
       
    56 
       
    57     // Set view title
       
    58 	iView->ApiProvider().Display().SetTitleL( TitleResourceId() );
       
    59 		
       
    60 
       
    61 	// Create gotopane
       
    62     iGotoPane = CBrowserGotoPane::NewL( this );
       
    63     
       
    64     SetRect(aRect);	
       
    65     ActivateL();
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------
       
    69 // CBrowserInitialContainer::~CBrowserInitialContainer
       
    70 // ---------------------------------------------------------
       
    71 //
       
    72 CBrowserInitialContainer::~CBrowserInitialContainer()
       
    73     {
       
    74     delete iGotoPane;
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------
       
    78 // CBrowserInitialContainer::SizeChanged
       
    79 // ---------------------------------------------------------
       
    80 //
       
    81 void CBrowserInitialContainer::SizeChanged()
       
    82     {
       
    83    
       
    84 	iGotoPane->HandleFindSizeChanged();	
       
    85     }
       
    86 
       
    87 // ---------------------------------------------------------
       
    88 // CBrowserInitialContainer::CountComponentControls
       
    89 // ---------------------------------------------------------
       
    90 //
       
    91 TInt CBrowserInitialContainer::CountComponentControls() const
       
    92     {
       
    93     return 1; // return number of controls inside this container
       
    94     }
       
    95 
       
    96 // ---------------------------------------------------------
       
    97 // CBrowserInitialContainer::ComponentControl
       
    98 // ---------------------------------------------------------
       
    99 //
       
   100 CCoeControl* CBrowserInitialContainer::ComponentControl( TInt aIndex ) const
       
   101     {
       
   102     switch ( aIndex )
       
   103         {
       
   104         case 0:
       
   105 			return iGotoPane;
       
   106         default:
       
   107             return NULL;
       
   108         }
       
   109     }
       
   110 
       
   111 // ---------------------------------------------------------
       
   112 // CBrowserInitialContainer::Draw
       
   113 // ---------------------------------------------------------
       
   114 //
       
   115 void CBrowserInitialContainer::Draw( const TRect& aRect ) const
       
   116     {
       
   117     CWindowGc& gc = SystemGc();
       
   118     
       
   119     // example code...
       
   120     gc.SetPenStyle( CGraphicsContext::ENullPen );
       
   121     gc.SetBrushColor( KRgbGray );
       
   122     gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   123     gc.DrawRect( aRect );
       
   124     }
       
   125 
       
   126 // ---------------------------------------------------------
       
   127 // CBrowserInitialContainer::HandleControlEventL
       
   128 // ---------------------------------------------------------
       
   129 //
       
   130 void CBrowserInitialContainer::HandleControlEventL( CCoeControl* /*aControl*/,
       
   131                                                     TCoeEvent /*aEventType*/ )
       
   132     {
       
   133     // control event handler code here
       
   134     }
       
   135 
       
   136 	
       
   137 
       
   138 // ----------------------------------------------------------------------------
       
   139 // CBrowserInitialContainer::OfferKeyEventL
       
   140 // ----------------------------------------------------------------------------
       
   141 //    
       
   142 TKeyResponse CBrowserInitialContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
       
   143 	{
       
   144     CBrowserAppUi* ui = CBrowserAppUi::Static();
       
   145     TKeyResponse result( EKeyWasNotConsumed );
       
   146 
       
   147 	if (ui->OfferApplicationSpecificKeyEventL(aKeyEvent, aType) == EKeyWasConsumed)
       
   148 		{
       
   149 		return EKeyWasConsumed;
       
   150 		}
       
   151 
       
   152     // If goto pane is visible, offer key events to it
       
   153 	if ( iGotoPane->IsVisible() )
       
   154 		{
       
   155 		result = iGotoPane->OfferKeyEventL( aKeyEvent, aType );
       
   156 		}
       
   157 
       
   158     return result;
       
   159 	}
       
   160 
       
   161 // ---------------------------------------------------------
       
   162 // CBrowserInitialContainer::TitleResourceId
       
   163 // ---------------------------------------------------------
       
   164 //
       
   165 TInt CBrowserInitialContainer::TitleResourceId()
       
   166     {
       
   167     return R_BROWSER_INITIAL_VIEW_TITLE;
       
   168     }			
       
   169     
       
   170 //---------------------------------------------------------------------------
       
   171 // CBrowserInitialContainer::ShutDownGotoURLEditorL
       
   172 // ---------------------------------------------------------------------------
       
   173 //
       
   174 void CBrowserInitialContainer::ShutDownGotoURLEditorL()
       
   175     {
       
   176     iGotoPane->MakeVisible( EFalse );
       
   177     iGotoPane->SetFocus( EFalse );
       
   178     SetFocus( ETrue );
       
   179     }    
       
   180     
       
   181 // End of File