PrevNextUpHome BREW C++ Class Library & GUI Framework & XML Middleware : SophiaFramework 4.1
SFRBrowserControl
Control that implements a simple Web Browser.
#include <SFRBrowserControl.hpp>
class SFRBrowserControl : public SFRControl;
SFMTYPEDEFCLASS(SFRBrowserControl)

Inheritance diagram

 Inheritance diagram of SFRBrowserControlClass

Collaboration diagram

 Collaboration diagram of SFRBrowserControlClass

Description

The following functions are available in the SFRBrowserControl class:

  • HTTP Communication
  • rendering HTML document
  • displaying an inline image
  • hyper-link
  • logging

A simple Web Browser can be created easily by only pasting a SFRBrowserControl object.

The SFRBrowserControl class is implemented base on the IHtmlViewer of BREW API. The limitations of SFRBrowserControl class on rendering the HTML data are almost the same as that of IHtmlViewer.

Error Value

Several member functions of SFRBrowserControl class record its status internally when an error occurs.

The latest error of member function can be gotten by the static_catch function.

SFERR_NO_ERROR is returned if no error occurs.

The code below is to use a simple Web Browser:

SFMTYPEDEFCLASS(MyWindow)
class MyWindow : public SFRTitleWindow {
    SFMSEALCOPY(MyWindow)
public:
    MyWindow(Void) static_throws;
    virtual ~MyWindow(Void) { return; }
    
    // define the simple Web Browser as a member function of pointer type
    SFRBrowserControlPtr     _browser;      // a simple Web Browser

};

// constructor(Error process is bypassed)
MyWindow::MyWindow(Void) : SFRTitleWindow(SFRApplication::GetInstance(),
    SFXRectangle(20, 20, 200, 250), "my window") static_throws
{
    
    // input the browser by string
    SFXAnsiString buffer(
         "BrowserControl<br /><br />"
         "<a href=\"http://www.s-cradle.com/example/tabbrowser/\">Sophia Cradle</a><br /><br />"
    );
				
    // create a simple Web Browser
    // the first argument: parent responder
    // the second argument: position and size of the tab
    _browser = ::new SFRBrowserControl(this, rect);
				
    // start rendering the string as HTML
   _browser->Load(buffer);
			
    return;
}

Reference

SFRResponder | SFRApplication | SFRWindow | SFRDialog | SFRControl | SFBHTMLViewer | SFBWeb | Simple Web Browser

Member

