S60 3rd Edition SDK for Symbian OS
Example Applications Guide

BrCtlSampleAppContainer.h

00001 /*
00002 * ============================================================================
00003 *  Name         : BrCtlSampleAppContainer.h
00004 *  Part of      : BrCtlSampleApp
00005 *  Interface    : Browser Control API
00006 *  Description  : Declares container control for Browser Control Sample application.
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 #ifndef BRCTLSAMPLEAPPCONTAINER_H
00017 #define BRCTLSAMPLEAPPCONTAINER_H
00018 
00019 // INCLUDES
00020 #include <coecntrl.h>
00021 #include "BrCtlInterface.h"
00022 
00023 // FORWARD DECLARATIONS
00024 class CBrCtlSampleAppSpecialLoadObserver;
00025 class CBrCtlSampleAppLayoutObserver;
00026 class CBrCtlSampleAppSoftkeysObserver;
00027 class CBrCtlSampleAppLoadEventObserver;
00028 class CBrCtlSampleAppLinkResolver;
00029 class CBrCtlSampleAppStateChangeObserver;
00030 class CBrCtlSampleAppDialogsProvider;
00031 
00032 // CLASS DECLARATION
00033 
00034 /**
00035 *  CBrCtlSampleAppContainer class.
00036 *  This is the container control class.
00037 */
00038 class CBrCtlSampleAppContainer : public CCoeControl, MCoeControlObserver, MBrCtlDataLoadSupplier
00039     {
00040     public: // Constructors and destructor
00041         
00042         /**
00043         * EPOC default constructor.
00044         * @param aRect Frame rectangle for container.
00045         */
00046         void ConstructL(const TRect& aRect);
00047 
00048         /**
00049         * Destructor.
00050         */
00051         ~CBrCtlSampleAppContainer();
00052 
00053     public: // New functions
00054 
00055         /**
00056         * Pass a command to the Browser Control
00057         * @since 2.8
00058         * @param aCommand The command that the Browser Control should process
00059         * @return void
00060         */
00061         void HandleCommandL(TInt aCommand);
00062 
00063         /**
00064         * Dynamically initialises a menu pane. The Uikon framework calls this 
00065         *   function, if it is implemented in a menu’s observer, immediately before 
00066         *   the menu pane is activated. 
00067         * @since 2.8
00068         * @param aResourceId Resource ID identifying the menu pane to initialise
00069         * @param aMenuPane The in-memory representation of the menu pane.
00070         * @return void
00071         */
00072         void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
00073 
00074         /**
00075         * Handles key events
00076         * @since 2.8
00077         * @param aKeyEvent The key event that occurred.
00078         * @param aType The window server event type that is being handled
00079         * @return TKeyResponse Value indicates whether or not the key event was consumed by the control. The default implementation simply returns EKeyWasNotConsumed.
00080         */
00081         TKeyResponse HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
00082         
00083         /**
00084         * Accessor method for iText
00085         * @since 2.8
00086         * @param void
00087         * @return TDesc& The descriptor of the text
00088         */
00089         inline const TDesC& Text() const {return iText;}
00090        
00091         /**
00092         * Setter method for iText
00093         * @since 2.8
00094         * @param aText The descriptor for the text you wish to display
00095         * @return void
00096         */
00097         void SetText( const TDesC& aText );
00098         
00099         /**
00100         * Setter method for iPoint
00101         * @since 2.8
00102         * @param aPoint The point at which you want to display the text
00103         * @return void
00104         */
00105         void SetPoint( const TPoint& aPoint );
00106         
00107         /**
00108         * Accessor method iBrCtlInterface
00109         * @since 2.8
00110         * @param void
00111         * @return CBrCtlInterface* A pointer to the browser control interface as a convenience to the observers
00112         */
00113         inline CBrCtlInterface* BrCtlInterface() const {return iBrCtlInterface;}
00114 
00115     private: // Functions from base classes
00116 
00117         /**
00118         * From CoeControl,SizeChanged.
00119         */
00120         void SizeChanged();
00121 
00122         /**
00123         * From CoeControl,CountComponentControls.
00124         */
00125         TInt CountComponentControls() const;
00126 
00127         /**
00128         * From CCoeControl,ComponentControl.
00129         */
00130         CCoeControl* ComponentControl(TInt aIndex) const;
00131 
00132         /**
00133         * From CCoeControl,Draw.
00134         */
00135         void Draw(const TRect& aRect) const;
00136 
00137         /**
00138         * Handle key events.
00139         */
00140         TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
00141 
00142         /**
00143         * From MBrCtlDataLoadSupplier, Cancel an on-going load
00144         */
00145         void CancelLoad();
00146 
00147         /**
00148         * Create a Basic Browser Control that does not have observers with scrolling
00149         * and HTTP framework capabilities
00150         */
00151         void CreateBasicBrowserControlL();
00152 
00153         /**
00154         * Create Browser Control with observers with the given capabilities
00155         */
00156         void CreateBrowserControlWithObserversL(TUint aCapabilities);
00157 
00158             /**
00159         * Read the file.
00160         */
00161         HBufC8* ReadFileLC(const TDesC& aFileName);
00162 
00163         /**
00164         * Handles an event from an observed control.
00165         */
00166         void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
00167         
00168         /**
00169         * The following methods are used to demonstrate the functionality of 
00170         * the browser control API
00171         */
00172         void BasicBrowserControlL();
00173         void BrowserControlWithObserversL();
00174         void LoadingContentWithFileHandleL();
00175         void LoadingContentWithBufferL();
00176         void IncrementalLoadingL();
00177         void SpecialLoadRequestsL();
00178         void CustomizedDialogsL();
00179         void CustomizedSoftKeysL();
00180         void ResolvingEmbeddedLinksL();
00181         void CustomizedScrollBarsL();
00182         void HandleStateChangedL();
00183         void ChangeSizeExtentsL();
00184         void PageInfoL();
00185         void ContentSizeImageCountL();
00186         
00187     private: //data 
00188         // Pointer to the browser control interface
00189         CBrCtlInterface* iBrCtlInterface;
00190         // Desired capabilities of the browser control
00191         TUint iBrCtlCapabilities;
00192         // Command Base
00193         TInt iCommandBase;
00194         // Special Load Observer
00195         CBrCtlSampleAppSpecialLoadObserver* iBrCtlSampleAppSpecialLoadObserver;
00196         // Layout Observer
00197         CBrCtlSampleAppLayoutObserver* iBrCtlSampleAppLayoutObserver;
00198         // Softkeys Observer
00199         CBrCtlSampleAppSoftkeysObserver* iBrCtlSampleAppSoftkeysObserver;
00200         // Load Event Observer
00201         CBrCtlSampleAppLoadEventObserver* iBrCtlSampleAppLoadEventObserver;
00202         // Link Resolver
00203         CBrCtlSampleAppLinkResolver* iBrCtlSampleAppLinkResolver;
00204         // State Change Observer
00205         CBrCtlSampleAppStateChangeObserver* iBrCtlSampleAppStateChangeObserver;
00206         // Dialogs Provider
00207         CBrCtlSampleAppDialogsProvider* iBrCtlSampleAppDialogsProvider;
00208         // Informs whether or not CancelLoad has been called
00209         TBool iCancelInitDataLoad;
00210         // A graphics device to which a bitmap managed by the font and bitmap server can be drawn
00211         CFbsScreenDevice* iFbsScrDev;
00212         // Abstract font interface
00213         CFont* iFont;
00214         // Text to display to the screen if desired
00215         TPtrC iText;
00216         // Point at which to display text
00217         TPoint iPoint;
00218     };
00219 
00220 #endif
00221 
00222 // End of File
00223 

© Nokia 2006

Back to top