examples/SFExamples/Wikipedia/src/BrowserContainer.cpp

00001 // 
00002 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
00003 // All rights reserved.
00004 // This component and the accompanying materials are made available
00005 // under the terms of the License "Eclipse Public License v1.0"
00006 // which accompanies this distribution, and is available
00007 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00008 // 
00009 // Initial Contributors:
00010 // Nokia Corporation - initial contribution.
00011 // 
00012 // Contributors:
00013 // 
00014 // Description:
00015 // 
00016 
00017 
00018 // INCLUDE FILES
00019 #include "BrowserContainer.h"
00020 #include "BrowserView.h"
00021 #include "SqlSrvDemoAppUi.h"
00022 #include "BrCtlInterface.h"
00023 #include <charconv.h>
00024 
00025 // ========================= MEMBER FUNCTIONS ==================================
00026 
00027 // ----------------------------------------------------------------------------
00028 // CBrowserContainer::CBrowserContainer( CBrowserView& aView )
00029 //
00030 // Constructors for abstract class
00031 // ----------------------------------------------------------------------------
00032 
00033 CBrowserContainer::CBrowserContainer( CBrowserView& aView ):
00034         iView( aView )
00035         {       
00036         // No implementation
00037         }
00038 
00039 // -----------------------------------------------------------------------------
00040 // CAboutContainer::ConstructL()
00041 // Symbian 2nd phase constructor can leave.
00042 // -----------------------------------------------------------------------------
00043 //
00044 
00045 void CBrowserContainer::ConstructL(const TRect& aRect)
00046     {
00047     CreateWindowL();
00048     SetRect( aRect );
00049     ActivateL();   
00050     
00051     iBrowser = CreateBrowserControlL( this, 
00052                 TRect( TPoint( 0, 0 ), aRect.Size() ), 
00053         TBrCtlDefs::ECapabilityDisplayScrollBar | TBrCtlDefs::ECapabilityLoadHttpFw |
00054         TBrCtlDefs::ECapabilityGraphicalHistory | TBrCtlDefs::ECapabilityGraphicalPage,
00055         TBrCtlDefs::ECommandIdBase,
00056         NULL,
00057         NULL,
00058         NULL,
00059         NULL);     
00060     }
00061 
00062 CBrowserContainer::~CBrowserContainer()
00063         {
00064         delete iBrowser;
00065         }
00066 
00067 // -----------------------------------------------------------------------------
00068 // CBrowserContainer::CountComponentControls() const
00069 // returns number of controls inside this container.
00070 // -----------------------------------------------------------------------------
00071 //
00072 
00073 TInt CBrowserContainer::CountComponentControls() const
00074     {
00075     TInt count = 0;
00076     if ( iBrowser )
00077         {
00078         count++;
00079         }
00080     return count;
00081     }
00082 
00083 // -----------------------------------------------------------------------------
00084 // CBrowserContainer::ComponentControl() const
00085 // returns pointer of controls inside this container
00086 // -----------------------------------------------------------------------------
00087 //
00088 
00089 CCoeControl* CBrowserContainer::ComponentControl( TInt aIndex ) const
00090     {
00091     switch ( aIndex )
00092             {
00093             case 0:
00094                 return iBrowser;
00095             default:
00096                 return NULL;
00097             }
00098     }
00099 
00100 // -----------------------------------------------------------------------------
00101 // CBrowserContainer::SizeChanged
00102 // 
00103 // (other items were commented in a header).
00104 // -----------------------------------------------------------------------------
00105 
00106 void CBrowserContainer::SizeChanged()
00107     {
00108     if ( iBrowser )
00109         {
00110         iBrowser->SetRect( Rect() );
00111         }
00112     }
00113 
00114 // -----------------------------------------------------------------------------
00115 // CBrowserContainer::HandleResourceChange
00116 // 
00117 // (other items were commented in a header).
00118 // -----------------------------------------------------------------------------
00119 //
00120 
00121 void CBrowserContainer::HandleResourceChange( TInt aType )
00122     {
00123     CCoeControl::HandleResourceChange( aType );
00124     if ( aType == KEikDynamicLayoutVariantSwitch )
00125         {
00126         SetRect((iView).ClientRect() );
00127         }
00128      }
00129 
00130 void CBrowserContainer::ScrollBrowserToTopL()
00131         {
00132     // In some cases the browser displays the record starting in the middle
00133     // This passes a scroll up event in the browser so that display is at the top
00134     TKeyEvent keyEvent;
00135     keyEvent.iCode = EKeyUpArrow;
00136     keyEvent.iScanCode = 17;
00137     keyEvent.iModifiers = 32769;
00138     keyEvent.iRepeats = 0;
00139     TEventCode type;
00140     type = EEventKey;
00141     iBrowser->OfferKeyEventL( keyEvent, type ); 
00142         }
00143         
00144 // End of File

Generated by  doxygen 1.6.2