Constructor/Destructor
SFRBrowserControl( SFRResponderPtr director , SFXRectangleConstRef rect , BehaviorType behavior = BEHAVIOR_SFRBROWSERCONTROL , SFCType attribute = ATTRIBUTE_SFRBROWSERCONTROL )
Constructor of SFRBrowserControl class.
~SFRBrowserControl( Void )
Destructor of SFRBrowserControl class.
Public Functions
SFCError ClearHistory( Void )
Clear the history list.
SInt32 FindElement( ACharConstPtr element , SInt32 no )
Find the specified element in the current page.
HistoryEntry GetCurrentHistory( Void )
Get the URL and title of current page
UInt32 GetCurrentHistoryIndex( Void )
Get the index of current history.
SFXAnsiString GetElementAttribute( SInt32 elementIndex , ACharConstPtr attr )
Get the attribute of specified element.
SFXAnsiString GetElementText( SInt32 elementIndex )
Get the text of specified element.
HistoryEntry GetHistory( UInt32 historyIndex = 0 )
Get the history content by the specified index.
HistoryEntryConstPtr GetHistoryList( Void )
Get the history list.
UInt32 GetHistorySize( Void )
Get the number of entries in history list.
SInt32 GetIndent( Void )
Get the width of indent.
SFXRGBColor GetLinkColor( Void )
Get the color of link text.
SInt32 GetParagraphSpacing( Void )
Get the spacing between paragraphs.
SInt32 GetScrollbarWidth( Void )
Get the width of scroll bar.
SFXRGBColor GetTextColor( Void )
Get the text color.
SFBWebSmpConstRef GetWeb( Void )
Get the IWeb instance for communication.
Bool IsBusy( Void )
Check whether or not the browser control is busy in accessing the network, or rendering.
Bool IsInlineEditEnable( Void )
Check whether the text is edited in some part of screen or not.
Bool IsScrollbarEnable( Void )
Check whether the scroll bar is enabled or not.
SFCError Load( SFXAnsiStringConstRef data )
Load( SFXAnsiStringConstRef data , SFXAnsiStringConstRef url )
Start to render the string in the HTML format.
SFCError Move( UInt32 historyIndex = 0 )
Move to the specified page in history list and render it again.
SFCError Next( SInt32 n = 1 )
Move to the next page in specified history, get and render the page again.
SFCError Open( SFXAnsiStringConstRef url )
Open( SFBAStreamSmpConstRef src , SFXAnsiStringConstRef baseUrl )
Open( SFBAStreamSmpConstRef stream )
Open( SFBSourceSmpConstRef source , SFXAnsiStringConstRef basdUrl )
Open( SFBSourceSmpConstRef source )
Open( SFXAnsiStringConstRef url , SFXAnsiStringConstRef method , SFXBufferConstRef data )
Open( SFXAnsiStringConstRef url , SFXAnsiStringConstRef method , SFXAnsiStringConstRef data )
Open( SFXAnsiStringConstRef url , SFXAnsiStringConstRef method )
Start to render the page of specified URL.
SFCError Previous( SInt32 n = 1 )
Move to the previous page in specified history, get and render the page again.
Void Reload( Void )
Reload and render the current page.
SFCError SetAuthorizeData( SFXAnsiStringConstRef user , SFXAnsiStringConstRef passwd , SFXAnsiStringConstRef url )
Set information on the Basic HTTP authorization.
SFCError SetHistorySize( UInt32 size )
Set the size of history list.
SFCError SetIndent( SInt32 pixel )
Set the width of indent
SFCError SetInlineEditEnable( Bool enable )
Set whether the text is edited in some part of screen or not.
SFCError SetLinkColor( SFXRGBColorConstRef color )
Set the color of link text.
SFCError SetParagraphSpacing( SInt32 pixel )
Set the spacing between paragraphs.
SFCError SetScrollbarEnable( Bool enable )
Enable or disable the scroll bar.
SFCError SetScrollbarWidth( SInt32 pixel )
Set the width of scroll bar.
SFCError SetTextColor( SFXRGBColorConstRef color )
Set the text color.
Void SetWeb( SFBWebSmpConstRef web )
Set the IWeb interface for communication.
Void Stop( Void )
Stop accessing the network and rendering.
SFCError UnsetAuthorizeData( Void )
Cancel the settings for Basic HTTP authorization.
Void UnsetWeb( Void )
Cancel the settings set by the SFRBrowserControl::SetWeb function.
Bool ClearHandler( Void ) (inherits from SFRResponder)
[Handler] Clear the " Targeted " status of responder, or destroy the responder.
Bool Compare( SFCType type , SFCType attribute , BehaviorType behavior ) (inherits from SFRResponder)
Compare with type, attribute and behavior.
Bool FocusDown( Bool repeat = true ) (inherits from SFRResponder)
Focus down to the next responder.
Bool FocusDownHandler( Void ) (inherits from SFRResponder)
[Handler] Focus down to the next responder.
Bool FocusLeft( Bool repeat = true ) (inherits from SFRResponder)
Focus left to the next responder.
Bool FocusLeftHandler( Void ) (inherits from SFRResponder)
[Handler] Focus left to the next responder.
Bool FocusNext( Bool repeat = true ) (inherits from SFRResponder)
Focus to the next sibling responder.
Bool FocusNextHandler( Void ) (inherits from SFRResponder)
[Handler] Focus to the next sibling responder.
Bool FocusPrevious( Bool repeat = true ) (inherits from SFRResponder)
Focus to the previous sibling responder.
Bool FocusPreviousHandler( Void ) (inherits from SFRResponder)
[Handler] Focus to the previous sibling responder.
Bool FocusRight( Bool repeat = true ) (inherits from SFRResponder)
Focus right to the next responder.
Bool FocusRightHandler( Void ) (inherits from SFRResponder)
[Handler] Focus right to the next responder.
Bool FocusUp( Bool repeat = true ) (inherits from SFRResponder)
Focus up to the next responder.
Bool FocusUpHandler( Void ) (inherits from SFRResponder)
[Handler] Focus up to the next responder.
SFCType GetAttribute( Void ) (inherits from SFRResponder)
Get the attribute.
SFRResponderPtr GetBack( SFCType type = TYPE_WILDCARD , SFCType attribute = ATTRIBUTE_WILDCARD , BehaviorType compare = STATUS_VISIBLE|STATUS_ENABLE ) (inherits from SFRResponder)
Get the child responder at the most background that matches with a specified search condition.
SFXRectangleConstRef GetBaseBound( Void ) (inherits from SFRResponder)
Get the base region with the coordinate of content region of parent responder.
SFXRectangle GetBaseWorld( Void ) (inherits from SFRResponder)
Get the base region.
SFXRectangleConstRef GetContentBound( Void ) (inherits from SFRResponder)
Get the content region with the coordinate of base region.
SFXRectangle GetContentWorld( Void ) (inherits from SFRResponder)
Get the content region.
SFRResponderPtr GetDirector( Void ) (inherits from SFRResponder)
Get the parent responder.
SFRResponderPtr GetFocus( Void ) (inherits from SFRResponder)
Get the responder with focus in its ownership hierarchy.
SFXMargin GetFrameMargin( Void ) (inherits from SFRResponder)
Get the margin between base and content region(in pixels).
SFRResponderPtr GetFront( SFCType type = TYPE_WILDCARD , SFCType attribute = ATTRIBUTE_WILDCARD , BehaviorType compare = STATUS_VISIBLE | STATUS_ENABLE ) (inherits from SFRResponder)
Get the child responder at the most foreground that matches with a specified search condition.
SInt16 GetIndexBackward( SFCType type = TYPE_WILDCARD , SFCType attribute = ATTRIBUTE_WILDCARD , BehaviorType compare = STATUS_VISIBLE|STATUS_ENABLE ) (inherits from SFRResponder)
Get the index number from the most background of responder that matches with a specified search condition.
SInt16 GetIndexForward( SFCType type = TYPE_WILDCARD , SFCType attribute = ATTRIBUTE_WILDCARD , BehaviorType compare = STATUS_VISIBLE|STATUS_ENABLE ) (inherits from SFRResponder)
Get the index number from the most foreground of responder that matches with a specified search condition.
Bool GetInheritEnable( Void ) (inherits from SFRResponder)
Get the " Enable / Disable " status of responder including its parent responders.
Bool GetInheritFocus( Void ) (inherits from SFRResponder)
Get the " Focused / Unfocused " status of responder including its parent responders.
Bool GetInheritTarget( Void ) (inherits from SFRResponder)
Get the " Target / Not-Target " status of responder including its parent responders.
Bool GetInheritVisible( Void ) (inherits from SFRResponder)
Get the " Visible / Invisible " status of responder including its parent responders.
SFRResponderPtr GetLeft( SFCType type = TYPE_WILDCARD , SFCType attribute = ATTRIBUTE_WILDCARD , BehaviorType compare = STATUS_VISIBLE|STATUS_ENABLE ) (inherits from SFRResponder)
Get the previous responder among the grouped responders that matches with a specified search condition.
SInt16 GetMoveInterval( Void ) (inherits from SFRResponder)
Get the move interval in pixels.
SInt16 GetMoveMargin( Void ) (inherits from SFRResponder)
Get the margin pixels of content region ( or virtual region if set with the parent responder ) where the child responder cannot move.
SFRResponderPtr GetNext( SFCType type = TYPE_WILDCARD , SFCType attribute = ATTRIBUTE_WILDCARD , BehaviorType compare = STATUS_VISIBLE|STATUS_ENABLE , Bool repeat = true ) (inherits from SFRResponder)
Get the next sibling responder that matches with a specified search condition.
SFRResponderPtr GetNthBackward( SInt16 index , SFCType type = TYPE_WILDCARD , SFCType attribute = ATTRIBUTE_WILDCARD , BehaviorType compare = STATUS_VISIBLE|STATUS_ENABLE ) (inherits from SFRResponder)
Get the Nth child responder from the most background that matches with a specified search condition.
SFRResponderPtr GetNthForward( SInt16 index , SFCType type = TYPE_WILDCARD , SFCType attribute = ATTRIBUTE_WILDCARD , BehaviorType compare = STATUS_VISIBLE|STATUS_ENABLE ) (inherits from SFRResponder)
Get the Nth child responder from the most foreground that matches with a specified search condition.
SFRResponderPtr GetPrevious( SFCType type = TYPE_WILDCARD , SFCType attribute = ATTRIBUTE_WILDCARD , BehaviorType compare = STATUS_VISIBLE|STATUS_ENABLE , Bool repeat = true ) (inherits from SFRResponder)
Get the previous sibling responder that matches with a specified search condition.
VoidPtr GetReference( Void ) (inherits from SFRResponder)
Get the reference value.
SFRResponderPtr GetRight( SFCType type = TYPE_WILDCARD , SFCType attribute = ATTRIBUTE_WILDCARD , BehaviorType compare = STATUS_VISIBLE|STATUS_ENABLE ) (inherits from SFRResponder)
Get the next responder among the grouped responders that matches with a specified search condition.
SInt16 GetScrollInterval( Void ) (inherits from SFRResponder)
Get the scroll interval in pixels.
Bool GetStatusEnable( Void ) (inherits from SFRResponder)
Get the value of " Enable / Disable " flag.
Bool GetStatusFocus( Void ) (inherits from SFRResponder)
Get the value of " Focused / Unfocused " flag.
Bool GetStatusTarget( Void ) (inherits from SFRResponder)
Get the value of " Target / Non-target " flag.
Bool GetStatusVisible( Void ) (inherits from SFRResponder)
Get the value of " Visible / Invisible " flag.
SFXGrid GetTranslate( Void ) (inherits from SFRResponder)
Get the origin coordinate of virtual region with the coordinate of content region.
SInt16 GetTravelMargin( Void ) (inherits from SFRResponder)
Get the margin pixels of content region inside which the rectangle in the virtual region but outside the content region should be automatically scrolled by using the SFRResponder::Travel function.
SFCType GetType( Void ) (inherits from SFRResponder)
Get the responder type.
SFXRectangleConstRef GetVirtualBound( Void ) (inherits from SFRResponder)
Get the virtual region with the coordinate of content region.
SFXRectangle GetVirtualWorld( Void ) (inherits from SFRResponder)
Get the virtual region
Void Group( SFRResponderPtr with ) (inherits from SFRResponder)
Group the responder with the group of which representative responder is specified as an argument.
Void GroupMove( SFXSizeConstRef size ) (inherits from SFRResponder)
Move all the responders grouped together.
Void GroupScroll( SFXSizeConstRef size ) (inherits from SFRResponder)
Scroll all the the virtual regions of responders grouped together.
Void GroupSelect( Void ) (inherits from SFRResponder)
Select all the responders grouped together. ( move all of them to the most foreground )
Void GroupStatusEnable( Bool enable ) (inherits from SFRResponder)
Set the " Enable / Disable " status of all the responders grouped together.
Void GroupStatusVisible( Bool visible ) (inherits from SFRResponder)
Set the " Visible / Invisible " status of all the responders grouped together.
Void InvalidateBase( Void ) (inherits from SFRResponder)
InvalidateBase( SFXRectangleConstRef rect ) (inherits from SFRResponder)
Register an area in the base region to be redrawn.
Void InvalidateContent( Void ) (inherits from SFRResponder)
InvalidateContent( SFXRectangleConstRef rect ) (inherits from SFRResponder)
Register an area in the content region to be redrawn.
Void InvalidateVirtual( Void ) (inherits from SFRResponder)
InvalidateVirtual( SFXRectangleConstRef rect ) (inherits from SFRResponder)
Register an area in the virtual region to be redrawn.
Bool Invoke( SFXEventConstRef event ) (inherits from SFRResponder)
Send the specified event.
Bool MoveDownHandler( Void ) (inherits from SFRResponder)
[Handler] Move the responder down.
Bool MoveLeftHandler( Void ) (inherits from SFRResponder)
[Handler] Move the responder left.
Bool MoveRightHandler( Void ) (inherits from SFRResponder)
[Handler] Move the responder right.
Bool MoveUpHandler( Void ) (inherits from SFRResponder)
[Handler] Move the responder up.
SFCError RegisterHandler( HandlerEnum timing , SFRHandlerSPP spp , VoidPtr ref ) (inherits from SFRHandler)
RegisterHandler( SFCEventEnum btype , SFCEventEnum etype , UInt16 bp16 , UInt16 ep16 , HandlerEnum timing , SFRHandlerSPP spp , VoidPtr ref ) (inherits from SFRHandler)
RegisterHandler( SFCEventEnum btype , SFCEventEnum endType , UInt16 p16 , HandlerEnum timing , SFRHandlerSPP spp , VoidPtr ref ) (inherits from SFRHandler)
RegisterHandler( SFCEventEnum btype , SFCEventEnum etype , HandlerEnum timing , SFRHandlerSPP spp , VoidPtr ref ) (inherits from SFRHandler)
RegisterHandler( SFCEventEnum type , UInt16 bp16 , UInt16 ep16 , HandlerEnum timing , SFRHandlerSPP spp , VoidPtr ref ) (inherits from SFRHandler)
RegisterHandler( SFCEventEnum type , UInt16 p16 , HandlerEnum timing , SFRHandlerSPP spp , VoidPtr ref ) (inherits from SFRHandler)
RegisterHandler( SFCEventEnum type , HandlerEnum timing , SFRHandlerSPP spp , VoidPtr ref ) (inherits from SFRHandler)
Register a handler.
SFCError RegisterTracer( BehaviorType behavior , TracerEnum trace ) (inherits from SFRTracer)
RegisterTracer( SFCEventEnum bgnType , SFCEventEnum endType , UInt16 bgnP16 , UInt16 endP16 , BehaviorType behavior , TracerEnum trace ) (inherits from SFRTracer)
RegisterTracer( SFCEventEnum bgnType , SFCEventEnum endType , UInt16 p16 , BehaviorType behavior , TracerEnum trace ) (inherits from SFRTracer)
RegisterTracer( SFCEventEnum bgnType , SFCEventEnum endType , BehaviorType behavior , TracerEnum trace ) (inherits from SFRTracer)
RegisterTracer( SFCEventEnum type , UInt16 bgnP16 , UInt16 endP16 , BehaviorType behavior , TracerEnum trace ) (inherits from SFRTracer)
RegisterTracer( SFCEventEnum type , UInt16 p16 , BehaviorType behavior , TracerEnum trace ) (inherits from SFRTracer)
RegisterTracer( SFCEventEnum type , BehaviorType behavior , TracerEnum trace ) (inherits from SFRTracer)
Register the tracer.
Void Scroll( SFXSizeConstRef size ) (inherits from SFRResponder)
Scroll the virtual region.
Bool ScrollDownHandler( Void ) (inherits from SFRResponder)
[Handler] Scroll the virtual region down.
Bool ScrollLeftHandler( Void ) (inherits from SFRResponder)
[Handler] Scroll the virtual region left.
Bool ScrollRightHandler( Void ) (inherits from SFRResponder)
[Handler] Scroll the virtual region right.
Bool ScrollUpHandler( Void ) (inherits from SFRResponder)
[Handler] Scroll the virtual region up.
Void Select( Void ) (inherits from SFRResponder)
Select the responder and move it to the most foreground.
Bool SelectHandler( Void ) (inherits from SFRResponder)
[Handler] Set the target status of a responder to true.
Void SetBaseBound( SFXRectangleConstRef rect ) (inherits from SFRResponder)
Set the base region with the coordinate of virtual region of parent responder.
Void SetContentBound( SFXRectangleConstRef rect ) (inherits from SFRResponder)
Set the content region with the coordinate of base region.
Void SetFrameMargin( SFXMarginConstRef param ) (inherits from SFRResponder)
Set the margin between base and content region(in pixels).
Void SetMoveInterval( SInt16 interval ) (inherits from SFRResponder)
Set the move interval in pixels.
Void SetMoveMargin( SInt16 margin ) (inherits from SFRResponder)
Set the margin pixels of content region ( or virtual region if set with the parent responder ) where the child responder cannot move.
Void SetReference( VoidPtr ref ) (inherits from SFRResponder)
Set the reference value.
Void SetScrollInterval( SInt16 interval ) (inherits from SFRResponder)
Set the scroll interval in pixels.
Void SetStatusEnable( Bool enable ) (inherits from SFRResponder)
Set the value of " Enable / Disable " flag.
Void SetStatusFocus( Bool focus ) (inherits from SFRResponder)
Set the value of " Focused / Unfocused " flag.
Void SetStatusTarget( Bool target ) (inherits from SFRResponder)
Set the value of " Target / Not-Target " flag.
Void SetStatusVisible( Bool visible ) (inherits from SFRResponder)
Set the value of " Visible / Invisible " flag.
Void SetTranslate( SFXGridConstRef point ) (inherits from SFRResponder)
Set the origin coordinate of virtual region with the coordinate of content region.
Void SetTravelMargin( SInt16 margin ) (inherits from SFRResponder)
Set the margin pixels of content region inside which the rectangle in the virtual region but outside the content region should be automatically scrolled by using the SFRResponder::Travel function.
Void SetVirtualBound( SFXRectangleConstRef rect ) (inherits from SFRResponder)
Set the virtual region with the coordinate of content region.
Void Travel( SFXRectangleConstRef rect ) (inherits from SFRResponder)
Scroll the virtual region of responder so that the specified rectangle can get into the content region.
Void Ungroup( Void ) (inherits from SFRResponder)
Ungroup the responders which are grouped together.
Void UnregisterHandler( HandlerEnum timing ) (inherits from SFRHandler)
UnregisterHandler( SFCEventEnum bgnType , SFCEventEnum endType , UInt16 bgnP16 , UInt16 endP16 , HandlerEnum timing ) (inherits from SFRHandler)
UnregisterHandler( SFCEventEnum bgnType , SFCEventEnum endType , UInt16 p16 , HandlerEnum timing ) (inherits from SFRHandler)
UnregisterHandler( SFCEventEnum bgnType , SFCEventEnum endType , HandlerEnum timing ) (inherits from SFRHandler)
UnregisterHandler( SFCEventEnum type , UInt16 bgnP16 , UInt16 endP16 , HandlerEnum timing ) (inherits from SFRHandler)
UnregisterHandler( SFCEventEnum type , UInt16 p16 , HandlerEnum timing ) (inherits from SFRHandler)
UnregisterHandler( SFCEventEnum type , HandlerEnum timing ) (inherits from SFRHandler)
Unregister the registered handler.
Void UnregisterTracer( Void ) (inherits from SFRTracer)
UnregisterTracer( SFCEventEnum bgnType , SFCEventEnum endType , UInt16 bgnP16 , UInt16 endP16 ) (inherits from SFRTracer)
UnregisterTracer( SFCEventEnum bgnType , SFCEventEnum endType , UInt16 p16 ) (inherits from SFRTracer)
UnregisterTracer( SFCEventEnum bgnType , SFCEventEnum endType ) (inherits from SFRTracer)
UnregisterTracer( SFCEventEnum type , UInt16 bgnP16 , UInt16 endP16 ) (inherits from SFRTracer)
UnregisterTracer( SFCEventEnum type , UInt16 p16 ) (inherits from SFRTracer)
UnregisterTracer( SFCEventEnum type ) (inherits from SFRTracer)
Unregister the tracer.
Protected Functions
Void DoneNotifyHandler( DoneNotifyConstRef notify )
[Handler] Notify the end of rendering.
Void FocusNotifyHandler( FocusNotifyConstRef notify )
[Handler] Notify the movement of the cursor.
Void JumpNotifyHandler( JumpNotifyConstRef notify )
[Handler] Notify when the link is pressed.
Bool ResponseNotifyHandler( ResponseNotifyConstRef notify )
[Handler] Notify that the server connection completes.
Bool GetAppearanceTransparent( Void ) (inherits from SFRResponder)
Get the value of APPEARANCE_TRANSPARENT flag.
Bool GetPropertyClosable( Void ) (inherits from SFRResponder)
Get the value of PROPERTY_CLOSABLE flag.
Bool GetPropertyDirect( Void ) (inherits from SFRResponder)
Get the value of PROPERTY_DIRECT flag.
Bool GetPropertyMovable( Void ) (inherits from SFRResponder)
Get the value of PROPERTY_MOVABLE flag.
Bool GetPropertyScrollable( Void ) (inherits from SFRResponder)
Get the value of PROPERTY_SCROLLABLE flag.
Bool GetPropertySelect( Void ) (inherits from SFRResponder)
Get the value of PROPERTY_SELECT flag.
Bool GetPropertyTravel( Void ) (inherits from SFRResponder)
Get the value of PROPERTY_TRAVEL flag.
HandlerRecConstPtr SearchHandler( SFXEventConstRef event , HandlerEnum timing ) (inherits from SFRHandler)
Search for the handler that matches with a specified event.
TracerRecConstPtr SearchTracer( SFXEventConstRef event ) (inherits from SFRTracer)
Search for the tracer that matches with a specified event.
Types
DEFAULT
Enumerated type for the initial value of SFRBrowserControl parameter.
DoneNotify
The class to preserve the information on the timing when rendering is finished.
FocusNotify
The class to preserve the information on the focus movement of browser.
HistoryEntry
The structure for history entries.
JumpNotify
The class to preserve the information on the url links pressed in the browser by user.
ResponseNotify
The class to preserve the information on the timing when rendering is finished.
BehaviorEnum (inherits from SFRControl)
Constant that represents the behavior of control.
HandlerEnum (inherits from SFRHandler)
Constant that represents the timing to call the handler.
SFRHandlerSPP (inherits from SFRHandler)
Type of callback function.
TracerEnum (inherits from SFRTracer)
Constant that represents the trace order.
TracerTraceMPP (inherits from SFRTracer)
Type of callback function.

