S60 3rd Edition SDK for Symbian OS
Example Applications Guide

ChatContainer.h

00001 /*
00002 * ==============================================================================
00003 *  Name        : ChatContainer.h
00004 *  Part of     : Chat
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 CHATCONTAINER_H
00017 #define CHATCONTAINER_H
00018 
00019 // INCLUDES
00020 #include <coecntrl.h>
00021 #include <AknQueryDialog.h>
00022 #include <aknlists.h>
00023 #include "Log.h"
00024 
00025 // FORWARD DECLARATIONS
00026 class CEikLabel;
00027 
00028 // CONSTANTS
00029 const TInt KMessageHeaderLen = 8;
00030 const TInt KMessageListLen = 10;
00031 
00032 // CLASS DECLARATION
00033 
00034 /**
00035 *  CChatContainer  container control class.
00036 *  
00037 */
00038 class CChatContainer : public CCoeControl, public MLog
00039     {
00040     public: // Constructors and destructor
00041         
00042         /**
00043         * NewL()
00044         * Create a CChatContainer object, which will draw itself
00045         * to aRect
00046         * @param aRect the rectangle this view will be drawn to
00047         * @return a pointer to the created instance of 
00048         * CChatContainer
00049         */
00050         static CChatContainer* NewL( const TRect& aRect );
00051 
00052         /**
00053         * NewLC()
00054         * Create a CChatContainer object, which will draw 
00055         * itself to aRect
00056         * @param aRect the rectangle this view will be drawn to
00057         * @return a pointer to the created instance of 
00058         * CChatContainer
00059         */
00060         static CChatContainer* NewLC( const TRect& aRect );
00061         
00062         /**
00063         * Destructor.
00064         */
00065         ~CChatContainer();
00066 
00067     public: // New functions
00068     
00069         /**
00070         * ContainsEntries()
00071         * @return ETrue if the list view contains entries
00072         */
00073         TBool ContainsEntries();
00074 
00075         /**
00076         * ClearMessageListL()
00077         * Clear the list of messages.
00078         */
00079         void ClearMessageListL();
00080     
00081         /**
00082         * ShowDataQueryL()
00083         * Show data query.
00084         * @param aQueryResourceId the id of the query
00085         * @param aTextResourceId for inial value
00086         * @param aPromptResoureId for prompt
00087         * @param aMaxLength sets up the length of the character
00088         * @param aDisplayFlag sets the query visible   
00089         * @param aText text to be set to the list             
00090         */
00091         void ShowDataQueryL(
00092             const TInt aQueryResourceId,
00093             const TInt aTextResourceId,
00094             const TInt aPromptResoureId,
00095             const TInt aMaxLength,
00096             const TBool aDisplayFlag,
00097             TDes& aText );
00098   
00099     public: // from MLog
00100 
00101         /**
00102         * LogL()
00103         * Add an entry to the log.
00104         * @param aText the text of the entry
00105         */
00106         void LogL( const TDesC& aText );
00107 
00108         /**
00109         * LogL()
00110         * Add an entry to the log.
00111         * @param aText the text of the entry
00112         * @param aExtraText extra text to append onto the entry
00113         */
00114         void LogL( const TDesC& aText, const TDesC& aExtraText );
00115 
00116         /**
00117         * LogL()
00118         * Add an entry to the log.
00119         * @param aText the text of the entry
00120         * @param aNumber a number to append onto the entry
00121         */
00122         void LogL( const TDesC& aText, TInt aNumber );
00123         
00124     public:  // from CCoeControl
00125 
00126         /**
00127         * OfferKeyEventL()
00128         * Offer the key event to the list box
00129         * @param aKeyEvent the key that caused the event
00130         * @param aType the type of event that occured
00131         * @return indicates whether or not the key event
00132         * was used by this control
00133         */  
00134         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
00135                                            TEventCode aType );
00136 
00137         /**
00138         * CountComponentControls()
00139         * Return the number of component controls
00140         * @return the number of component controls
00141         */
00142         TInt CountComponentControls() const;
00143 
00144         /**
00145         * ComponentControl()
00146         * Return a component control
00147         * @param aIndex the index of the control to return
00148         * @return the specified component control
00149         */
00150         CCoeControl* ComponentControl( TInt aIndex ) const;
00151         
00152        
00153     private: // Functions from base classes 
00154 
00155        /**
00156         * From CoeControl,SizeChanged.
00157         */
00158         void SizeChanged();
00159 
00160     private:    // Constructors
00161 
00162         /**
00163         * ConstructL()
00164         * Perform the second phase construction
00165         * @param aRect the rectangle this view will be drawn to
00166         */
00167         void ConstructL( const TRect& aRect );
00168 
00169         /**
00170         * CBTPointToPointAppView()
00171         * Perform the first phase of two phase construction 
00172         */
00173         CChatContainer();
00174 
00175         
00176     private: //data
00177         
00178         /** 
00179         * iDisplayDialog
00180         * boolean for Display Dialog 
00181         */
00182         TBool iDisplayDialog; 
00183     
00184         /** 
00185         * iQueryDialog
00186         */
00187         CAknQueryDialog* iQueryDialog;
00188         
00189         /**
00190         * iLabelResultMessage 
00191         */
00192         CEikLabel* iLabelResultMessage; 
00193         
00194         /** 
00195         * iListBox the control used to display the results 
00196         * Owned by CCChatContainer
00197         */
00198         CEikTextListBox* iListBox;
00199 
00200         /** 
00201         * iMessageList the list of messages to display 
00202         * Not owned by CChatContainer
00203         */
00204         CDesCArrayFlat* iMessageList;
00205 
00206         /** 
00207         * iMsgIndex 
00208         * the id for the next message in the list 
00209         */
00210         TInt iMsgIndex;
00211     };
00212 
00213 #endif // CHATCONTAINER_H
00214 
00215 // End of File

© Nokia 2006

Back to top