S60 3rd Edition SDK for Symbian OS
Example Applications Guide

BrCtlSampleAppStateChangeObserver.cpp

00001 /*
00002 * ============================================================================
00003 *  Name        : BrCtlSampleAppStateChangeObserver.cpp
00004 *  Part of     : BrCtlSampleApp
00005 *  Interface   : 
00006 *  Description : Handle state changed 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 "BrCtlSampleAppStateChangeObserver.h"
00019 
00020 // ================= MEMBER FUNCTIONS =======================
00021 
00022 // ---------------------------------------------------------
00023 // CBrCtlSampleAppStateChangeObserver::StateChanged
00024 // ---------------------------------------------------------
00025 //
00026 void 
00027 CBrCtlSampleAppStateChangeObserver::StateChanged(TBrCtlDefs::TBrCtlState aState, 
00028                                                  TInt aValue)
00029     {
00030     // Here we are creating a string to be displayed on the screen, but you would
00031     // implement this method to have code that would be executed when the observer
00032     // receives state changed events.
00033     TBuf16<256> tgt; 
00034     TPoint point(0, 120);
00035 
00036     _LIT(KHandleBrowserStateChange, "State Change event = %d, value = %d");
00037      
00038     tgt.AppendFormat(KHandleBrowserStateChange, aState, aValue);
00039 
00040     iContainer->SetPoint(point);
00041     iContainer->SetText(tgt);
00042 
00043     iContainer->DrawNow();
00044     }
00045 
00046 // ---------------------------------------------------------
00047 // CBrCtlSampleAppStateChangeObserver::ConstructL
00048 // ---------------------------------------------------------
00049 //
00050 void 
00051 CBrCtlSampleAppStateChangeObserver::ConstructL(CBrCtlSampleAppContainer* aContainer)
00052     {
00053     iContainer = aContainer;
00054     }
00055 
00056 // ---------------------------------------------------------
00057 // CBrCtlSampleAppStateChangeObserver::~CBrCtlSampleAppStateChangeObserver
00058 // ---------------------------------------------------------
00059 //
00060 CBrCtlSampleAppStateChangeObserver::~CBrCtlSampleAppStateChangeObserver()
00061     {
00062     }
00063 
00064 
00065 // ---------------------------------------------------------
00066 // CBrCtlSampleAppStateChangeObserver::NewL
00067 // ---------------------------------------------------------
00068 //
00069 CBrCtlSampleAppStateChangeObserver* 
00070 CBrCtlSampleAppStateChangeObserver::NewL(CBrCtlSampleAppContainer* aContainer)
00071 {
00072   CBrCtlSampleAppStateChangeObserver* self = new(ELeave)CBrCtlSampleAppStateChangeObserver;
00073   CleanupStack::PushL(self);
00074   self->ConstructL(aContainer);
00075   CleanupStack::Pop();
00076   return self;
00077 }
00078 
00079 // End of File  
00080 

© Nokia 2006

Back to top