SFRBrowserControl::SFRBrowserControl
Constructor of SFRBrowserControl class.
[ public ]
SFRBrowserControl(
    SFRResponderPtr director                             // parent responder
    SFXRectangleConstRef rect                            // size of the control
    BehaviorType behavior = BEHAVIOR_SFRBROWSERCONTROL   // behavior
    SFCType attribute = ATTRIBUTE_SFRBROWSERCONTROL      // attribute
);

Return value

  • Success : SFERR_NO_ERROR
  • If failed : SFERR_FAILED

Description

Initialize member variables, and create the IHtmlViewer interface for rendering the web pages.(*)

* The IWeb interface is not created here.


SFRBrowserControl::~SFRBrowserControl
Destructor of SFRBrowserControl class.
[ public, virtual ]
~SFRBrowserControl(Void);

Description

The SFRBrowserControl::~SFRBrowserControl function terminates communication and rendering of HTML data and releases all the resources internally.


SFRBrowserControl::ClearHistory
Clear the history list.
[ public ]
SFCError ClearHistory(Void);

Return value

  • Success : SFERR_NO_ERROR
  • If failed : error value except SFERR_NO_ERROR

Description

Return the current history number as 0.

Reference

SFRBrowserControl::GetCurrentHistoryIndex


SFRBrowserControl::DoneNotifyHandler
[Handler] Notify the end of rendering.
[ protected, virtual ]
Void DoneNotifyHandler(
    DoneNotifyConstRef notify   // the notify
);

