S60 3rd Edition SDK for Symbian OS
Example Applications Guide

WebClientContainer.h

00001 /*
00002 * ==============================================================================
00003 *  Name        : WebClientContainer.h
00004 *  Part of     : WebClient
00005 *  Interface   : 
00006 *  Description : 
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 WEBCLIENTCONTAINER_H
00017 #define WEBCLIENTCONTAINER_H
00018 
00019 // INCLUDES
00020 #include <coecntrl.h>
00021 #include <eikrted.h>
00022 #include "WebClientEngine.h"
00023 
00024 // CONSTANTS
00025 // Constants for CEikRichTextEditors
00026 const TInt KNumberOfLines = 0;
00027 const TInt KTextLimit = 128;
00028 const TInt KStatusWindowHeight = 34;
00029 const TInt KScrollBarWidth = 10;
00030 
00031 // FORWARD DECLARATIONS
00032 class CEikLabel;
00033 
00034 // CLASS DECLARATION
00035 
00036 /**
00037 *  CWebClientContainer class.
00038 * Applications view contains three CEikRichTextEditors for displaying received
00039 * data and status events.
00040 *
00041 */
00042 class CWebClientContainer : public CCoeControl,
00043                             public MCoeControlObserver,
00044                             public MWebClientObserver
00045     {
00046     public:
00047         /**
00048         * NewL()
00049         * Create a CClientEngine object.
00050         * @param aRect: Extents of the view.
00051         * @return A pointer to the created instance of CWebClientContainer
00052         */
00053         static CWebClientContainer* NewL( const TRect& aRect );
00054 
00055         /**
00056         * NewLC()
00057         * Create a CClientEngine object.
00058         * @param aRect: Extents of the view.
00059         * @return A pointer to the created instance of CWebClientContainer
00060         */
00061         static CWebClientContainer* NewLC( const TRect& aRect );
00062 
00063         /**
00064         * ~CWebClientContainer()
00065         * Destructor of CWebClientContainer.
00066         */
00067         ~CWebClientContainer();
00068 
00069         /**
00070         * ResetL()
00071         * Resets contents of the view.
00072         * Sets given text to label and clears CEikRichTextEditors.
00073         * @param aText: Label text.
00074         */
00075         void ResetL( const TDesC& aText );
00076 
00077         /**
00078         * HandleCommandL()
00079         * Handles user commands.
00080         * @param aCommand: Command ID.
00081         */
00082         void HandleCommandL( TInt aCommand );
00083 
00084     public: // Functions from base classes
00085         /**
00086         * From MWebClientObserver (see WebClientEngine.h)
00087         */
00088         void ClientEvent( const TDesC& aEventDescription );
00089         void ClientHeaderReceived( const TDesC& aHeaderData );
00090         void ClientBodyReceived( const TDesC8& aBodyData );
00091 
00092     private: // Functions from base classes
00093        /**
00094         * From CoeControl
00095         * SizeChanged()
00096         * Called by framework when the view size is changed.
00097         */
00098         void SizeChanged();
00099 
00100         /**
00101         * From CCoeControl
00102         * CountComponentControls()
00103         * Gets the number of controls contained in this compound control. 
00104         * @return Number of controls.
00105         */
00106         TInt CountComponentControls() const;
00107 
00108         /**
00109         * From CCoeControl
00110         * ComponentControl()
00111         * Gets the specified component of a compound control. 
00112         * @param aIndex: 
00113         * @return Pointer to control with index aIndex.
00114         */
00115         CCoeControl* ComponentControl( TInt aIndex ) const;
00116 
00117         /**
00118         * Draw()
00119         * From CCoeControl
00120         * Draws the view.
00121         * @param 
00122         *        aRect:
00123         * @return
00124         *         -
00125         */
00126         void Draw( const TRect& aRect ) const;
00127 
00128         /**
00129         * From CCoeControl
00130         * OfferKeyEventL()
00131         * Handles key events passed to this control (view).
00132         * @param aKeyEvent: The key event.
00133         * @param aType:     The type of key event: EEventKey, EEventKeyUp or 
00134         *                   EEventKeyDown.
00135         */
00136         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
00137 
00138         /**
00139         * From MCoeControlObserver
00140         * HandleControlEventL()
00141         * Handles control events.
00142         * @param aControl: Control
00143         * @param aEventType: Event type
00144         */
00145         void HandleControlEventL( CCoeControl*  /* aControl */, 
00146                                   TCoeEvent     /* aEventType */ );
00147     private:
00148         /**
00149         * ConstructL()
00150         * Perform the second phase construction of a CWebClientContainer object.
00151         * @param aRect: Extents of the view.
00152         */
00153         void ConstructL( const TRect& aRect );
00154 
00155         /**
00156         * CWebClientContainer()
00157         * Perform the first phase of two phase construction.
00158         */
00159         CWebClientContainer();
00160 
00161         /**
00162         * AddToHeaderWindowL()
00163         * Adds given text to header window (CEikRichTextEditor, iHeaderWindow)
00164         * Does not format the added text.
00165         * @param aText: A single line of text to be added.
00166         */
00167         void AddToHeaderWindowL( const TDesC& aText );
00168 
00169         /**
00170         * AddToSourceWindowL()
00171         * Adds given text to Source window (CEikRichTextEditor, iSourceWindow)
00172         * Does not format the added text.
00173         * @param aText: Text to be added.
00174         */
00175         void AddToSourceWindowL( const TDesC8& aText );
00176 
00177         /**
00178         * AddToStatusWindowL()
00179         * Adds given text to status window (CEikRichTextEditor, iStatusWindow)
00180         * @param aText: A single line of text to be added.
00181         */
00182         void AddToStatusWindowL( const TDesC& aText );
00183 
00184     private: // Data
00185         CEikLabel*              iLabel;
00186         CEikRichTextEditor*     iHeaderWindow;
00187         CEikRichTextEditor*     iSourceWindow;
00188         CEikRichTextEditor*     iStatusWindow;
00189 
00190 };
00191 
00192 #endif // WEBCLIENTCONTAINER_H

© Nokia 2006

Back to top