S60 3rd Edition SDK for Symbian OS
Example Applications Guide

LandmarksContainer.h

00001 /*
00002 * ==============================================================================
00003 *  Name        : LandmarksContainer.h
00004 *  Part of     : Landmark Reference Application
00005 *  Interface   : -
00006 *  Description : See class description below
00007 *  Version     : 1.0
00008 *
00009 *  Copyright (c) 2004-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 __LANDMARKS_CONTAINER_H__
00017 #define __LANDMARKS_CONTAINER_H__
00018 
00019 // INCLUDES
00020 #include "LandmarksContainerBase.h"
00021 #include <coecobs.h>
00022 
00023 // FORWARD DECLARATIONS
00024 class CLandmarksApplicationEngine;
00025 class CAknNavigationDecorator;
00026 class CLandmarksModel;
00027 
00028 // CLASS DECLARATION
00029 
00030 /**
00031 *  This is the landmarks container that contains a listbox and a search field
00032 *  for listing landmarks.
00033 */
00034 class CLandmarksContainer : 
00035     public CLandmarksContainerBase, 
00036     public MCoeControlObserver
00037     {
00038     public: // Constructors and destructor
00039 
00040         /**
00041         * C++ constructor.
00042         *
00043         * @param aView parent view
00044         * @param aEngine the landmark engine
00045         * @param aNaviDecorator the tab group to hide when editing landmarks
00046         */
00047         CLandmarksContainer(
00048             CAknView& aView,
00049             CLandmarksApplicationEngine& aEngine, 
00050             CAknNavigationDecorator* aNaviDecorator);
00051 
00052         /**
00053         * Symbian 2nd phase constructor. Should be called after constructor to 
00054         * fully construct the object.
00055         *
00056         * @param aRect the rectangle this Container will be drawn to
00057         */
00058         void ConstructL(const TRect& aRect);
00059 
00060         /**
00061         * Destructor.
00062         */
00063         ~CLandmarksContainer();
00064 
00065     public: // New functions
00066 
00067         /**
00068         * Enables/disables the navi pane.
00069         *
00070         * @param aVisible ETrue enables navipane, EFalse disables navipane
00071         */
00072         void MakeNaviPaneVisibleL(TBool aVisible);
00073 
00074         /**
00075         * Gets currently highlighted landmarks
00076         * @return The landmark item id.
00077         */
00078         TPosLmItemId CurrentLandmark();
00079 
00080         /**
00081         * Displays a confirmation dialog and deletes the current landmark if 
00082         * positive response.
00083         */ 
00084         void DeleteLandmarkL();
00085 
00086     public: // from CoeControl
00087 
00088         /**
00089         * OfferKeyEventL handles key events.
00090         *
00091         * @param aKeyEvent the key event
00092         * @param aType the type of key event
00093         * @return EKeyWasConsumed if keyevent was handled, EKeyWasNotConsumed 
00094         * otherwise 
00095         */
00096         TKeyResponse OfferKeyEventL(
00097             const TKeyEvent& aKeyEvent, 
00098             TEventCode aType);
00099 
00100     public: // From MLandmarksOperationObserver
00101 
00102         /**
00103         * NotifyOperationProgressL notifies the progress and status of an
00104         * asynchronous operation.
00105         *  
00106         * @param aOperation the type of operation that is reported.
00107         * @param aProgress the progress of the operation.
00108         * @param aErrorCode the status of the operation.
00109         */
00110         void NotifyOperationProgressL(
00111             TOperation aOperation, 
00112             TInt aProgress, 
00113             TInt aErrorCode);
00114 
00115     public: // From MLandmarksDbObserver
00116 
00117         /**
00118         * NotifyDbEventL notifies that an event has occurred in the default 
00119         * landmark database.
00120         *  
00121         * @param aEvent contains info about the event.
00122         * @param aErrorCode possible error codes if reporting the event was 
00123         * not successful.
00124         */
00125         void NotifyDbEventL(TPosLmEvent& aEvent, TInt aErrorCode);
00126 
00127     public: // From MCoeControlObserver
00128 
00129         /**
00130         * HandleControlEventL handles an event from an observed control.
00131         *
00132         * @param aControl the control that reported the event
00133         * @param aEventType contains info about the event
00134         */
00135         void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType);
00136 
00137     private:
00138 
00139         /**
00140         * StartUpdateListBoxL initiates an asynchronous refresh of the listbox.
00141         */
00142         void StartUpdateListBoxL();
00143 
00144         /**
00145         * HandleSearchReadyL updates the state of this class when a search 
00146         * operation has completed.
00147         *
00148         * @param aErrorCode the error code of the search operation
00149         */
00150         void HandleSearchReadyL(TInt aErrorCode);
00151 
00152         /**
00153         * HandleReadReadyL updates the state of this class when a read
00154         * operation has completed.
00155         *
00156         * @param aErrorCode the error code of the search operation
00157         * @param aFinished ETrue if there are no more landmarks to read, 
00158         * EFalse otherwise
00159         */
00160         void HandleReadReadyL(TInt aErrorCode, TBool aFinished);
00161 
00162         /**
00163         * Indicates if it is necessary to refresh the listbox 
00164         * when a landmark has been updated.
00165         *
00166         * @param aModifiedLandmark the id of the landmark that has been updated
00167         * @return ETrue if refresh is necessary, EFalse otherwise
00168         */
00169         TBool IsRefreshNeededL(TPosLmItemId& aModifiedLandmark);
00170 
00171         /**
00172         * Stores the name of the current landmark.
00173         */
00174         void StoreCurrentLandmarkNameL();
00175 
00176     private: // Data
00177 
00178         //! Decorates the navi pane (with navigation arrows etc)
00179         CAknNavigationDecorator* iNaviDecorator;
00180 
00181         //! The data model for the listbox
00182         CLandmarksModel* iModel;
00183 
00184         //! Indicates if the first page of landmarks has been read.
00185         TBool iReadingFirstPage;
00186 
00187         //! Keeps the name of the current item
00188         HBufC* iCurrentName;
00189 
00190         //! Indicates if the landmark list is being refreshed
00191         TBool iIsActive;
00192     };
00193 
00194 #endif // __LANDMARKS_CONTAINER_H__
00195 

© Nokia 2006

Back to top