Argument

notify

The information to be notified is set in the "notify" argument. The HTTP response code or the BREW error code can be gotten through this argument.

Instruction

By default nothing happens when the SFRBrowserControl::DoneNotifyHandler function is called.

To do something through this function, it is necessary to override the the SFRBrowserControl::DoneNotifyHandler function.

The timing when the SFRBrowserControl::DoneNotifyHandler function is called is different from that of the SFRBrowserControl::ResponseNotifyHandler function.

Example

Example of overriding.

#include <SFRResponder/SFRControl/SFRBrowserControl.hpp>

class MyBrowserControl : public SFRBrowserControl {
public:
    MyBrowserControl(SFRResponderPtr director, SFXRectangleConstRef rect)
        : SFRBrowserControl(director, rect) {
    }

protected:
    virtual Void DoneNotifyHandler(DoneNotifyConstRef notify) {
        if (notify.GetErrorCode() != SFERR_NO_ERROR) {
            // if communication error occored, show the error dialog
            ErrorDialog(notify.GetErrorCode());
        }
        else if (WEB_SUCCEEDED(notify.GetDoneCode())) {
            // if HTTP error occored, show the warning dialog
            WarningDialog(notify.GetResposenCode());
        }
    }
};

Reference

SFRBrowserControl::DoneNotify | SFRBrowserControl::FocusNotifyHandler | SFRBrowserControl::JumpNotifyHandler | SFRBrowserControl::ResponseNotifyHandler


