S60 3rd Edition SDK for Symbian OS
Example Applications Guide

LBSReferenceContainer.h

00001 /*
00002 * ==============================================================================
00003 *  Name        : LbsReferenceContainer.h
00004 *  Part of     : LBSReference example application
00005 *  Interface   : 
00006 *  Description : This class functions as view of the application
00007 *  Version     : 1.0
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 LBSREFERENCECONTAINER_H
00017 #define LBSREFERENCECONTAINER_H
00018 
00019 // INCLUDES
00020 #include <coecntrl.h>
00021 #include "LBSPositionListener.h"
00022 
00023 // FORWARD DECLARATIONS
00024 class CAknDoubleStyleListBox;
00025 class CLbsPositionRequestor;
00026 
00027 // CONSTANTS
00028 
00029 // Length of degree buffer
00030 const TInt KDegreeLength = 19;
00031 
00032 // Length of time buffer
00033 const TInt KDateTimeLength = 125;
00034 
00035 // maximum length a value string may have
00036 const TInt KValueMaxLength = 30;
00037 
00038 // CLASS DECLARATION
00039 
00040 /**
00041 *  CLbsReferenceContainer container control class.
00042 *
00043 */
00044 class CLbsReferenceContainer : public CCoeControl, 
00045                                public MLbsPositionListener
00046     {
00047     public: // Constructors and destructor
00048 
00049         /**
00050         * Constructor
00051         */
00052         CLbsReferenceContainer();
00053 
00054         /**
00055         * Symbian default constructor.
00056         * @param aRect Frame rectangle for container.
00057         */
00058         void ConstructL(const TRect& aRect);
00059 
00060         /**
00061         * Destructor.
00062         */
00063         ~CLbsReferenceContainer();
00064                 
00065     private:
00066 
00067         /**
00068         * Changes latitude or longitude represented as degrees to 
00069         * a string of a form +DDD'MM''SS.SSSS
00070         * @param aDegrees Degrees to trasform
00071         * @param aDegreesString Degrees string to be returned
00072         */
00073         void GetDegreesString(
00074             const TReal64& aDegrees,TBuf<KDegreeLength>& aDegreesString) const;
00075 
00076         /**
00077         * Processes position info to string representation.
00078         * @param aPositionInfo Position information to be processed
00079         */
00080         void ProcessPositionInfoL( const TPositionInfo& aPositionInfo );
00081 
00082         /**
00083         * Processes satellite position info to string representation.
00084         * @param aSatelliteInfo Position information to be processed.
00085         */
00086         void ProcessSatelliteInfoL( 
00087             const TPositionSatelliteInfo & aSatelliteInfo );
00088 
00089     public: // Functions from base classes
00090 
00091 
00092         // -----------------------------------------------------------------------------
00093         // From MPositionListener
00094         // -----------------------------------------------------------------------------
00095         //
00096         void PositionInfoUpdatedL(TPositionInfoBase& aPosInfo,
00097             const TDesC& aModulename);   
00098 
00099         void ShowErrorL(const TDesC& aErrorString);
00100 
00101         void ShowMessageL(const TDesC& aMessage);
00102         
00103         // -----------------------------------------------------------------------------
00104         // From CCoeControl
00105         // -----------------------------------------------------------------------------
00106         //
00107         virtual TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType);
00108 
00109     private:
00110         // Own helper functions
00111         void AddItemInListL(const TDesC& aLabel, const TDesC& aValue);
00112 
00113         // Functions from base classes
00114 
00115         // From CoeControl      
00116         void SizeChanged();
00117         TInt CountComponentControls() const;
00118         CCoeControl* ComponentControl(TInt aIndex) const;
00119         void Draw(const TRect& aRect) const;
00120                 void HandleResourceChange(TInt aType);
00121                 
00122     private: //data
00123 
00124         // list box control
00125         CAknDoubleStyleListBox* iListBox;
00126 
00127         // listbox item array, not owned        
00128         CDesCArray* iItemArray;
00129 
00130         // Buffer for storing values
00131 
00132         TBuf<KValueMaxLength> iValueBuffer;
00133 
00134         // Buffer dynamicly filling in a list item
00135         TBuf<KPositionMaxModuleName + KValueMaxLength> iListItemBuffer;
00136         
00137         // Module name
00138         TBuf<KPositionMaxModuleName> iModuleName;
00139         
00140         // Position requestor
00141         CLbsPositionRequestor* iPositionRequestor;
00142     };
00143 
00144 #endif //LBSREFERENCECONTAINER_H
00145 
00146 // End of File

© Nokia 2006

Back to top