www.pudn.com > S60_Platform_Bluetooth_OBEX_Example.rar > btobjectexchangeappview.h


/* Copyright (c) 2004, Nokia. All rights reserved */ 
 
 
#ifndef __BTOBJECTEXCHANGEAPPVIEW_H__ 
#define __BTOBJECTEXCHANGEAPPVIEW_H__ 
 
// INCLUDES 
#include  
#include  
#include "Log.h" 
 
// CONSTANTS 
static const TInt KMaxTIntLen = 8; 
static const TInt KMessageHeaderLen = 8; 
_LIT(KTabulator,"\t"); 
 
/** 
* CBTObjectExchangeAppView 
* An instance of the Application View object for the BTObjectExchange 
* example application 
*/ 
class CBTObjectExchangeAppView : public CCoeControl, 
                                 public MLog 
    { 
    public: // Constructors and destructor 
 
        /** 
        * NewL() 
        * Create a CBTObjectExchangeAppView object, which 
        * will draw itself to aRect 
        * @param aRect the rectangle this view will be drawn to 
        * @return a pointer to the created instance of CBTObjectExchangeAppView 
        */ 
        static CBTObjectExchangeAppView* NewL( const TRect& aRect ); 
 
        /** 
        * NewLC() 
        * Create a CBTObjectExchangeAppView object, which will draw 
        * itself to aRect 
        * @param aRect the rectangle this view will be drawn to 
        * @return a pointer to the created instance of CBTObjectExchangeAppView 
        */ 
        static CBTObjectExchangeAppView* NewLC( const TRect& aRect ); 
 
        /** 
        * ~CBTObjectExchangeAppView() 
        * Destroy the object and release all memory objects 
        */ 
        virtual ~CBTObjectExchangeAppView(); 
 
    public: // Functions from base classes 
 
        /** 
        * ContainsEntries() 
        * Does the view contain any log entries 
        * @return ETrue if the list view contains 1 or more entries 
        */ 
        TBool ContainsEntries(); 
 
        /** 
        * ClearMessageListL() 
        * Clears all the entries in the list view 
        */ 
        void ClearMessageListL(); 
 
    public:  // from CCoeControl 
 
        /** 
        * OfferKeyEventL() 
        * Offer the key event to the list box 
        * @param aKeyEvent the key that caused the event 
        * @param aType the type of event that occured 
        * @return Indicates whether or not the key event was used. 
        */ 
        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
                                        TEventCode aType ); 
 
        /** 
        * CountComponentControls() 
        * Return the number of component controls 
        * @return the number of component controls 
        */ 
        TInt CountComponentControls() const; 
 
        /** 
        * ComponentControl() 
        * Return a component control 
        * @param aIndex the index of the control to return 
        * @return the specified component control 
        */ 
        CCoeControl* ComponentControl( TInt aIndex ) const; 
         
        void SizeChanged(); 
 
    public: // from MLog 
 
        /** 
        * LogL() 
        * Add an entry to the log. 
        * @param aText the text of the entry 
        */ 
        void LogL( const TDesC& aText ); 
 
        /** 
        * LogL() 
        * Add an entry to the log. 
        * @param aText the text of the entry 
        * @param aExtraText extra text to append onto the entry 
        */ 
        void LogL( const TDesC& aText, const TDesC& aExtraText ); 
 
        /** 
        * LogL() 
        * Add an entry to the log. 
        * @param aText the text of the entry 
        * @param aNumber a number to append onto the entry 
        */ 
        void LogL( const TDesC& aText, TInt aNumber ); 
        
    private:  
        TBool HandleJoystickPressL(TDesC& aLine); 
 
    private:    // Constructors 
 
        /** 
        * ConstructL() 
        * Perform the second phase construction of a 
        * CBTObjectExchangeAppView object. 
        * @param aRect the rectangle this view will be drawn to 
        */ 
        void ConstructL( const TRect& aRect ); 
 
        /** 
        * CBTObjectExchangeAppView 
        * Perform the first phase of two phase construction 
        */ 
        CBTObjectExchangeAppView(); 
 
    private:    // data 
 
        /** 
        * iListBox the control used to display the results 
        * Owned by CBTObjectExchangeAppView 
        */ 
        CEikTextListBox* iListBox; 
 
        /** 
        * iMessageList the list of messages to display 
        * Not owned by CBTObjectExchangeAppView 
        */ 
        CDesCArrayFlat* iMessageList; 
 
        /** iMsgIndex the id for the next message in the list */ 
        TInt iMsgIndex; 
    }; 
 
#endif // __BTOBJECTEXCHANGEAPPVIEW_H__ 
 
// End of File