SFRBrowserControl::FindElement
Find the specified element in the current page.
[ public, const ]
SInt32 FindElement(
    ACharConstPtr element   // name of element
    SInt32 no               // the number of element
);

Argument

element

Specify the name of element to find.

no

Specify the index number of element to find.

If set to 0, the first matching element is returned. If set to n, the (n+1)th matching element is returned.

Return value

Return the index of specified element when found. Return a minus value when not found.

Description

The SFRBrowserControl::FindElement function is used to search the specified element in the current page. The index of specified element that is found can be used in the SFRBrowserControl::GetElementText or SFRBrowserControl::GetElementAttribute function.

Reference

SFRBrowserControl::GetElementText | SFRBrowserControl::GetElementAttribute


SFRBrowserControl::FocusNotifyHandler
[Handler] Notify the movement of the cursor.
[ protected, virtual ]
Void FocusNotifyHandler(
    FocusNotifyConstRef notify   // the notify
);

Argument

notify

The notify. It gets the current position, type and status of the tag that the cursor is pointing to.

Description

It do nothing in a standard implement.

If do something outside the standard, users need to override the FocusNotifyHandler() function.

Reference

SFRBrowserControl::FocusNotify | SFRBrowserControl::DoneNotifyHandler | SFRBrowserControl::JumpNotifyHandler | SFRBrowserControl::ResponseNotifyHandler


