📄 index.html
字号:
A host application can load content by calling a number of different load methods on the Browser Control. In the Load Content using Buffer menu option, we call LoadDataL() and pass it a data buffer.<h4><a class="anchor" name="Sub335">3.3.5 Incremental Loading</a></h4>The host application can pass content to the Browser Control in small chunks, if desired. The Browser Control displays this content incrementally. To pass content from the host application to the Browser Control incrementally, follow these steps:<p>1. Inherit from the MBrCtlDataLoadSupplier class and implement the CancelLoad() function to stop the load operation.<p>2. Call the InitLoadDataL() function of the CBrCtlInterface class to request the Browser Control to display content incrementally. *<p>3. Call the HandleNextDataChunk() function of the MBrCtlDataLoadConsumer class to pass the data chunks to the Browser Control.<p>4. Call the HandleLoadComplete() function when the data chunk has finished loading.<p>5. If an error occurs, call the HandleError() function.<p>In the Incremental Loading menu option, we demonstrate how to pass content to the Browser Control incrementally.<h4><a class="anchor" name="Sub336">3.3.6 Special Load Requests</a></h4>Special load requests consist of the following:<p><ul><li>Non-HTTP(S) load requests</li></ul><p><ul><li>Non-HTML content</li></ul><p><ul><li>Control over network connections</li></ul><p>In these cases, the host application can handle the requests instead of the Browser Control.<p>HandleDownloadL() requests the host application to handle a download. The host application should call the Download Manager to handle non-HTML content. Only GET requests are supported because the Browser Control must cancel the transaction before the Download Manager can take over. In the case of a POST request, the Browser Control downloads the content and passes it to the host application. The host application should look for the parameter EParamLocalFileName to determine whether or not the Browser Control downloaded the content.<p>HandleRequestL() checks the scheme of a URL to determine whether or not the Browser Control supports it. If the Browser Control does not support it, then the host application should pass the content to an application that does support that scheme.<p>NetworkConnectionNeededL() requests a new network connection. The Browser Control calls this function for each HTTP(S) load request. It is up to the host application to ensure that the network connection is available.<p>In the Special Load Requests menu option we demonstrate how to handle a request to load non-HTML content.<p><b>Note:</b> Because there is no Scheme Handler API shipped with the SDK, you as a developer are responsible for implementing your own scheme handling mechanism. By this we mean, inspecting the file type, and then trying to locate the appropriate application to handle this file. There are comments in the code as to where this implementation should take place. Without a scheme handler, this code is unable to locate the appropriate application that would handle this unknown scheme, so the unknown scheme is ignored.<h4><a class="anchor" name="Sub337">3.3.7 Customized Dialogs</a></h4>The Browser Control provides dialogs to communicate with the user of the host application. You can customize these dialogs by implementing the MBrCtlDialogsProvider interface to:<p><ul><li>Remove one or more dialogs</li></ul><p><ul><li>Change the format or content of dialogs</li></ul><p><ul><li>Selectively implement some of the default dialogs</li></ul><p>The Customized Dialogs menu option demonstrates how to customize the alert dialog.<h4><a class="anchor" name="Sub338">3.3.8 Customized Softkeys</a></h4>The host application can change the labels of the softkeys as a response to softkey events received from the Browser Control. The Browser Control transmits one or more softkey events under the following conditions:<ul><li>A document is displayed</li></ul><p><ul><li>A plug-in control is activated or deactivated</li></ul><p><ul><li>An input box is activated or deactivated</li></ul><p><ul><li>The browser view changes to and from the Image Map view</li></ul><p>To specify the softkeys, follow these steps:<p>1. Implement the UpdateSoftkeyL() function to change the softkeys.<p>2. Use the event to query the FocusedElementType() function to learn what the focused element is. All events are issued the EChangeReasonIdle reason code.<p>3. Change the softkeys based on the focused element.<p>The Customized Softkeys menu option demonstrates how to customize the softkeys.<h4><a class="anchor" name="Sub339">3.3.9 Embedded Links</a></h4>If the content of an embedded link is to be loaded from the private store of a host application, such as an e-mail application, then the developer should implement the MBrCtlLinkResolver class. This interface provides a callback mechanism to the host application to transmit the content of an embedded link or the content of a user-initiated load request to the Browser Control. To enable this callback mechanism, the host application must set the ECapabilityClientResolveEmbeddedURL capability or the ECapabilityClientNotifyURL capability. If the host application is unable to resolve the embedded link, then the Browser Control tries to handle the request through the HTTP framework. The following functions of the MBrCtlLinkResolver interface provide the content of an embedded link.<p><ul><li>CancelAll() cancels all outstanding link resolution operations.</li></ul><p><ul><li>ResolveEmbeddedLinkL() retrieves the content of an embedded link. For example, the Browser Control calls this function to display images embedded within an e-mail message.</li></ul><p>The Browser Control implements this interface after a link is resolved or an error occurs. Table 16 lists the functions called by the host application after a link is resolved or after an error occurs in resolving the link.<p><ul><li>HandleResolveComplete() called by the host application when the content of a link has finished loading.</li></ul><p><ul><li>HandleResolveError() Called by the host application if an error occurred while downloading the content of a link.</li></ul><p>The Embedded Links menu option demonstrates how to resolve an embedded link.<h4><a class="anchor" name="Sub3310">3.3.10 Customized Scrollbars</a></h4>To customize a scroll bar based upon one or more layout (scrolling) events, follow these steps:<p>1. When you create the Browser Control, do not specify the EcapabilityDisplayScrollBar flag.<p>2. Implement the MBrCtlLayoutObserver interface.<p>This enables the host application to display and update the scroll bars. If you wish to have no scroll bars at all, follow step 1 but do not implement step 2. The following functions of the MBrCtlLayoutObserver interface receive scrolling events when the host application draws the scrollbar.<p><ul><li>NotifyLayoutChange() determines whether the page is to be read from right-to-left or from left-to-right.</li></ul><p><ul><li>UpdateBrowserHScrollBarL() updates the position of the horizontal scrollbar.</li></ul><p><ul><li>UpdateBrowserVScrollBarL() updates the position of the vertical scrollbar.</li></ul><p><ul><li>UpdateTitleL() updates the page title in the History view.</li></ul><p>The Customized Scrollbars menu option demonstrates how you would go about customizing a scroll bar.<p><b>Note:</b> This sample doesn't acutally customize the scrollbars, that is left as an excercise for the reader, so to speak. What we do in this example is to show you how to set up the observer interface in order to receive these layout events. You will notice that we resize the browser control screen and write a text string below the browser control. This is to show that the methods on this observer are getting called. There are comments in the code which tell you that this is where you would implement your own scrolling implementation, if that is what you wish to do with the layout events.<h4><a class="anchor" name="Sub3311">3.3.11 Handle State Changed</a></h4>A change-of-state-event indicates that the state of the browser has changed. For example, the browser may switch to or from the Image Map view. To receive change-of-state events, inherit from the MBrCtlStateChangeObserver interface and implement the StateChanged function. The following function indicates that the browser has changed its state:<p><ul><li>StateChanged() called by the browser when its state has changed.</li></ul><p>NOTE: The only state change currently supported is the change to and from the Image Map view.<p>The Handle State Changed menu option demonstrates how to receive an event that indicates that the state of the browser has changed.<h4><a class="anchor" name="Sub3312">3.3.12 Change Size Extents</a></h4>The Change Size Extents menu options, allows you to change the size of the browser control.<h4><a class="anchor" name="Sub3313">3.3.13 Page Info</a></h4>The Page Info menu option, uses the PageInfoLC() method on the Browser Control to request the Browser Control to return information about the page, such as the page title, URL, or content.<h4><a class="anchor" name="Sub3314">3.3.14 Content Size and Image Count</a></h4>The Content Size and Image Count menu option uses the ContentSize() and ImageCountL() methods on the Browser Control to return this information to the host application.<h3><a class="anchor" name="Sub32">3.2 Capabilities</a></h3>NetworkServices<h3><a class="anchor" name="Sub33">3.3 ScalableUI</a></h3>This sample application handles multiple screen modes and the screen size can change dynamically.<h3><a class="anchor" name="Sub34">3.4 Known Issues</a></h3>The right softkey with the title "Back" is not integrated into the application and will not take you back to the previous page in the history list. If you want to go to the previous page in the history list please go to Options->Tools->Back<h3><a class="anchor" name="Sub34">3.4 Known Issues</a></h3>EMULATOR SDK<p>------------------<p>cd to <p>bldmake bldfiles<p>abld build winscw udeb<p>start the emulator<p>HARDWARE (ARMV5)<p>------------------<p>cd to <p>bldmake bldfiles<p>abld build armv5 urel<p>makesis BrCtlSampleApp_armv5.pkg<p>HARDWARE (GCCE)<p>------------------<p>cd to <p>bldmake bldfiles<p>abld build gcce urel<p>makesis BrCtlSampleApp_gcce.pkg<p>HARDWARE (ARMV5_ABIV2)<p>------------------<p>cd to <p>bldmake bldfiles<p>abld build armv5_abiv2 urel<p>makesis BrCtlSampleApp_armv5_abiv2.pkg<p>Copy the sis file to the phone (memory card, bluetooth, etc) Run the sis file to install the application<p><hr><h2><a class="anchor" name="Hierarchy_sec">4. Class Hierarchy</a></h2>This inheritance list is sorted roughly, but not completely, alphabetically:<ul><li><a href="class_c_br_ctl_sample_app.html" class="el">CBrCtlSampleApp</a> </li><li><a href="class_c_br_ctl_sample_app_container.html" class="el">CBrCtlSampleAppContainer</a> </li><li><a href="class_c_br_ctl_sample_app_dialogs_provider.html" class="el">CBrCtlSampleAppDialogsProvider</a> </li><li><a href="class_c_br_ctl_sample_app_document.html" class="el">CBrCtlSampleAppDocument</a> </li><li><a href="class_c_br_ctl_sample_app_layout_observer.html" class="el">CBrCtlSampleAppLayoutObserver</a> </li><li><a href="class_c_br_ctl_sample_app_link_resolver.html" class="el">CBrCtlSampleAppLinkResolver</a> </li><li><a href="class_c_br_ctl_sample_app_load_event_observer.html" class="el">CBrCtlSampleAppLoadEventObserver</a> </li><li><a href="class_c_br_ctl_sample_app_query_dialog.html" class="el">CBrCtlSampleAppQueryDialog</a> </li><li><a href="class_c_br_ctl_sample_app_softkeys_observer.html" class="el">CBrCtlSampleAppSoftkeysObserver</a> </li><li><a href="class_c_br_ctl_sample_app_special_load_observer.html" class="el">CBrCtlSampleAppSpecialLoadObserver</a> </li><li><a href="class_c_br_ctl_sample_app_state_change_observer.html" class="el">CBrCtlSampleAppStateChangeObserver</a> </li><li><a href="class_c_br_ctl_sample_app_ui.html" class="el">CBrCtlSampleAppUi</a> </li></ul><hr><table x-use-null-cells style="x-cell-content-align: top; width: 100%; border-spacing: 0px; border-spacing: 0px;" cellspacing=0 width=100%> <col style="width: 50%;"> <col style="width: 50%;"> <tr style="x-cell-content-align: top;" valign=top> <td style="width: 50%; padding-right: 10px; padding-left: 10px; border-right-style: None; border-left-style: None; border-top-style: None; border-bottom-style: None;" width=50%> <p style="font-family: Arial;"><small style="font-size: smaller;">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -