meetingrequest/mrgui/mrfieldbuilderpluginextension/inc/cesmrncspopuplistbox.h
changeset 0 8466d47a6819
child 16 4ce476e64c59
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007-2009 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 classes CESMRNcsPopupListBox, CESMRNcsListItemDrawer
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CESMRNCSPOPUPLISTBOX_H
       
    19 #define CESMRNCSPOPUPLISTBOX_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <aknlists.h>
       
    23 #include "mesmrcontacthandlerobserver.h"
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CESMRNcsEmailAddressObject;
       
    27 class CAknsBasicBackgroundControlContext;
       
    28 class CESMRContactHandler;
       
    29 class CFSMailBox;
       
    30 class CESMRLayoutManager;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35  *  CESMRNcsPopupListBox is the litbox that is displayed when user types
       
    36  *  text to attendee and field and contacts are searched. this class handles
       
    37  *  displaying and updating the list of contacts email addresses
       
    38  */
       
    39 NONSHARABLE_CLASS( CESMRNcsPopupListBox ) : public CEikTextListBox,
       
    40                                             public MESMRContactHandlerObserver
       
    41     {
       
    42 public: // Constructors and destructor
       
    43     /**
       
    44      * Creates new CESMRNcsPopupListBox object. Ownership
       
    45      * is transferred to caller.
       
    46      * @param aParent set parent control of this class
       
    47      * @param aContactHandler pointer to contact handles class
       
    48      * @return Pointer to created object,
       
    49      */
       
    50     static CESMRNcsPopupListBox* NewL( const CCoeControl* aParent,
       
    51                                        CESMRContactHandler& aContactHandler );
       
    52 
       
    53     /**
       
    54      * Second phase constructor
       
    55      * @param aParent set parent control of this class
       
    56      */
       
    57     void ConstructL( const CCoeControl* aParent );
       
    58 
       
    59     /**
       
    60      * C++ Destructor.
       
    61      */
       
    62     virtual ~CESMRNcsPopupListBox();
       
    63 
       
    64 public: // from CCoeControl
       
    65     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
    66     virtual TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
       
    67     void SizeChanged();
       
    68 
       
    69 public: // from ContactHandlerObserver
       
    70     void OperationCompleteL(
       
    71             TContactHandlerCmd aCmd,
       
    72             const RPointerArray<CESMRClsItem>* aMatchingItems );
       
    73     void OperationErrorL( TContactHandlerCmd aCmd, TInt aError );
       
    74 
       
    75 public: // new methods for the header container
       
    76     /**
       
    77      * Start searching contacts for teh email addresses using a string
       
    78      * @param aText start contacts database search with this string
       
    79      */
       
    80     void InitAndSearchL( const TDesC& aText );
       
    81 
       
    82     /**
       
    83      * Start searching contacts for teh email addresses using a string
       
    84      * @param aText start contacts database search with this string
       
    85      */
       
    86     void SetSearchTextL( const TDesC& aText );
       
    87 
       
    88     /**
       
    89      * Get the currently selected email/contact address object
       
    90      * @return current selected email/contact address object
       
    91      */
       
    92     CESMRNcsEmailAddressObject* ReturnCurrentEmailAddressLC();
       
    93 
       
    94     /**
       
    95      * Set maximum area on screen for displaying the popuplistbox
       
    96      * @param aPopupMaxRect area rectangle
       
    97      */
       
    98     void SetPopupMaxRectL( const TRect& aPopupMaxRect );
       
    99 
       
   100     /**
       
   101      * check if popup has any items
       
   102      * @return check if it's empty
       
   103      */
       
   104     TBool IsPopupEmpty() const;
       
   105 
       
   106     /**
       
   107      * Test if remote look up item is selected
       
   108      */
       
   109     TBool IsRemoteLookupItemSelected() const;
       
   110 
       
   111     /**
       
   112      * Returs reference to current cls items array
       
   113      * @return RPointerArray<CFSEmailUiClsItem>& reference to current cls items array
       
   114      */
       
   115     const RPointerArray<CESMRClsItem>& CurrentPopupClsItemsArray() const;
       
   116 
       
   117     /**
       
   118      * @return iRMLUItemPosition value;
       
   119      */
       
   120     TInt RMLUItemPosition() const;
       
   121 
       
   122     /**
       
   123      * Initialise skin/theme/laf support and set layoutmanager to be used by the list
       
   124      * @param aLayout LayoutManager to be used by the list
       
   125      */
       
   126     void Initialise(CESMRLayoutManager* aLayout);
       
   127     
       
   128 private: // Implementation
       
   129     enum TRemoteLookupItemMoveDirection
       
   130         {
       
   131         ERemoteLookupItemUp,
       
   132         ERemoteLookupItemDown
       
   133         };
       
   134     void SetListItemsFromArrayL();
       
   135     void SetPopupHeightL();
       
   136     void SetRemoteLookupItemFirstToTheListL();
       
   137     void MoveRemoteLookupItemL( TRemoteLookupItemMoveDirection aDirection );
       
   138     void CreateTextArrayAndSetToTheListboxL();
       
   139 
       
   140 private:
       
   141     CESMRNcsPopupListBox( CESMRContactHandler& aContactHandler );
       
   142     virtual void CreateItemDrawerL();
       
   143     
       
   144 private: // data
       
   145     CAknsBasicBackgroundControlContext* iBaseBackroundContext;//own
       
   146     RPointerArray<CESMRClsItem>         iMatchingArray; //own
       
   147     CDesCArray*                         iItemTextsArray;//own
       
   148     HBufC*                              iCurrentSearchText;//own
       
   149     CFSMailBox*                         iMailBox;//not own
       
   150     CESMRContactHandler&                iContactHandler;//not own
       
   151     TRect                               iPopupMaxRect;
       
   152     TInt                                iRMLUItemPosition;
       
   153     TBool                               iRemoteLookupSupported;
       
   154     };
       
   155 
       
   156 // CLASS DECLARATION
       
   157 
       
   158 /**
       
   159  *  CESMRNcsListItemDrawer handles drawing a single contact/address
       
   160  *  item on the CESMRNcsPopupListBox
       
   161  */
       
   162 NONSHARABLE_CLASS( CESMRNcsListItemDrawer ) : public CListItemDrawer
       
   163     {
       
   164 public:
       
   165     /**
       
   166      * Constructor
       
   167      * @param aListBox reference to the list box where the object is located
       
   168      */
       
   169     CESMRNcsListItemDrawer( CESMRNcsPopupListBox& aListBox );
       
   170 
       
   171     void SetLayoutManager( CESMRLayoutManager* aLayout );
       
   172 
       
   173 private: // from CListItemDrawer
       
   174     void DrawActualItem( TInt aItemIndex, const TRect& aActualItemRect,
       
   175                          TBool aItemIsCurrent, TBool aViewIsEmphasized,
       
   176                          TBool aViewIsDimmed, TBool aItemIsSelected ) const;
       
   177 
       
   178 private:
       
   179     void DoDrawActualItemL( TInt aItemIndex, const TRect& aActualItemRect,
       
   180                             TBool aItemIsCurrent, TBool aViewIsEmphasized,
       
   181                             TBool aViewIsDimmed, TBool aItemIsSelected ) const;
       
   182     void DrawPartOfItem( const TRect& aItemRect, const CFont& aFont,
       
   183                          TInt aStartPos, TInt aLength, const TDesC& aDes,
       
   184                          TBool aUnderlined, TInt aBaseline ) const;
       
   185     
       
   186 private: //data
       
   187     CESMRNcsPopupListBox&               iListBox;
       
   188     CESMRLayoutManager*                 iLayout;//not own
       
   189     };
       
   190 
       
   191 
       
   192 #endif // CESMRNCSPOPUPLISTBOX_H
       
   193 
       
   194 
       
   195 // End of File