SFRBrowserControl::GetCurrentHistory
Get the URL and title of current page
[ public, const ]
HistoryEntry GetCurrentHistory(Void);

Return value

It returns the history of the current page.

Reference

SFRBrowserControl::GetCurrentHistoryIndex | SFRBrowserControl::GetHistory


SFRBrowserControl::GetCurrentHistoryIndex
Get the index of current history.
[ public, const ]
UInt32 GetCurrentHistoryIndex(Void);

Return value

It returns the current history index of the current page.

Description

It can be modified by Move function, Previous function, and Next function. And can be initialized to 0 by ClearHistory function.

Reference

SFRBrowserControl::Move | SFRBrowserControl::Previous | SFRBrowserControl::Next | SFRBrowserControl::ClearHistory


SFRBrowserControl::GetElementAttribute
Get the attribute of specified element.
[ public, const ]
SFXAnsiString GetElementAttribute(
    SInt32 elementIndex   // index of the element
    ACharConstPtr attr    // attribute
);

Argument

elementIndex

Specify the index of element returned by the SFRBrowserControl::FindElement function. function.

attr

Specify the attribute name.

Return value

Return the content of attribute. If the specified attribute is not found, an empty string is returned.

Description

Get the attribute of specified element in the current page. if the specified element is not found, an empty string is returned.

