|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
#include <BrCtlSampleAppContainer.h>
Definition at line 38 of file BrCtlSampleAppContainer.h.
|
|
|
|
Pass a command to the Browser Control
Definition at line 231 of file BrCtlSampleAppContainer.cpp. References BasicBrowserControlL(), BrowserControlWithObserversL(), ChangeSizeExtentsL(), ContentSizeImageCountL(), CustomizedDialogsL(), CustomizedScrollBarsL(), CustomizedSoftKeysL(), HandleStateChangedL(), iBrCtlInterface, iCommandBase, IncrementalLoadingL(), LoadingContentWithBufferL(), LoadingContentWithFileHandleL(), PageInfoL(), ResolvingEmbeddedLinksL(), and SpecialLoadRequestsL(). 00232 { 00233 switch ( aCommand ) 00234 { 00235 case EBrCtlSampleAppCmdAppRestoreSetting: 00236 { 00237 if (iBrCtlInterface) 00238 { 00239 TRect rect( Position(), Size() ); 00240 iBrCtlInterface->SetRect( rect ); 00241 iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsSmallScreen, 1); 00242 iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsSecurityWarnings, 1); 00243 iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsAutoLoadImages, 1); 00244 iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsECMAScriptEnabled, 1); 00245 } 00246 break; 00247 } 00248 case EBrCtlSampleAppCmdAppReload: 00249 { 00250 if (iBrCtlInterface) 00251 { 00252 iBrCtlInterface->HandleCommandL(iCommandBase + TBrCtlDefs::ECommandReload); 00253 } 00254 break; 00255 } 00256 case EBrCtlSampleAppCmdAppBack: 00257 { 00258 if (iBrCtlInterface) 00259 { 00260 iBrCtlInterface->HandleCommandL(iCommandBase + TBrCtlDefs::ECommandBack); 00261 } 00262 break; 00263 } 00264 case EBrCtlSampleAppCmdAppForward: 00265 { 00266 if (iBrCtlInterface) 00267 { 00268 iBrCtlInterface->HandleCommandL(iCommandBase + TBrCtlDefs::ECommandForward); 00269 } 00270 break; 00271 } 00272 case EBrCtlSampleAppCmdApp1: 00273 { 00274 BasicBrowserControlL(); 00275 break; 00276 } 00277 case EBrCtlSampleAppCmdApp2: 00278 { 00279 BrowserControlWithObserversL(); 00280 break; 00281 } 00282 case EBrCtlSampleAppCmdApp3: 00283 { 00284 LoadingContentWithFileHandleL(); 00285 break; 00286 } 00287 case EBrCtlSampleAppCmdApp4: 00288 { 00289 LoadingContentWithBufferL(); 00290 break; 00291 } 00292 case EBrCtlSampleAppCmdApp5: 00293 { 00294 IncrementalLoadingL(); 00295 break; 00296 } 00297 case EBrCtlSampleAppCmdApp6: 00298 { 00299 SpecialLoadRequestsL(); 00300 break; 00301 } 00302 case EBrCtlSampleAppCmdApp7: 00303 { 00304 CustomizedDialogsL(); 00305 break; 00306 } 00307 case EBrCtlSampleAppCmdApp8: 00308 { 00309 CustomizedSoftKeysL(); 00310 break; 00311 } 00312 case EBrCtlSampleAppCmdApp9: 00313 { 00314 ResolvingEmbeddedLinksL(); 00315 break; 00316 } 00317 case EBrCtlSampleAppCmdApp10: 00318 { 00319 CustomizedScrollBarsL(); 00320 break; 00321 } 00322 case EBrCtlSampleAppCmdApp11: 00323 { 00324 HandleStateChangedL(); 00325 break; 00326 } 00327 case EBrCtlSampleAppCmdApp12: 00328 { 00329 ChangeSizeExtentsL(); 00330 break; 00331 } 00332 case EBrCtlSampleAppCmdApp13: 00333 { 00334 PageInfoL(); 00335 break; 00336 } 00337 case EBrCtlSampleAppCmdApp14: 00338 { 00339 ContentSizeImageCountL(); 00340 break; 00341 } 00342 00343 default: 00344 if (aCommand >= iCommandBase && 00345 aCommand < iCommandBase + TBrCtlDefs::ECommandIdWMLBase && 00346 iBrCtlInterface) 00347 { 00348 iBrCtlInterface->HandleCommandL(aCommand); 00349 } 00350 00351 if (aCommand >= iCommandBase + TBrCtlDefs::ECommandIdWMLBase && 00352 aCommand < iCommandBase + TBrCtlDefs::ECommandIdRange && 00353 iBrCtlInterface) 00354 { 00355 iBrCtlInterface->HandleCommandL(aCommand); 00356 } 00357 break; 00358 } 00359 }
|
|
||||||||||||
|
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 382 of file BrCtlSampleAppContainer.cpp. References iBrCtlInterface. 00383 { 00384 if (iBrCtlInterface && aResourceId == R_BRCTLSAMPLEAPP_MENU ) 00385 { 00386 iBrCtlInterface->AddOptionMenuItemsL(*aMenuPane, aResourceId); 00387 RPointerArray<TBrCtlWmlServiceOption>* options; 00388 options = iBrCtlInterface->WMLOptionMenuItemsL(); 00389 TInt i; 00390 TInt count = options->Count(); 00391 for (i = 0; i < count; i++) 00392 { 00393 TBrCtlWmlServiceOption* option = (*options)[i]; 00394 if (option != NULL) 00395 { 00396 CEikMenuPaneItem::SData item; 00397 item.iText.Copy(option->Text()); 00398 item.iCommandId = option->ElemID(); 00399 item.iFlags = 0; 00400 item.iCascadeId = 0; 00401 aMenuPane->InsertMenuItemL(item, 0); 00402 } 00403 } 00404 } 00405 }
|
|
||||||||||||
|
Handles key events
Definition at line 192 of file BrCtlSampleAppContainer.cpp.
|
|
|
Accessor method for iText
Definition at line 89 of file BrCtlSampleAppContainer.h. References iText. 00089 {return iText;}
|
|
|
Setter method for iText
Definition at line 203 of file BrCtlSampleAppContainer.cpp. References iText. 00204 { 00205 iText.Set(aText); 00206 }
|
|
|
Setter method for iPoint
Definition at line 213 of file BrCtlSampleAppContainer.cpp. References iPoint. 00214 { 00215 iPoint = aPoint; 00216 }
|
|
|
Accessor method iBrCtlInterface
Definition at line 113 of file BrCtlSampleAppContainer.h. References iBrCtlInterface. 00113 {return iBrCtlInterface;}
|
|
|
From CoeControl,SizeChanged. Definition at line 123 of file BrCtlSampleAppContainer.cpp. References iBrCtlInterface. 00124 { 00125 if (iBrCtlInterface) 00126 { 00127 iBrCtlInterface->SetRect(Rect()); 00128 } 00129 }
|
|
|
From CoeControl,CountComponentControls. Definition at line 135 of file BrCtlSampleAppContainer.cpp. References iBrCtlInterface. 00136 { 00137 if (iBrCtlInterface) 00138 return 1; 00139 return 0; 00140 }
|
|
|
From CCoeControl,ComponentControl. Definition at line 146 of file BrCtlSampleAppContainer.cpp. References iBrCtlInterface. 00147 { 00148 switch ( aIndex ) 00149 { 00150 case 0: 00151 return iBrCtlInterface; // Could be NULL 00152 default: 00153 return NULL; 00154 } 00155 }
|
|
|
From CCoeControl,Draw. Definition at line 161 of file BrCtlSampleAppContainer.cpp. References iFont, iPoint, and iText. 00162 { 00163 00164 CWindowGc& gc = SystemGc(); 00165 gc.SetPenStyle(CGraphicsContext::ESolidPen); 00166 gc.SetBrushColor(KRgbGray); 00167 gc.SetBrushStyle(CGraphicsContext::ESolidBrush); 00168 gc.DrawRect(aRect); 00169 00170 gc.UseFont(iFont); 00171 00172 gc.DrawText(iText, iPoint); 00173 00174 gc.DiscardFont(); 00175 }
|
|
||||||||||||
|
Handle key events. Definition at line 367 of file BrCtlSampleAppContainer.cpp. References iBrCtlInterface. 00368 { 00369 if (iBrCtlInterface) 00370 { 00371 return iBrCtlInterface->OfferKeyEventL(aKeyEvent, aType); 00372 } 00373 return EKeyWasConsumed; 00374 }
|
|
|
From MBrCtlDataLoadSupplier, Cancel an on-going load Definition at line 222 of file BrCtlSampleAppContainer.cpp. References iCancelInitDataLoad. 00223 { 00224 iCancelInitDataLoad = ETrue; 00225 }
|
|
|
Create a Basic Browser Control that does not have observers with scrolling and HTTP framework capabilities Definition at line 412 of file BrCtlSampleAppContainer.cpp. References iBrCtlInterface. 00413 { 00414 if (iBrCtlInterface != NULL) 00415 { 00416 delete iBrCtlInterface; 00417 iBrCtlInterface = NULL; 00418 } 00419 else 00420 { 00421 TRect rect(Position(), Size()); 00422 00423 iBrCtlInterface = CreateBrowserControlL( this, 00424 rect, 00425 TBrCtlDefs::ECapabilityDisplayScrollBar | TBrCtlDefs::ECapabilityLoadHttpFw, 00426 TBrCtlDefs::ECommandIdBase, 00427 NULL, 00428 NULL, 00429 NULL, 00430 NULL); 00431 } 00432 }
|
|
|
Create Browser Control with observers with the given capabilities Definition at line 439 of file BrCtlSampleAppContainer.cpp. References iBrCtlCapabilities, iBrCtlInterface, iBrCtlSampleAppLayoutObserver, iBrCtlSampleAppLinkResolver, iBrCtlSampleAppLoadEventObserver, iBrCtlSampleAppSoftkeysObserver, iBrCtlSampleAppSpecialLoadObserver, and iBrCtlSampleAppStateChangeObserver. 00440 { 00441 if (iBrCtlCapabilities != aCapabilities) 00442 { 00443 delete iBrCtlInterface; 00444 iBrCtlInterface = NULL; 00445 } 00446 iBrCtlCapabilities = aCapabilities; 00447 if (iBrCtlInterface == NULL) 00448 { 00449 TRect rect(Position(), Size()); 00450 iBrCtlInterface = CreateBrowserControlL( this, 00451 rect, 00452 iBrCtlCapabilities, 00453 TBrCtlDefs::ECommandIdBase, 00454 iBrCtlSampleAppSoftkeysObserver, 00455 iBrCtlSampleAppLinkResolver, 00456 iBrCtlSampleAppSpecialLoadObserver, 00457 iBrCtlSampleAppLayoutObserver); 00458 00459 iBrCtlInterface->AddLoadEventObserverL(iBrCtlSampleAppLoadEventObserver); 00460 iBrCtlInterface->AddStateChangeObserverL(iBrCtlSampleAppStateChangeObserver); 00461 } 00462 }
|
|
|
Read the file. Definition at line 469 of file BrCtlSampleAppContainer.cpp. 00470 { 00471 RFs rfs; 00472 RFile file; 00473 User::LeaveIfError(rfs.Connect()); 00474 CleanupClosePushL(rfs); 00475 User::LeaveIfError(file.Open(rfs, aFileName, EFileRead)); 00476 CleanupClosePushL(file); 00477 TInt size; 00478 User::LeaveIfError(file.Size(size)); 00479 HBufC8* buf = HBufC8::NewLC(size); 00480 TPtr8 bufPtr(buf->Des()); 00481 User::LeaveIfError(file.Read(bufPtr)); 00482 CleanupStack::Pop(); // buf 00483 CleanupStack::PopAndDestroy(2); // file, rfs 00484 CleanupStack::PushL(buf); 00485 return buf; 00486 }
|
|
||||||||||||
|
Handles an event from an observed control. Definition at line 182 of file BrCtlSampleAppContainer.cpp.
|
|
|
The following methods are used to demonstrate the functionality of the browser control API Definition at line 493 of file BrCtlSampleAppContainer.cpp. References iBrCtlInterface, and iCommandBase. 00494 { 00495 if (iBrCtlInterface == NULL) 00496 { 00497 TRect rect(Position(), Size()); 00498 iBrCtlInterface = CreateBrowserControlL( this, 00499 rect, 00500 TBrCtlDefs::ECapabilityDisplayScrollBar | TBrCtlDefs::ECapabilityLoadHttpFw, 00501 iCommandBase, 00502 NULL, 00503 NULL, 00504 NULL, 00505 NULL, 00506 NULL); 00507 } 00508 00509 _LIT(KUrl, "file://BrCtlSampleApp/sample1.htm"); 00510 00511 iBrCtlInterface->LoadUrlL( KUrl ); 00512 }
|
|
© Nokia 2006 |