textinput/peninputcommonctrls/inc/peninputdropdownlist/peninputlist.h
changeset 40 2cb9bae34d17
parent 31 f1bdd6b078d1
child 49 37f5d84451bd
equal deleted inserted replaced
31:f1bdd6b078d1 40:2cb9bae34d17
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  Abstract base class for drop-down list objects
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CLIST_H
       
    20 #define C_CLIST_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <w32std.h>
       
    25 #include <coedef.h>
       
    26 #include <peninputlayoutbasecontrol.h>
       
    27 
       
    28 #include "peninputbitmapdb.h"
       
    29 #include "peninputcandidate.h"
       
    30 #include "peninputpages.h"
       
    31 #include "peninputdropdownlistcontext.h"
       
    32 #include "peninputlistmanager.h"
       
    33 
       
    34 // class forward decalaration
       
    35 class CFont;
       
    36 
       
    37 // Empty rect 
       
    38 #define KEmptyRect TRect(0, 0, 0, 0);
       
    39 
       
    40 // Dummy rect, which is used to identify mouse down, but not click in valid area
       
    41 #define KDummyRect TRect(0, 0, 1, 1);
       
    42 
       
    43 
       
    44 /**
       
    45  *  abstract base list
       
    46  *
       
    47  *  abstract base list
       
    48  *
       
    49  *  @lib FepCtrlDropdownList.lib
       
    50  *  @since S60 v3.2
       
    51  */   
       
    52 NONSHARABLE_CLASS(CList) : public CBase
       
    53     {
       
    54     
       
    55 
       
    56     
       
    57 public: //Methods
       
    58 
       
    59     /**
       
    60      * Destructor
       
    61      *
       
    62      * @since S60 v3.2
       
    63      * @return None.     
       
    64      */  
       
    65     virtual ~CList();
       
    66 
       
    67     /**
       
    68      * Draw the list
       
    69      *
       
    70      * @since S60 v3.2
       
    71      * @return None.     
       
    72      */  
       
    73     virtual void Draw();
       
    74 
       
    75     /**
       
    76      * Get rect of the list
       
    77      *
       
    78      * @since S60 v3.2
       
    79      * @return the rect of the list
       
    80      */               
       
    81     virtual const TRect& Rect();
       
    82 
       
    83     /**
       
    84      * Update the list, including re-calculate the rect of candidates.
       
    85      *
       
    86      * @since S60 v3.2
       
    87      * @param aRecalculate Re-calculate or not calculate the rect of candidates, the default is re-calculate
       
    88      * @return None.     
       
    89      */
       
    90     virtual void UpdateListL(TBool aDrawFlag = ETrue, TBool aRecalculate = ETrue);
       
    91 
       
    92     /**
       
    93      * Deal with size change, it will be called when the size change
       
    94      *
       
    95      * @since S60 v3.2
       
    96      * @return None.     
       
    97      */    
       
    98     virtual void SizeChanged();
       
    99     
       
   100     /**
       
   101      * Deal with move event, it will be called when the drop down list is moved.
       
   102      *
       
   103      * @since S60 v3.2
       
   104      * @param aOffsetPoint The offset point
       
   105      * @return None.     
       
   106      */    
       
   107     virtual void Move(const TPoint& aOffsetPoint);
       
   108 
       
   109     /**
       
   110      * Set some cell to be high light.
       
   111      *
       
   112      * @since S60 v3.2
       
   113      * @param aCellIndex The which cell would be set
       
   114      * @param aHighlight The flag of highlight, set to highlight if ETrue, else cancel highlight
       
   115      * @return None.     
       
   116      */     
       
   117     virtual  void SetHighlightCell(const TInt aCellIndex, TBool aHighlight, 
       
   118                                    TBool aForceDraw = ETrue);
       
   119 
       
   120     virtual void SetNextPageHighlightCellAfterOnePageL(const TInt aCellIndex);
       
   121 
       
   122     /**
       
   123      * Deal with the pointer down event.
       
   124      *
       
   125      * @since S60 v3.2
       
   126      * @param aPoint The point of the mouse
       
   127      * @return None.
       
   128      */ 
       
   129     virtual void HandlePointerDownL(const TPoint& aPoint);
       
   130 
       
   131     /**
       
   132      * Deal with the pointer up event.
       
   133      *
       
   134      * @since S60 v3.2
       
   135      * @param aPoint The point of the mouse
       
   136      * @return None.
       
   137      */  
       
   138     virtual void HandlePointerUpL(const TPoint& aPoint);
       
   139 
       
   140     /**
       
   141      * Deal with the pointer drag event.
       
   142      *
       
   143      * @since S60 v3.2
       
   144      * @param aPoint The point of the mouse
       
   145      * @return None.
       
   146      */ 
       
   147     virtual void HandlePointerDragL(const TPoint& aPoint);
       
   148     
       
   149     /**
       
   150      * Deal with the pointer leave event.
       
   151      *
       
   152      * @since S60 v3.2
       
   153      * @param aPoint The point of the mouse
       
   154      * @return None.
       
   155      */     
       
   156     virtual void HandlePointerLeave(const TPoint& aPoint);
       
   157     
       
   158     /**
       
   159      * Reset some status of the list.
       
   160      *
       
   161      * @since S60 v3.2
       
   162      * @return None.
       
   163      */       
       
   164     virtual void ResetStatus();
       
   165     
       
   166     virtual TInt StartCandIdxOfLine(TInt aCandIndex);
       
   167     
       
   168     
       
   169     void SetDropdownListImgID(TDropdownListDrawInfo aDropdownListDrawInfo);
       
   170     						  
       
   171 protected: // Methods
       
   172 
       
   173     /**
       
   174      * Constructor.
       
   175      *     
       
   176      * @since S60 v3.2
       
   177      * @param aManager The list manager
       
   178      * @param aOwner The context of the drop down list     
       
   179      * @return None.     
       
   180      */  
       
   181     CList(CListManager* aManager,MFepCtrlDropdownListContext *aOwner);
       
   182 
       
   183     /**
       
   184      * 2nd construct function.
       
   185      *
       
   186      * @since S60 v3.2
       
   187      * @return None.          
       
   188      */  
       
   189     void ConstructL();
       
   190 
       
   191     /**
       
   192      * Find candidate according the assigned point.
       
   193      *
       
   194      * @since S60 v3.2
       
   195      * @aPosition The position assigned
       
   196      * @aIndex The index of the candidate which has been found
       
   197      * @return The candidate which has been found, Null if not found.     
       
   198      */  
       
   199     CCandidate* FindCandidate(const TPoint& aPosition, TInt& aIndex);
       
   200 
       
   201     /**
       
   202      * Calculate the position of current visible candidates.
       
   203      *
       
   204      * @since S60 v3.2
       
   205      * @return the last candidate visible.
       
   206      */  
       
   207     virtual TInt CalculatePositionsL();
       
   208 
       
   209     /**
       
   210      * Calculate all kinds of rectangles of list.
       
   211      *
       
   212      * @since S60 v3.2
       
   213      * @return None.          
       
   214      */  
       
   215     virtual void CalculateAreas();
       
   216    
       
   217     /**
       
   218      * Draw select cell, which can be candidates or buttons.
       
   219      *
       
   220      * @since S60 v3.2
       
   221      * @param aRect The rect which will be drawn
       
   222      * @param aIndicate Indicate the cell is pressed or not
       
   223      * @return None.
       
   224      */  
       
   225     virtual void DrawSelection(const TRect& aRect, TBool aIndicate); 
       
   226 
       
   227     /**
       
   228      * Draw candidate when pressed.
       
   229      *
       
   230      * @since S60 v3.2
       
   231      * @param aRect The rect which will be drawn
       
   232      * @param aIndicate Indicate the cell is pressed or not
       
   233      * @return None.
       
   234      */  
       
   235     virtual void DrawCandidatePress(const TRect& aRect, TBool aIndicate);
       
   236 
       
   237     /**
       
   238      * Draw navigation button when pressed.
       
   239      *
       
   240      * @since S60 v3.2
       
   241      * @param aRect The rect which will be drawn
       
   242      * @param aIndicate Indicate the button is pressed or not
       
   243      * @return None.
       
   244      */ 
       
   245     virtual TBool DrawNavigationPress(const TRect& aRect, TBool aIndicate);
       
   246 
       
   247     /**
       
   248      * Draw all visible cells.
       
   249      *
       
   250      * @since S60 v3.2
       
   251      * @return None.
       
   252      */  
       
   253     virtual void DrawCandidates();
       
   254 
       
   255     /**
       
   256      * Compare rects equal or not.
       
   257      *
       
   258      * @since S60 v3.2
       
   259      * @param aSrcRect The source rect
       
   260      * @param aDesRect The destination rect
       
   261      * @return ETrue If the two rects are equal.     
       
   262      */  
       
   263     virtual TBool CompareRect(const TRect& aSrcRect, const TRect& aDesRect);
       
   264 
       
   265     /**
       
   266      * Draw highlight cell.
       
   267      *
       
   268      * @since S60 v3.2
       
   269      * @param aIndicate Indicate the button is pressed or not
       
   270      * @return None 
       
   271      */  
       
   272     virtual void DrawHighightCell(const TRect& aSrcRect, const TBool aIndidate);
       
   273     
       
   274 protected: // Data
       
   275 
       
   276     /**
       
   277      * The drop down list
       
   278      * Not own.
       
   279      */  
       
   280     MFepCtrlDropdownListContext *iOwner;
       
   281 
       
   282     /**
       
   283      * The list manager
       
   284      * Not own.
       
   285      */  
       
   286     CListManager* iManager;
       
   287     
       
   288     /**
       
   289      * the rectangle of the list
       
   290      */  
       
   291     TRect iRect;
       
   292     
       
   293     /**
       
   294      * the content rectangle of the list
       
   295      */  
       
   296     TRect iContentRect;
       
   297 
       
   298     /**
       
   299      * the navigation rectangle of the list
       
   300      */  
       
   301     TRect iNavigationRect;
       
   302 
       
   303     /**
       
   304      * the next button rectangle of the list
       
   305      */  
       
   306     TRect iNavigationNextRect;
       
   307 
       
   308     /**
       
   309      * the previous button rectangle of the list
       
   310      */  
       
   311     TRect iNavigationPreviousRect;
       
   312 
       
   313     /**
       
   314      * the close button rectangle of the list
       
   315      */  
       
   316     TRect iNavigationCloseRect;
       
   317     
       
   318     /**
       
   319      * the click rectangle of the list
       
   320      */  
       
   321     TRect iClickedRect;
       
   322     
       
   323     /**
       
   324      * the move rectangle of cell, when mouse moved
       
   325      */  
       
   326     TRect iMoveLatestRect;
       
   327 
       
   328     /**
       
   329      * the candidate index clicked
       
   330      */  
       
   331     TInt iClickedCandidateIndex;
       
   332     
       
   333     /**
       
   334      * the flag indicating the button is click or not
       
   335      */  
       
   336     TBool iIndicateButtonClicked;
       
   337     
       
   338     /**
       
   339      * the flag indicating the next button is enable or disable
       
   340      */  
       
   341     TBool iNextButtonDisable;
       
   342 
       
   343     /**
       
   344      * the flag indicating the close button is enable or disable
       
   345      */  
       
   346     TBool iCloseButtonDisable;
       
   347 
       
   348     /**
       
   349      * the flag indicating the previous button is enable or disable
       
   350      */  
       
   351     TBool iPreviousButtonDisable;
       
   352     
       
   353     /**
       
   354      * the flag indicating the list is multi rows or one row
       
   355      */  
       
   356     TBool iIsMultiRows;
       
   357     
       
   358     /**
       
   359      * the flag indicating the list is multi rows or one row
       
   360      */  
       
   361     TBool iPenDownInCandidate;
       
   362     
       
   363     TDropdownListDrawInfo iDropdownListDrawInfo;
       
   364     };
       
   365 
       
   366 #endif // C_CLIST_H
       
   367 
       
   368 // End Of File