[Important] About the attribute without value.

As for an element such as <HR NOSHADE> which has an attribute without value, when trying to get its attribute, "NOSHADE" which is the same as the name of attribute is returned.

Reference

SFRBrowserControl::FindElement | SFRBrowserControl::GetElementText


SFRBrowserControl::GetElementText
Get the text of specified element.
[ public, const ]
SFXAnsiString GetElementText(
    SInt32 elementIndex   // index of element
);

Argument

elementIndex

Specify the index of element returned by the SFRBrowserControl::FindElement function. function

Return values

Return the content of element. If the specified element is empty, an empty string is returned.

Description

Get the text of specified element in the current page.

Reference

SFRBrowserControl::FindElement | SFRBrowserControl::GetElementAttribute


SFRBrowserControl::GetHistory
Get the history content by the specified index.
[ public, const ]
HistoryEntry GetHistory(
    UInt32 historyIndex = 0   // history index
);

Argument

historyIndex

Specify the history index. If not specified, index is set to 0, and the last history content visited is returned.

Return value

Return the history content. If there is no history content, or the historyIndex argument is invalid, an empty string is set to the "url" member of SFRBrowserControl::HistoryEntry structure.

Reference

SFRBrowserControl::HistoryEntry | SFRBrowserControl::GetHistoryList | SFRBrowserControl::GetCurrentHistory


SFRBrowserControl::GetHistoryList
Get the history list.
[ public, const ]
HistoryEntryConstPtr GetHistoryList(Void);

Return value

Return a pointer to the history list: an array of SFRBrowserControl::HistoryEntry structure, which size is the return value by the SFRBrowserControl::GetHistorySize function.

Description

The top entry of history list is the latest history, and the history number matches with the index of entry of history list.

If no information is set to a history entry, its "url" member of SFRBrowserControl::HistoryEntry structure is set to an empty string.

[Warning] Warning

The history list returned by the SFRBrowserControl::GetHistoryList function must not be modified.

Example

Display all the titles and URLs in the history list for debugging.

void PrintHistoryList(SFBrowserControlConstRef browser)
{
    int i;
    SFBrowserControl::HistoryEntryConstPtr historyList = browser.GetHistoryList();
    for (i=0; i < browser.GetHistorySize(); i++) {
        DBGPRINTF("title '%s' url %s",
                  (ACharConstPtr)historyList[i].title, (ConstACharPtr)historyList[i].url); 
    }
}

Reference

SFRBrowserControl::HistoryEntry | SFRBrowserControl::GetHistorySize


SFRBrowserControl::GetHistorySize
Get the number of entries in history list.
[ public, const ]
UInt32 GetHistorySize(Void);

Return value

Return the number of entries in the current history list.

Description

The history number used by the SFRBrowserControl::Move or SFRBrowserControl::GetHistory function must be less than the number of entries in history list returned by the SFRBrowserControl::GetHistorySize function.

