emailuis/emailui/inc/ncspopuplistbox.h
changeset 0 8466d47a6819
child 10 f5907b1a1053
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007 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: This file defines class CNcsPopupListBox.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CNCSPOPUPLISTBOX_H
       
    21 #define CNCSPOPUPLISTBOX_H
       
    22 
       
    23 
       
    24 // INCLUDES
       
    25 #include <aknlists.h>
       
    26 #include "FreestyleEmailUiContactHandlerObserver.h"
       
    27 
       
    28 // FORWARD DECLARATION
       
    29 class CNcsEmailAddressObject;
       
    30 class CAknsBasicBackgroundControlContext;
       
    31 class CFSEmailUiContactHandler;
       
    32 class CFSMailBox;
       
    33 class CNcsHeaderContainer;
       
    34 class CFSEmailUiLayoutHandler;
       
    35 class CFreestyleEmailUiAppUi; //<cmail>
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40 *  CNcsPopupListBox
       
    41 */
       
    42 class CNcsPopupListBox : public CEikTextListBox, 
       
    43                          public MEikListBoxObserver,
       
    44 						 public MFSEmailUiContactHandlerObserver
       
    45     {
       
    46 public: // Constructors and destructor
       
    47 
       
    48 		/*
       
    49 		* @param aMailBox reference to current mailbox item
       
    50 		*/
       
    51     static CNcsPopupListBox* NewL( const CCoeControl* aParent, CFSMailBox& aMailBox, 
       
    52                                    CNcsHeaderContainer& aHeaderContainer,
       
    53                                    TBool aRemoteLookupSupported );
       
    54 
       
    55       
       
    56     /*
       
    57     * @param aMailBox reference to current mailbox item
       
    58     */
       
    59     void ConstructL( const CCoeControl* aParent );
       
    60         
       
    61 
       
    62     /*
       
    63     * 
       
    64     *
       
    65     * @param aText
       
    66     */
       
    67     void InitAndSearchL( const TDesC& aText );
       
    68 		
       
    69     // Destructor
       
    70     virtual ~CNcsPopupListBox();
       
    71 
       
    72 public: // from CEikTextListBox
       
    73 
       
    74     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
    75         
       
    76     virtual TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
       
    77         
       
    78     void SizeChanged();
       
    79 
       
    80 public: // from MEikListBoxObserver
       
    81 
       
    82     void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
       
    83 
       
    84 public: // from MFSEmailUiContactHandlerObserver
       
    85 	
       
    86     void OperationCompleteL( TContactHandlerCmd aCmd, 
       
    87     						const RPointerArray<CFSEmailUiClsItem>& aMatchingItems );
       
    88     void OperationErrorL( TContactHandlerCmd aCmd, TInt aError );
       
    89  
       
    90 
       
    91 public: // new methods for the header container
       
    92  		
       
    93     /*
       
    94     * 
       
    95     * @param aText
       
    96     */
       
    97     void SetSearchTextL( const TDesC& aText );
       
    98  
       
    99     /*
       
   100     * 
       
   101     * @param 
       
   102     */
       
   103     CNcsEmailAddressObject* ReturnCurrentEmailAddressLC();
       
   104  
       
   105     /*
       
   106     *
       
   107     *
       
   108     */
       
   109     void SetPopupMaxRect( const TRect& aPopupMaxRect );
       
   110  		
       
   111     /*
       
   112     *
       
   113     *
       
   114     */
       
   115     TBool IsPopupEmpty() const;
       
   116 
       
   117 
       
   118     /*
       
   119     *
       
   120     *
       
   121     */
       
   122     TBool IsRemoteLookupItemSelected() const;
       
   123 	
       
   124     /*
       
   125     * Returs reference to current cls items array
       
   126     *
       
   127     * @return RPointerArray<CFSEmailUiClsItem>& reference to current cls items array
       
   128     */
       
   129     const RPointerArray<CFSEmailUiClsItem>& CurrentPopupClsItemsArray() const;
       
   130 
       
   131     /*
       
   132     * Return index of the "Search from remote" item in the list
       
   133     *
       
   134     * @return iRemoteLookupItemPos value; 
       
   135     */
       
   136     TInt RemoteLookupItemPos() const;
       
   137  
       
   138     /*
       
   139     * Conveniency method to get Layout handler reference.
       
   140     */
       
   141     CFSEmailUiLayoutHandler& LayoutHandler() const;
       
   142     
       
   143 private: // to populate new list
       
   144     
       
   145     void SetListItemsFromArrayL();
       
   146  		
       
   147     void SetPopupHeight();
       
   148  
       
   149     void SetScrollBarVisibilityL();
       
   150 
       
   151     void SetRemoteLookupItemFirstToTheListL();
       
   152 		
       
   153     enum TRemoteLookupItemMoveDirection
       
   154         {
       
   155         ERemoteLookupItemUp,
       
   156         ERemoteLookupItemDown
       
   157         };
       
   158 
       
   159     void MoveRemoteLookupItemL( TRemoteLookupItemMoveDirection aDirection );
       
   160  
       
   161     void CreateTextArrayAndSetToTheListboxL( const TBool& aResetIfExists );
       
   162 
       
   163 private:
       
   164 
       
   165     CNcsPopupListBox( CNcsHeaderContainer& aHeaderContainer, TBool aRemoteLookupSupported, 
       
   166     				  CFSMailBox& aMailbox );
       
   167 
       
   168     virtual void CreateItemDrawerL();
       
   169 
       
   170     void UpdateListL();
       
   171     
       
   172 private: // data
       
   173 
       
   174 	CNcsHeaderContainer&				iHeaderContainer;
       
   175 	
       
   176     CAknsBasicBackgroundControlContext* iBaseBackroundContext;
       
   177    
       
   178     RPointerArray<CFSEmailUiClsItem>	iMatchingItems;
       
   179        
       
   180     CFSEmailUiContactHandler*			iContactHandler; // Owned
       
   181     CFSMailBox& 						iMailBox;
       
   182 
       
   183     TRect								iPopupMaxRect;
       
   184     
       
   185     CDesCArray*							iItemTextsArray;
       
   186     HBufC*								iCurrentSearchText;
       
   187     TInt								iRemoteLookupItemPos;
       
   188     
       
   189     TBool 								iRemoteLookupSupported;
       
   190     TBool 								iCachingInProgress;
       
   191     
       
   192     CFreestyleEmailUiAppUi*             iAppUi;  //<cmail>  not owned
       
   193     };
       
   194 
       
   195 
       
   196 /**
       
   197 *  CNcsListItemDrawer
       
   198 */
       
   199 class CNcsListItemDrawer: public CListItemDrawer
       
   200     {
       
   201 public: // constructor
       
   202 	CNcsListItemDrawer( const CNcsPopupListBox& aListBox );
       
   203 
       
   204 protected: // from CListItemDrawer
       
   205 	void DrawActualItem( TInt aItemIndex, const TRect& aActualItemRect,
       
   206                          TBool aItemIsCurrent, TBool aViewIsEmphasized, 
       
   207                          TBool aViewIsDimmed, TBool aItemIsSelected ) const;
       
   208 
       
   209 private: // new methods
       
   210     void DrawPartOfItem( const TRect& aItemRect, const CFont& aFont,
       
   211                          TInt aStartPos, TInt aLength, const TDesC& aDes,
       
   212                          TBool aUnderlined, TInt aBaselineOffsetFromTop ) const; 
       
   213 
       
   214 private: // data
       
   215 	const CNcsPopupListBox& iListBox;
       
   216     };
       
   217 
       
   218 
       
   219 #endif // CNCSPOPUPLISTBOX_H
       
   220 
       
   221 
       
   222 // End of File