notepad/notepad1/inc/NpdPopupList.h
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Declaration of customized popup-list control.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef NPDPOPUPLIST_H
       
    20 #define NPDPOPUPLIST_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <aknPopup.h>
       
    25 #include "NpdModelObserver.h"
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CAknPopupList;
       
    29 class CNotepadModel;
       
    30 class CEikListBox;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 /**
       
    34 *  Customized popup list control for fetching a memo or template.
       
    35 *  CNotepadPopupList is a customized popup list control for fetching a 
       
    36 *  memo or template. It extends CAknPopupList to be able to manage 
       
    37 *  dynamically changes of list items.
       
    38 *  
       
    39 */
       
    40 class CNotepadPopupList : public CAknPopupList,
       
    41     public MNotepadModelObserver,
       
    42     public MCoeViewObserver
       
    43     {
       
    44     public: // Constructor and destructor
       
    45 
       
    46         /**
       
    47         * Constructor.
       
    48         *
       
    49         * @param aListBox Pre-existing listbox-derived class.
       
    50         * @param aCbaResource Softkey pane to display while pop-up is active.
       
    51         * @param aType Type of layout.
       
    52         * @param aModel CNotepadModel object.
       
    53         * @return a new CNotepadPopupList object.
       
    54         */
       
    55         static CNotepadPopupList* NewL(
       
    56             CEikListBox* aListBox, 
       
    57             TInt aCbaResource, 
       
    58             AknPopupLayouts::TAknPopupLayouts aType,
       
    59             CNotepadModel& aModel );
       
    60 
       
    61         /**
       
    62         * Destructor.
       
    63         */
       
    64         ~CNotepadPopupList();
       
    65 
       
    66     public: // New function
       
    67 
       
    68         /**
       
    69         * Execute a popup list. 
       
    70         * If the database is changed during the execusion, this class receives
       
    71         * a notification via the MNotepadModelObserver interface and
       
    72         * the popup list is refreshed automatically.
       
    73         *
       
    74         * @return ETrue if the popup list was accepted. EFalse if the 
       
    75         * popup list was cancelled.
       
    76         */
       
    77         TBool EnhancedExecuteLD( TBool& aFinished );
       
    78 
       
    79     private: // Constructor 
       
    80 
       
    81         /**
       
    82         * C++ constructor.
       
    83         */
       
    84         CNotepadPopupList(
       
    85             CNotepadModel& aModel );
       
    86 
       
    87     private:  // Functions from base classes
       
    88 
       
    89         /**
       
    90         * From CAknPopupList.
       
    91         *
       
    92         * @param aAccept ETrue if the user accepted. 
       
    93         * EFalse if the user cancelled.
       
    94         */
       
    95         void AttemptExitL(TBool aAccept);
       
    96 
       
    97         /**
       
    98         * From MNotepadModelObserver.
       
    99         * Handles a event of CNotepadModel.
       
   100         *
       
   101         * @param aEvent Type of an event.
       
   102         * @param aParam Optional parameter of an event.
       
   103         */ 
       
   104         void HandleNotepadModelEventL(
       
   105             TEvent aEvent, 
       
   106             TInt aParam );
       
   107 
       
   108         /**
       
   109         * From MCoeViewObserver
       
   110         * 
       
   111         * @param aEvent view event type.
       
   112         */
       
   113         void HandleViewEventL(const TVwsViewEvent& aEvent);
       
   114 
       
   115     private: // Data
       
   116 
       
   117         enum TNotepadPopupListFlag
       
   118             {
       
   119             ENotepadObserveView = 0x01,
       
   120             ENotepadIsViewDeactivated = 0x02
       
   121             //ENotepadEverViewDeactivated = 0x04
       
   122             };
       
   123         CNotepadModel& iModel;  // not own
       
   124         TInt iSavedCount;
       
   125         TInt iSavedIndex;
       
   126         TBool* iFinished;
       
   127         TUint iFlags;
       
   128     };
       
   129 
       
   130 #endif // NPDPOPUPLIST_H
       
   131 
       
   132 // End of File