* The size of history list returned by the SFRBrowserControl::GetHistoryList function equals the return value of SFRBrowserControl::GetHistorySize function.

Reference

SFRBrowserControl::GetHistory | SFRBrowserControl::GetHistoryList | SFRBrowserControl::Move | SFRBrowserControl::SetHistorySize


SFRBrowserControl::GetIndent
Get the width of indent.
[ public, const ]
SInt32 GetIndent(Void);

Return value

Return the width of specified indent in pixels.

Reference

SFRBrowserControl::SetIndent


SFRBrowserControl::GetLinkColor
Get the color of link text.
[ public, const ]
SFXRGBColor GetLinkColor(Void);

Return value

Return the color of link text.

Reference

SFRBrowserControl::SetLinkColor | SFRBrowserControl::GetTextColor


SFRBrowserControl::GetParagraphSpacing
Get the spacing between paragraphs.
[ public, const ]
SInt32 GetParagraphSpacing(Void);

Return value

Return the spacing between paragraphs in pixels.

Reference

SFRBrowserControl::SetParagraphSpacing


SFRBrowserControl::GetScrollbarWidth
Get the width of scroll bar.
[ public, const ]
SInt32 GetScrollbarWidth(Void);

Return value

Return the width of scroll bar in pixels.

Reference

SFRBrowserControl::SetScrollbarWidth


SFRBrowserControl::GetTextColor
Get the text color.
[ public, const ]
SFXRGBColor GetTextColor(Void);

Return value

Return the text color of HTML.

Reference

SFRBrowserControl::SetTextColor | SFRBrowserControl::GetLinkColor


SFRBrowserControl::GetWeb
Get the IWeb instance for communication.
[ public, const ]
SFBWebSmpConstRef GetWeb(Void);

Return value

If the IWeb instance is not set by the SFRBrowserControl::SetWeb function and the IWeb instance is not created internally, return null.

Description

[Important] Caution when specifying the WebOpt.

Though any WebOpt can be set to the IWeb instance, the user setting of WebOpt must be preserved until another IWeb instance is used.

Please see the "Instructions about the life-time of WEBOPT" in the BREW API Reference.

[Important] The behavior when suspended.

When suspended, the IWeb instance is set to be created internally by default settings.

At this time, the information on WebOpt settings is also reset.

To continue to use your own IWeb instance, set it by the resume handler again.

Reference

SFBWeb | SFRBrowserControl::UnsetWeb | SFRBrowserControl::SetWeb


SFRBrowserControl::IsBusy
Check whether or not the browser control is busy in accessing the network, or rendering.
[ public, const ]
Bool IsBusy(Void);

Return value

  • If the browser control is busy in accessing the network, or rendering : true
  • Otherwise : false

SFRBrowserControl::IsInlineEditEnable
Check whether the text is edited in some part of screen or not.
[ public, const ]
Bool IsInlineEditEnable(Void);

Return value

  • If the text is edited in some part of screen : true
  • Otherwise ( i.e. the text is edited in the full screen ) : false

Reference

SFRBrowserControl::SetInlineEditEnable


SFRBrowserControl::IsScrollbarEnable
Check whether the scroll bar is enabled or not.
[ public, const ]
Bool IsScrollbarEnable(Void);

Return value

  • If the scroll bar is enabled : true
  • Otherwise : false

Reference

SFRBrowserControl::SetScrollbarEnable


SFRBrowserControl::JumpNotifyHandler
[Handler] Notify when the link is pressed.
[ protected, virtual ]
Void JumpNotifyHandler(
    JumpNotifyConstRef notify   // the notify information
);

Argument

notify

The information to be notified is set in the "notify" argument. The URL, HTTP method, POST data of pressed link are preserved.

Description

Open the linked URL automatically.

The SFRBrowserControl::JumpNotifyHandler function do nothing except the http://, https://, file://, and res:// streams.

To do something other than default settings, it is necessary to override the SFRBrowserControl::JumpNotifyHandler function.

Example

Example of overriding.

#include <SFRResponder/SFRControl/SFRBrowserControl.hpp>

class MyBrowserControl : public SFRBrowserControl {
public:
    MyBrowserControl(SFRResponderPtr director, SFXRectangleConstRef rect)
        : SFRBrowserControl(director, rect) {
    }

protected:
    virtual Void JumpNotifyHandler(JumpNotifyConstRef notify) {
        if (notify.GetUrl().StartWith("mailto:")) {
            // if it's "mailto:", call the mailer
            Mailer(notify.GetUrl());
        }
        else {
            // or just call the standard handler
            SFRBrowserControl::JumpNotifyHandler(notify);
        }
    }
};

Reference

SFRBrowserControl::JumpNotify | SFRBrowserControl::Open | SFRBrowserControl::DoneNotifyHandler | SFRBrowserControl::FocusNotifyHandler | SFRBrowserControl::ResponseNotifyHandler


SFRBrowserControl::Load
Start to render the string in the HTML format.
[ public ]
SFCError Load(
    SFXAnsiStringConstRef data   // HTML data
);
[ public ]