locationlandmarksrefappfors60/Inc/LandmarksLmCategoriesModel.h
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:31:27 +0100
branchRCL_3
changeset 18 870918037e16
parent 0 522cd55cc3d7
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035

/*
* Copyright (c) 2004-2005 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  
*     See class description below
*
*/


#ifndef __LANDMARKS_LM_CATEGORIES_MODEL_H__
#define __LANDMARKS_LM_CATEGORIES_MODEL_H__


#include <e32std.h>
#include <EPos_Landmarks.h>


class CLandmarksApplicationEngine;
class CPosLandmarkCategory;
class CGulIcon;



/**
*  CLandmarksLmCategoriesModel holds the data displayed in the category 
*  listbox in the landmarks category edit dialog.
*/
class CLandmarksLmCategoriesModel : public CBase
	{
    public: // Constructors and destructor

        /**
        * Two-phased constructor.
        *
        * @param aEngine the landmarks application engine.
        * @param aMarkedCategories an array of selected landmarks.
        */
        static CLandmarksLmCategoriesModel* NewL(
            CLandmarksApplicationEngine& aEngine,
            RArray<TPosLmItemId>& aMarkedCategories);

        /**
        * Destructor.
        */
	    ~CLandmarksLmCategoriesModel();

    public: // New functions

        /**
        * Stores ids of selected categories.
        *
        * @param aSelectedIndexes array of indexes of selected catgeories
        */
	    void SelectCategoriesL(CArrayFixFlat<TInt>& aSelectedIndexes);

        /**
        * Returns a descriptor array of formatted list items.
        *
        * @return an descriptor array suitable for a two-column listbox
        */
        CDesCArray* FormattedCategoryNamesL();

        /**
        * Returns array of indices of selected categories.
        *
        * @return array of indexes of selected catgeories
        */
		CArrayFixFlat<TInt>* SelectedCategoriesL();

    private:

        /**
        * C++ constructor.
        *
        * @param aMarkedCategories an array of selected landmarks.
        */
	    CLandmarksLmCategoriesModel(
            RArray<TPosLmItemId>& aMarkedCategories);

        /**
        * By default Symbian 2nd phase constructor is private.
        *
        * @param aEngine the landmarks application engine.
        */
	    void ConstructL(CLandmarksApplicationEngine& aEngine);

    private: // Data

        //! contains all existing categories
        CArrayPtr<CPosLandmarkCategory>* iCategories;

        /** contains Ids for those categories that are selected for the 
            edited landmark. */
        RArray<TPosLmItemId>& iMarkedCategoryIds;

        /** An array of formatted category names suitable for a two-column 
            listbox. */
	    CDesCArrayFlat* iListItems;
	    
	};

#endif // __LANDMARKS_LM_CATEGORIES_MODEL_H__