|
Nokia N97 SDK Example Applications Guide |
#include <BrCtlSampleAppContainer.h>
Inheritance diagram for CBrCtlSampleAppContainer:

Definition at line 38 of file BrCtlSampleAppContainer.h.
|
|
|
EPOC default constructor.
Definition at line 42 of file BrCtlSampleAppContainer.cpp. References iBrCtlCapabilities, iBrCtlInterface, iBrCtlSampleAppDialogsProvider, iBrCtlSampleAppLayoutObserver, iBrCtlSampleAppLinkResolver, iBrCtlSampleAppLoadEventObserver, iBrCtlSampleAppSoftkeysObserver, iBrCtlSampleAppSpecialLoadObserver, iBrCtlSampleAppStateChangeObserver, iCommandBase, iFbsScrDev, iFont, iPoint, iText, CBrCtlSampleAppDialogsProvider::NewL(), CBrCtlSampleAppStateChangeObserver::NewL(), CBrCtlSampleAppLinkResolver::NewL(), CBrCtlSampleAppLoadEventObserver::NewL(), CBrCtlSampleAppSoftkeysObserver::NewL(), CBrCtlSampleAppLayoutObserver::NewL(), and CBrCtlSampleAppSpecialLoadObserver::NewL(). Referenced by CBrCtlSampleAppUi::ConstructL(). 00043 { 00044 CreateWindowL(); 00045 SetRect(aRect); 00046 ActivateL(); 00047 00048 iCommandBase = TBrCtlDefs::ECommandIdBase; 00049 00050 // Create the Observers 00051 iBrCtlSampleAppSpecialLoadObserver = CBrCtlSampleAppSpecialLoadObserver::NewL(); 00052 iBrCtlSampleAppLayoutObserver = CBrCtlSampleAppLayoutObserver::NewL(this); 00053 iBrCtlSampleAppSoftkeysObserver = CBrCtlSampleAppSoftkeysObserver::NewL(this); 00054 iBrCtlSampleAppLoadEventObserver = CBrCtlSampleAppLoadEventObserver::NewL(this); 00055 iBrCtlSampleAppLinkResolver = CBrCtlSampleAppLinkResolver::NewL(); 00056 iBrCtlSampleAppStateChangeObserver = CBrCtlSampleAppStateChangeObserver::NewL(this); 00057 iBrCtlSampleAppDialogsProvider = CBrCtlSampleAppDialogsProvider::NewL(this); 00058 00059 // Initialize memeber variables 00060 _LIT(KEmpty, ""); 00061 iText.Set(KEmpty); 00062 iPoint = TPoint(0,130); 00063 iBrCtlCapabilities = TBrCtlDefs::ECapabilityDisplayScrollBar | TBrCtlDefs::ECapabilityLoadHttpFw | 00064 TBrCtlDefs::ECapabilityGraphicalHistory | TBrCtlDefs::ECapabilityGraphicalPage; 00065 00066 // Create a Screen device for use with fonts for writing text to the screen 00067 CEikonEnv* eikEnv = CEikonEnv::Static(); 00068 CWsScreenDevice& screenDev = *eikEnv->ScreenDevice(); 00069 _LIT( KDummy, "Dummy"); 00070 iFbsScrDev = CFbsScreenDevice::NewL( KDummy, screenDev.DisplayMode()); 00071 00072 // Create a font spec in order to retrieve a valid font 00073 _LIT(KFontFamily, "S60 Sans"); 00074 TFontSpec fs(KFontFamily, 100); 00075 iFbsScrDev->GetNearestFontInTwips((CFont*&)iFont, fs); 00076 00077 TRect rect(Position(), Size()); 00078 iBrCtlInterface = CreateBrowserControlL( this, 00079 rect, 00080 iBrCtlCapabilities, 00081 iCommandBase, 00082 iBrCtlSampleAppSoftkeysObserver, 00083 iBrCtlSampleAppLinkResolver, 00084 iBrCtlSampleAppSpecialLoadObserver, 00085 iBrCtlSampleAppLayoutObserver, 00086 iBrCtlSampleAppDialogsProvider); 00087 00088 // These observers can be added and removed dynamically 00089 iBrCtlInterface->AddLoadEventObserverL(iBrCtlSampleAppLoadEventObserver); 00090 iBrCtlInterface->AddStateChangeObserverL(iBrCtlSampleAppStateChangeObserver); 00091 }
|
|
|
Pass a command to the Browser Control
Definition at line 233 of file BrCtlSampleAppContainer.cpp. References BasicBrowserControlL(), BrowserControlWithObserversL(), ChangeSizeExtentsL(), ContentSizeImageCountL(), CustomizedDialogsL(), CustomizedScrollBarsL(), CustomizedSoftKeysL(), HandleStateChangedL(), iBrCtlInterface, iCommandBase, IncrementalLoadingL(), LoadingContentWithBufferL(), LoadingContentWithFileHandleL(), PageInfoL(), ResolvingEmbeddedLinksL(), and SpecialLoadRequestsL(). Referenced by CBrCtlSampleAppUi::HandleCommandL(). 00234 { 00235 switch ( aCommand ) 00236 { 00237 case EBrCtlSampleAppCmdAppRestoreSetting: 00238 { 00239 if (iBrCtlInterface) 00240 { 00241 TRect rect( Position(), Size() ); 00242 iBrCtlInterface->SetRect( rect ); 00243 iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsSmallScreen, 1); 00244 iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsSecurityWarnings, 1); 00245 iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsAutoLoadImages, 1); 00246 iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsECMAScriptEnabled, 1); 00247 } 00248 break; 00249 } 00250 case EBrCtlSampleAppCmdAppReload: 00251 { 00252 if (iBrCtlInterface) 00253 { 00254 iBrCtlInterface->HandleCommandL(iCommandBase + TBrCtlDefs::ECommandReload); 00255 } 00256 break; 00257 } 00258 case EBrCtlSampleAppCmdAppBack: 00259 { 00260 if (iBrCtlInterface) 00261 { 00262 iBrCtlInterface->HandleCommandL(iCommandBase + TBrCtlDefs::ECommandBack); 00263 } 00264 break; 00265 } 00266 case EBrCtlSampleAppCmdAppForward: 00267 { 00268 if (iBrCtlInterface) 00269 { 00270 iBrCtlInterface->HandleCommandL(iCommandBase + TBrCtlDefs::ECommandForward); 00271 } 00272 break; 00273 } 00274 case EBrCtlSampleAppCmdApp1: 00275 { 00276 BasicBrowserControlL(); 00277 break; 00278 } 00279 case EBrCtlSampleAppCmdApp2: 00280 { 00281 BrowserControlWithObserversL(); 00282 break; 00283 } 00284 case EBrCtlSampleAppCmdApp3: 00285 { 00286 LoadingContentWithFileHandleL(); 00287 break; 00288 } 00289 case EBrCtlSampleAppCmdApp4: 00290 { 00291 LoadingContentWithBufferL(); 00292 break; 00293 } 00294 case EBrCtlSampleAppCmdApp5: 00295 { 00296 IncrementalLoadingL(); 00297 break; 00298 } 00299 case EBrCtlSampleAppCmdApp6: 00300 { 00301 SpecialLoadRequestsL(); 00302 break; 00303 } 00304 case EBrCtlSampleAppCmdApp7: 00305 { 00306 CustomizedDialogsL(); 00307 break; 00308 } 00309 case EBrCtlSampleAppCmdApp8: 00310 { 00311 CustomizedSoftKeysL(); 00312 break; 00313 } 00314 case EBrCtlSampleAppCmdApp9: 00315 { 00316 ResolvingEmbeddedLinksL(); 00317 break; 00318 } 00319 case EBrCtlSampleAppCmdApp10: 00320 { 00321 CustomizedScrollBarsL(); 00322 break; 00323 } 00324 case EBrCtlSampleAppCmdApp11: 00325 { 00326 HandleStateChangedL(); 00327 break; 00328 } 00329 case EBrCtlSampleAppCmdApp12: 00330 { 00331 ChangeSizeExtentsL(); 00332 break; 00333 } 00334 case EBrCtlSampleAppCmdApp13: 00335 { 00336 PageInfoL(); 00337 break; 00338 } 00339 case EBrCtlSampleAppCmdApp14: 00340 { 00341 ContentSizeImageCountL(); 00342 break; 00343 } 00344 00345 default: 00346 if (aCommand >= iCommandBase && 00347 aCommand < iCommandBase + TBrCtlDefs::ECommandIdWMLBase && 00348 iBrCtlInterface) 00349 { 00350 iBrCtlInterface->HandleCommandL(aCommand); 00351 } 00352 00353 if (aCommand >= iCommandBase + TBrCtlDefs::ECommandIdWMLBase && 00354 aCommand < iCommandBase + TBrCtlDefs::ECommandIdRange && 00355 iBrCtlInterface) 00356 { 00357 iBrCtlInterface->HandleCommandL(aCommand); 00358 } 00359 break; 00360 } 00361 }
|
|
||||||||||||
|
Dynamically initialises a menu pane. The Uikon framework calls this function, if it is implemented in a menu’s observer, immediately before the menu pane is activated.
Definition at line 384 of file BrCtlSampleAppContainer.cpp. References iBrCtlInterface. Referenced by CBrCtlSampleAppUi::DynInitMenuPaneL(). 00385 { 00386 if (iBrCtlInterface && aResourceId == R_BRCTLSAMPLEAPP_MENU ) 00387 { 00388 iBrCtlInterface->AddOptionMenuItemsL(*aMenuPane, aResourceId); 00389 RPointerArray<TBrCtlWmlServiceOption>* options; 00390 options = iBrCtlInterface->WMLOptionMenuItemsL(); 00391 TInt i; 00392 TInt count = options->Count(); 00393 for (i = 0; i < count; i++) 00394 { 00395 TBrCtlWmlServiceOption* option = (*options)[i]; 00396 if (option != NULL) 00397 { 00398 CEikMenuPaneItem::SData item; 00399 item.iText.Copy(option->Text()); 00400 item.iCommandId = option->ElemID(); 00401 item.iFlags = 0; 00402 item.iCascadeId = 0; 00403 aMenuPane->InsertMenuItemL(item, 0); 00404 } 00405 } 00406 } 00407 }
|
|
||||||||||||
|
Handles key events
Definition at line 194 of file BrCtlSampleAppContainer.cpp. Referenced by CBrCtlSampleAppUi::HandleKeyEventL().
|
|
|
Accessor method for iText
Definition at line 89 of file BrCtlSampleAppContainer.h. References iText. 00089 {return iText;}
|
|
|
Setter method for iText
Definition at line 205 of file BrCtlSampleAppContainer.cpp. References iText. Referenced by CBrCtlSampleAppLoadEventObserver::HandleBrowserLoadEventL(), CBrCtlSampleAppLayoutObserver::NotifyLayoutChange(), CBrCtlSampleAppStateChangeObserver::StateChanged(), CBrCtlSampleAppLayoutObserver::UpdateBrowserHScrollBarL(), and CBrCtlSampleAppLayoutObserver::UpdateBrowserVScrollBarL(). 00206 { 00207 iText.Set(aText); 00208 }
|
|
|
Setter method for iPoint
Definition at line 215 of file BrCtlSampleAppContainer.cpp. References iPoint. Referenced by CBrCtlSampleAppLayoutObserver::NotifyLayoutChange(), CBrCtlSampleAppStateChangeObserver::StateChanged(), CBrCtlSampleAppLayoutObserver::UpdateBrowserHScrollBarL(), and CBrCtlSampleAppLayoutObserver::UpdateBrowserVScrollBarL(). 00216 { 00217 iPoint = aPoint; 00218 }
|
|
|
Accessor method iBrCtlInterface
Definition at line 113 of file BrCtlSampleAppContainer.h. References iBrCtlInterface. Referenced by CBrCtlSampleAppSoftkeysObserver::UpdateSoftkeyL(). 00113 {return iBrCtlInterface;}
|
|
|
From CoeControl,SizeChanged. Definition at line 124 of file BrCtlSampleAppContainer.cpp. References iBrCtlInterface. 00125 { 00126 if (iBrCtlInterface) 00127 { 00128 iBrCtlInterface->SetRect(Rect()); 00129 } 00130 }
|
|
|
From CoeControl,CountComponentControls. Definition at line 136 of file BrCtlSampleAppContainer.cpp. References iBrCtlInterface. 00137 { 00138 if (iBrCtlInterface) 00139 return 1; 00140 return 0; 00141 }
|
|
|
From CCoeControl,ComponentControl. Definition at line 147 of file BrCtlSampleAppContainer.cpp. References iBrCtlInterface. 00148 { 00149 switch ( aIndex ) 00150 { 00151 case 0: 00152 return iBrCtlInterface; // Could be NULL 00153 default: 00154 return NULL; 00155 } 00156 }
|
|
|
From CCoeControl,Draw. Definition at line 162 of file BrCtlSampleAppContainer.cpp. References iFont, iPoint, and iText. 00163 { 00164 00165 CWindowGc& gc = SystemGc(); 00166 gc.SetPenStyle(CGraphicsContext::ESolidPen); 00167 gc.SetBrushColor(KRgbGray); 00168 gc.SetBrushStyle(CGraphicsContext::ESolidBrush); 00169 gc.DrawRect(aRect); 00170 00171 gc.UseFont(iFont); 00172 00173 gc.DrawText(iText, iPoint); 00174 00175 gc.DiscardFont(); 00176 }
|
|
||||||||||||
|
Handle key events. Definition at line 369 of file BrCtlSampleAppContainer.cpp. References iBrCtlInterface. 00370 { 00371 if (iBrCtlInterface) 00372 { 00373 return iBrCtlInterface->OfferKeyEventL(aKeyEvent, aType); 00374 } 00375 return EKeyWasConsumed; 00376 }
|
|
|
From MBrCtlDataLoadSupplier, Cancel an on-going load Definition at line 224 of file BrCtlSampleAppContainer.cpp. References iCancelInitDataLoad. 00225 { 00226 iCancelInitDataLoad = ETrue; 00227 }
|
|
|
Create a Basic Browser Control that does not have observers with scrolling and HTTP framework capabilities Definition at line 414 of file BrCtlSampleAppContainer.cpp. References iBrCtlInterface. 00415 { 00416 if (iBrCtlInterface != NULL) 00417 { 00418 delete iBrCtlInterface; 00419 iBrCtlInterface = NULL; 00420 } 00421 else 00422 { 00423 TRect rect(Position(), Size()); 00424 00425 iBrCtlInterface = CreateBrowserControlL( this, 00426 rect, 00427 TBrCtlDefs::ECapabilityDisplayScrollBar | TBrCtlDefs::ECapabilityLoadHttpFw | 00428 TBrCtlDefs::ECapabilityGraphicalHistory | TBrCtlDefs::ECapabilityGraphicalPage, 00429 TBrCtlDefs::ECommandIdBase, 00430 NULL, 00431 NULL, 00432 NULL, 00433 NULL); 00434 } 00435 }
|
|
|
|
Read the file. Definition at line 472 of file BrCtlSampleAppContainer.cpp. Referenced by IncrementalLoadingL(), and LoadingContentWithBufferL(). 00473 { 00474 RFs rfs; 00475 RFile file; 00476 User::LeaveIfError(rfs.Connect()); 00477 CleanupClosePushL(rfs); 00478 User::LeaveIfError(file.Open(rfs, aFileName, EFileRead)); 00479 CleanupClosePushL(file); 00480 TInt size; 00481 User::LeaveIfError(file.Size(size)); 00482 HBufC8* buf = HBufC8::NewLC(size); 00483 TPtr8 bufPtr(buf->Des()); 00484 User::LeaveIfError(file.Read(bufPtr)); 00485 CleanupStack::Pop(); // buf 00486 CleanupStack::PopAndDestroy(2); // file, rfs 00487 CleanupStack::PushL(buf); 00488 return buf; 00489 }
|
|
||||||||||||
|
Handles an event from an observed control. Definition at line 183 of file BrCtlSampleAppContainer.cpp.
|
|
|
The following methods are used to demonstrate the functionality of the browser control API Definition at line 496 of file BrCtlSampleAppContainer.cpp. References iBrCtlInterface, and iCommandBase. Referenced by HandleCommandL(). 00497 { 00498 if (iBrCtlInterface == NULL) 00499 { 00500 TRect rect(Position(), Size()); 00501 iBrCtlInterface = CreateBrowserControlL( this, 00502 rect, 00503 TBrCtlDefs::ECapabilityDisplayScrollBar | TBrCtlDefs::ECapabilityLoadHttpFw | 00504 TBrCtlDefs::ECapabilityGraphicalHistory | TBrCtlDefs::ECapabilityGraphicalPage, 00505 iCommandBase, 00506 NULL, 00507 NULL, 00508 NULL, 00509 NULL, 00510 NULL); 00511 } 00512 00513 _LIT(KUrl, "file:///c:\\BrCtlSampleApp\\sample1.htm"); 00514 00515 iBrCtlInterface->LoadUrlL( KUrl ); 00516 }
|
|
© Nokia 2009 |