emailuis/emailui/inc/ncspopuplistbox.h
branchRCL_3
changeset 80 726fba06891a
parent 73 c8382f7b54ef
equal deleted inserted replaced
73:c8382f7b54ef 80:726fba06891a
    28 // FORWARD DECLARATION
    28 // FORWARD DECLARATION
    29 class CNcsEmailAddressObject;
    29 class CNcsEmailAddressObject;
    30 class CAknsFrameBackgroundControlContext;
    30 class CAknsFrameBackgroundControlContext;
    31 class CFSEmailUiContactHandler;
    31 class CFSEmailUiContactHandler;
    32 class CFSMailBox;
    32 class CFSMailBox;
       
    33 class CNcsHeaderContainer;
    33 class CFSEmailUiLayoutHandler;
    34 class CFSEmailUiLayoutHandler;
    34 class CFreestyleEmailUiAppUi;
    35 class CFreestyleEmailUiAppUi; //<cmail>
    35 
    36 
    36 // CLASS DECLARATION
    37 // CLASS DECLARATION
    37 
       
    38 /**
       
    39  * Observer interface to notify observer of item selection events and changes
       
    40  * in popup's visibility.
       
    41  */
       
    42 class MNcsPopupListBoxObserver
       
    43     {
       
    44 public:
       
    45 
       
    46     /**
       
    47      * Visibility of component is changing.
       
    48      * @param aVisible ETrue, if popup is coming visible.
       
    49      * @return Observer should return ETrue, if visiblity change is allowed.
       
    50      */
       
    51     virtual TBool PopupVisibilityChangingL( TBool aVisible ) = 0;
       
    52 
       
    53     /**
       
    54      * Popup item is selected.
       
    55      */
       
    56     virtual void PopupItemSelectedL() = 0;
       
    57 
       
    58     };
       
    59 
       
    60 
    38 
    61 /**
    39 /**
    62 *  CNcsPopupListBox
    40 *  CNcsPopupListBox
    63 */
    41 */
    64 class CNcsPopupListBox : public CEikTextListBox, 
    42 class CNcsPopupListBox : public CEikTextListBox, 
    65                          public MEikListBoxObserver,
    43                          public MEikListBoxObserver,
    66                          public MFSEmailUiContactHandlerObserver
    44                          public MFSEmailUiContactHandlerObserver
    67     {
    45     {
    68 public:
    46 public: // Constructors and destructor
    69 
    47 
    70     /*
    48 		/*
    71      * @param aMailBox reference to current mailbox item
    49 		* @param aMailBox reference to current mailbox item
    72      */
    50 		*/
    73     static CNcsPopupListBox* NewL( const CCoeControl* aParent,
    51     static CNcsPopupListBox* NewL( const CCoeControl* aParent, CFSMailBox& aMailBox, 
    74         CFSMailBox& aMailBox, MNcsPopupListBoxObserver& aObserver,
    52                                    CNcsHeaderContainer& aHeaderContainer,
    75         TBool aRemoteLookupSupported );
    53                                    TBool aRemoteLookupSupported );
    76 
    54 
    77     /*
    55     /*
    78      * @param aMailBox reference to current mailbox item
    56     * @param aMailBox reference to current mailbox item
    79      */
    57     */
    80     void ConstructL( const CCoeControl* aParent );
    58     void ConstructL( const CCoeControl* aParent );
    81 
    59 
    82     /*
    60     /*
    83      * Initialises popup and begins the search.
    61     * 
    84      * @param aText Search text.
    62     *
    85      */
    63     * @param aText
       
    64     */
    86     void InitAndSearchL( const TDesC& aText, TInt aMode = -1 );
    65     void InitAndSearchL( const TDesC& aText, TInt aMode = -1 );
    87 
    66 		
    88     /** 
       
    89      * Hides the popup window.
       
    90      */
       
    91     void ClosePopupL();
       
    92 
       
    93     // Destructor
    67     // Destructor
    94     virtual ~CNcsPopupListBox();
    68     virtual ~CNcsPopupListBox();
    95 
    69 
    96 public: // from CEikTextListBox
    70 public: // from CEikTextListBox
    97 
    71 
   173 
   147 
   174     void SetPopupRect();
   148     void SetPopupRect();
   175  
   149  
   176     void SetScrollBarVisibilityL();
   150     void SetScrollBarVisibilityL();
   177 
   151 
   178     void SetRemoteLookupItemToTheListL( TInt aIndex );
   152     void SetRemoteLookupItemFirstToTheListL();
   179 		
   153 		
   180     enum TRemoteLookupItemMoveDirection
   154     enum TRemoteLookupItemMoveDirection
   181         {
   155         {
   182         ERemoteLookupItemUp,
   156         ERemoteLookupItemUp,
   183         ERemoteLookupItemDown
   157         ERemoteLookupItemDown
   187  
   161  
   188     void CreateTextArrayAndSetToTheListboxL( const TBool& aResetIfExists );
   162     void CreateTextArrayAndSetToTheListboxL( const TBool& aResetIfExists );
   189 
   163 
   190 private:
   164 private:
   191 
   165 
   192     CNcsPopupListBox( CFSMailBox& aMailbox,
   166     CNcsPopupListBox( CNcsHeaderContainer& aHeaderContainer,
   193         MNcsPopupListBoxObserver& aObserver,
   167         TBool aRemoteLookupSupported, CFSMailBox& aMailbox );
   194         TBool aRemoteLookupSupported );
       
   195 
   168 
   196     virtual void CreateItemDrawerL();
   169     virtual void CreateItemDrawerL();
   197 
   170 
   198     void UpdateListL();
   171     void UpdateListL();
   199     void UpdateVisibilityL( TBool aVisible );
   172 
   200     void UpdateTextColors();
   173     void UpdateTextColors();
   201 
   174 
   202     // From CCoeControl.
   175     // From CCoeControl.
   203     void Draw( const TRect& aRect ) const;
   176     void Draw( const TRect& aRect ) const;
   204 
   177 
   205 private: // data
   178 private: // data
   206 
   179 
   207     // Background control context. Own.
   180     CNcsHeaderContainer&				iHeaderContainer;
       
   181 
   208     CAknsFrameBackgroundControlContext* iBackgroundContext;
   182     CAknsFrameBackgroundControlContext* iBackgroundContext;
   209     // Items matching the current searh string. Own.
   183 
   210     RPointerArray<CFSEmailUiClsItem>    iMatchingItems;
   184     RPointerArray<CFSEmailUiClsItem>	iMatchingItems;
   211 
   185 
   212     // Contact handler.
   186     CFSEmailUiContactHandler*			iContactHandler; // Owned
   213     CFSEmailUiContactHandler*           iContactHandler;
   187     CFSMailBox& 						iMailBox;
   214     CFSMailBox&                         iMailBox;
   188 
   215     // Observer for popup visibility changes.
   189     TRect								iPopupMaxRect;
   216     MNcsPopupListBoxObserver&           iObserver;
   190     
   217     TRect                               iPopupMaxRect;
   191     CDesCArray*							iItemTextsArray;
   218 
   192     HBufC*								iCurrentSearchText;
   219     CDesCArray*                         iItemTextsArray;
   193     TInt								iRemoteLookupItemPos;
   220     // Current search text. Own.
   194     
   221     HBufC*                              iCurrentSearchText;
   195     TBool 								iRemoteLookupSupported;
   222     TInt                                iRemoteLookupItemPos;
   196     TBool 								iCachingInProgress;
   223 
   197     
   224     TBool                               iRemoteLookupSupported;
   198     CFreestyleEmailUiAppUi*             iAppUi;  //<cmail>  not owned
   225     TBool                               iCachingInProgress;
       
   226 
       
   227     CFreestyleEmailUiAppUi*             iAppUi; // not owned
       
   228 
       
   229     };
   199     };
   230 
   200 
   231 
   201 
   232 /**
   202 /**
   233 *  CNcsListItemDrawer
   203 *  CNcsListItemDrawer