S60 3rd Edition SDK for Symbian OS
Example Applications Guide

BrCtlSampleAppLayoutObserver.cpp

00001 /*
00002 * ============================================================================
00003 *  Name        : BrCtlSampleAppLayoutObserver.cpp
00004 *  Part of     : BrCtlSampleApp
00005 *  Interface   : Browser Control API
00006 *  Description : Handle scrollbar and tab events
00007 *  Version     : 
00008 *
00009 *  Copyright (c) 2005-2006 Nokia Corporation.
00010 *  This material, including documentation and any related 
00011 *  computer programs, is protected by copyright controlled by 
00012 *  Nokia Corporation.
00013 * ============================================================================
00014 */
00015 
00016 // INCLUDE FILES
00017 #include "BrCtlSampleAppContainer.h"
00018 #include "BrCtlSampleAppLayoutObserver.h"
00019 
00020 // ================= MEMBER FUNCTIONS =======================
00021 
00022 // ---------------------------------------------------------
00023 // CBrCtlSampleAppLayoutObserver::UpdateBrowserVScrollBarL
00024 // ---------------------------------------------------------
00025 //
00026 void CBrCtlSampleAppLayoutObserver::UpdateBrowserVScrollBarL(TInt aDocumentHeight, 
00027                                                              TInt aDisplayHeight,
00028                                                              TInt aDisplayPosY ) 
00029     {
00030     // Here we are creating a text string that will be displayed on the screen
00031     // But if you were implementing this method, you most likely would be implementing
00032     // your own scroll bars here.
00033     TBuf16<256> tgt;
00034     TPoint point(0, 220);
00035 
00036     _LIT(KUpdateScrollbar, "Doc Height=%d, Dis Height=%d, Dis Pos=%d");
00037 
00038     tgt.AppendFormat(KUpdateScrollbar, aDocumentHeight, aDisplayHeight, aDisplayPosY);
00039 
00040     iContainer->SetPoint(point);
00041     iContainer->SetText(tgt);
00042 
00043     iContainer->DrawNow();
00044     }
00045 
00046 // ---------------------------------------------------------
00047 // CBrCtlSampleAppLayoutObserver::UpdateBrowserHScrollBarL
00048 // ---------------------------------------------------------
00049 //
00050 void CBrCtlSampleAppLayoutObserver::UpdateBrowserHScrollBarL(TInt aDocumentWidth, 
00051                                       TInt aDisplayWidth,
00052                                       TInt aDisplayPosX ) 
00053     {
00054     // Here we are creating a text string that will be displayed on the screen
00055     // But if you were implementing this method, you most likely would be implementing
00056     // your own scroll bars here.
00057     TBuf16<256> tgt;
00058     TPoint point(0, 130);
00059 
00060     _LIT(KUpdateScrollbar, "Doc Width=%d, Dis Width=%d, Dis Pos=%d");
00061         
00062     tgt.AppendFormat(KUpdateScrollbar, aDocumentWidth, aDisplayWidth, aDisplayPosX);
00063 
00064     iContainer->SetPoint(point);
00065     iContainer->SetText(tgt);
00066 
00067     iContainer->DrawNow();
00068     }
00069 
00070 // ---------------------------------------------------------
00071 // CBrCtlSampleAppLayoutObserver::NotifyLayoutChange
00072 // ---------------------------------------------------------
00073 //
00074 void CBrCtlSampleAppLayoutObserver::NotifyLayoutChange( TBrCtlLayout aNewLayout ) 
00075     {
00076     TBuf16<256> tgt;
00077     TPoint point(0, 120);
00078 
00079     _LIT(KUpdateLayout, "New layout is  %d");
00080 
00081     tgt.AppendFormat(KUpdateLayout, aNewLayout);
00082 
00083     iContainer->SetPoint(point);
00084     iContainer->SetText(tgt);
00085 
00086     iContainer->DrawNow();
00087     }
00088 
00089 // ---------------------------------------------------------
00090 // CBrCtlSampleAppLayoutObserver::UpdateTitle
00091 // ---------------------------------------------------------
00092 //
00093 void CBrCtlSampleAppLayoutObserver::UpdateTitleL( const TDesC& /*aTitle*/ )
00094     {
00095     }
00096 
00097 //----------------------------------------------------------
00098 // CBrCtlSampleAppLayoutObserver::ConstructL
00099 // ---------------------------------------------------------
00100 //
00101 void CBrCtlSampleAppLayoutObserver::ConstructL(CBrCtlSampleAppContainer* aContainer)
00102     {
00103     iContainer = aContainer;
00104     }
00105 
00106 // ---------------------------------------------------------
00107 // CBrCtlSampleAppObserver::~CBrCtlSampleAppObserver
00108 // ---------------------------------------------------------
00109 //
00110 CBrCtlSampleAppLayoutObserver::~CBrCtlSampleAppLayoutObserver()
00111     {
00112     }
00113 
00114 
00115 // ---------------------------------------------------------
00116 // CBrCtlSampleAppObserver::NewL
00117 // ---------------------------------------------------------
00118 //
00119 CBrCtlSampleAppLayoutObserver* CBrCtlSampleAppLayoutObserver::NewL(CBrCtlSampleAppContainer* aContainer)
00120 {
00121   CBrCtlSampleAppLayoutObserver* self = new(ELeave)CBrCtlSampleAppLayoutObserver();
00122   CleanupStack::PushL(self);
00123   self->ConstructL(aContainer);
00124   CleanupStack::Pop();
00125   return self;
00126 }
00127 
00128 // End of File  
00129 

© Nokia 2006

Back to top