textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputlayoutcandidatewnd.h
changeset 0 eb1f2e154e89
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  header file of candidate window 
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_CCANDIDATEWND_H
       
    19 #define C_CCANDIDATEWND_H
       
    20 
       
    21 #include <peninputlayoutbasecontrol.h>
       
    22 
       
    23 /**
       
    24  *  CCandidateWnd
       
    25  *
       
    26  *  Candidate window.
       
    27  *
       
    28  *  @lib feplayoutcontrol.lib
       
    29  *  @since S60 V4.0
       
    30  */
       
    31 class CCandidateWnd : public CFepUiBaseCtrl, public MCandidateBuffer, 
       
    32                       public MTimerHandler
       
    33     {
       
    34 public:
       
    35 
       
    36     /**
       
    37      * Destructor.        
       
    38      *
       
    39      * @since S60 V4.0        
       
    40      */           
       
    41     IMPORT_C ~CCandidateWnd();
       
    42 
       
    43     /**
       
    44      * Factory function.        
       
    45      *
       
    46      * @since S60 V4.0        
       
    47      * @param aRect The rectangle area for this control
       
    48      * @param aCandidateRectNum Number of candidates in one page
       
    49      * @param aUiLayout Ui layout who contains this control
       
    50      * @param aControlId control Id
       
    51      * @param aHideTimer Auto hide timer delay
       
    52      * @return An instance of CCandiadateWnd class        
       
    53      */                       
       
    54     IMPORT_C static CCandidateWnd* NewL(const TRect& aRect, TInt aCandidateRectNum,
       
    55                         CFepUiLayout* aUiLayout, TInt aCtrlId,
       
    56                         TTimeIntervalMicroSeconds32 aHideTimer = 0 );
       
    57     /**
       
    58      * Get Selected candidates.
       
    59      *
       
    60      * @since S60 V4.0
       
    61      * @return Current selected candidate
       
    62      */                           
       
    63     IMPORT_C const TDesC& GetSelCandidate();
       
    64     
       
    65     /**
       
    66      * Set autohide timer delay.
       
    67      *
       
    68      * @since S60 V4.0
       
    69      * @param aDelay The timer delay. If delay interval is 0, then disable auto hide
       
    70      */                                   
       
    71     IMPORT_C void SetAutoHideDelay(TTimeIntervalMicroSeconds32 aDelay);
       
    72     
       
    73     /**
       
    74      * Set number of candiates in one line
       
    75      * The cell rect and text rect is then caculted. text rect = cell rect
       
    76      *
       
    77      * @since S60 V4.0
       
    78      * @param aNumInLine The number of candiates in one page line
       
    79      */                                           
       
    80     IMPORT_C void SetCandidateNumL(TInt aNumInLine);       
       
    81    
       
    82     /**
       
    83      * Set number of candiates in one line and cell rect and text rect size.
       
    84      *
       
    85      * @since S60 V4.0
       
    86      * @param aNumInLine The number of candiates in one page line
       
    87      * @param aCellRectSize The cell rect size for one candidate
       
    88      * @param aTextRect The text rect for candidate drawing. This is relative 
       
    89      *                  to the cell rect.
       
    90      */                                                      
       
    91     IMPORT_C void SetCandidateNumL(TInt aNumInLine,const TSize& aCellRectSize,
       
    92     												const TRect& aTextRect);
       
    93     /**
       
    94      * Set the font for candidate
       
    95      *
       
    96      * @since S60 V4.0
       
    97      * @param aFontSpec the font spec to be used.
       
    98      */                                                   
       
    99     IMPORT_C void SetFont(const TFontSpec& aFontSpec);
       
   100     
       
   101     /**
       
   102      * Set the font for candidate
       
   103      *
       
   104      * @since S60 V4.0
       
   105      * @param aFont the font to be used.Ownership not transferred.
       
   106      */                                                   
       
   107     IMPORT_C void SetFont(const CFont* aFont);    
       
   108 
       
   109     /**
       
   110      * Set the baseline for text drawing
       
   111      *
       
   112      * @since S60 V4.0
       
   113      * @param aBaseline The baseline used for candidate drawing
       
   114      */                                         
       
   115     inline void SetBaseline(TInt aBaseline);    
       
   116     
       
   117     /**
       
   118      * get the baseline for text drawing
       
   119      *
       
   120      * @since S60 V4.0
       
   121      * @return The baseline
       
   122      */                                         
       
   123     inline TInt Baseline();        
       
   124     
       
   125     //from base class CFepUiBaseCtrl
       
   126     
       
   127     /**
       
   128      * From CFepUiBaseCtrl
       
   129      * Draw control
       
   130      *
       
   131      * @since S60 V4.0
       
   132      */                       
       
   133     IMPORT_C void Draw();
       
   134 
       
   135     /**
       
   136      * From CFepUiBaseCtrl
       
   137      * Update control and it's components rect
       
   138      *
       
   139      * @since S60 V4.0
       
   140      * @param aOffset The offset to be moved
       
   141      */                
       
   142     IMPORT_C void Move(const TPoint& aOffset);    
       
   143     
       
   144     /**
       
   145      * From CFepUiBaseCtrl
       
   146      * Handle pointer levae event. 
       
   147      * This will be called only when it's got pointer down event before and 
       
   148      * now pointer leaves without pointer up event
       
   149      *
       
   150      * @since S60 V4.0
       
   151      * @param aPoint current pointer position
       
   152      */
       
   153     virtual IMPORT_C void HandlePointerLeave(const TPoint& aPoint);
       
   154     
       
   155     /**
       
   156      * From CFepUiBaseCtrl
       
   157      * Call back function when layout starts dragging
       
   158      *
       
   159      * @since S60 V4.0
       
   160      */
       
   161     virtual IMPORT_C void OnLayoutDraggingStart();
       
   162 
       
   163     /**
       
   164      * From CFepUiBaseCtrl    
       
   165      * Call back function when layout ends dragging
       
   166      *
       
   167      * @since S60 V4.0
       
   168      */
       
   169     virtual IMPORT_C void OnLayoutDraggingEnd();
       
   170        
       
   171     /**
       
   172      * OnActivate. Called when the layout is going to be shown.
       
   173      *
       
   174      * @since S60 v4.0
       
   175      */        
       
   176     virtual IMPORT_C void OnActivate();
       
   177     
       
   178     /**
       
   179      * OnDeActivate. Called when the layout is going to be hidden
       
   180      *
       
   181      * @since S60 v4.0
       
   182      */        
       
   183     virtual IMPORT_C void OnDeActivate();
       
   184        
       
   185     //from base class MTimerHandler
       
   186     /**
       
   187      * From MTimerHandler
       
   188      * HandleTimerOut. Handling time out event
       
   189      *
       
   190      * @since S60 V4.0
       
   191      * @param aTimeType The timer type
       
   192      */                   
       
   193     IMPORT_C void HandleTimerOut(TInt aTimeType);        
       
   194 
       
   195     //from base class MCandidateBuffer        
       
   196     /**
       
   197      * From MCandidateBuffer
       
   198      * Set candidate buffer 
       
   199      *
       
   200      * @since S60 V4.0
       
   201      * @param aCandidateData Candidate data
       
   202      */        
       
   203     IMPORT_C void SetCandidateL(const RPointerArray<HBufC>& aCandidateData);
       
   204     
       
   205 protected:
       
   206     /**
       
   207      * Symbian second phrase constructor
       
   208      *
       
   209      * @since S60 V4.0
       
   210      */
       
   211     IMPORT_C void ConstructL();   
       
   212     
       
   213     /**
       
   214      * From CFepUiBaseCtrl
       
   215      * Handle pointer down event
       
   216      *
       
   217      * @since S60 V4.0
       
   218      * @param aPoint The point position relative the layout
       
   219      * @return The control which handles the event.     
       
   220      */                                        
       
   221     IMPORT_C virtual CFepUiBaseCtrl* HandlePointerDownEventL(const TPoint& aPoint);
       
   222 
       
   223     /**
       
   224      * From CFepUiBaseCtrl
       
   225      * Handle pointer move event
       
   226      *
       
   227      * @since S60 V4.0
       
   228      * @param aPoint The point position relative the layout
       
   229      * @return The control which handles the event.     
       
   230      */                  
       
   231     IMPORT_C virtual CFepUiBaseCtrl* HandlePointerMoveEventL(const TPoint& aPoint);
       
   232         
       
   233     /**
       
   234      * From CFepUiBaseCtrl
       
   235      * Handle pointer up event
       
   236      *
       
   237      * @since S60 V4.0
       
   238      * @param aPoint The point position relative the layout
       
   239      * @return The control which handles the event.     
       
   240      */                  
       
   241     IMPORT_C virtual CFepUiBaseCtrl* HandlePointerUpEventL(const TPoint& aPoint);
       
   242 
       
   243     
       
   244 private:
       
   245     /**
       
   246      * Constructor
       
   247      *
       
   248      * @since S60 V4.0
       
   249      * @param aRect The rectangle area for this control
       
   250      * @param aCandidateRectNum Number of candidates in one page
       
   251      * @param aUiLayout Ui layout who contains this control.Ownership not transferred
       
   252      * @param aControlId control Id
       
   253      * @param aHideTimer Auto hide timer delay
       
   254      */       
       
   255     IMPORT_C CCandidateWnd(const TRect& aRect,TInt aCandidateRectNum,
       
   256                             CFepUiLayout* aUiLayout, TInt aControlId,
       
   257                                TTimeIntervalMicroSeconds32 aHideTimer);
       
   258 
       
   259     /**
       
   260      * 
       
   261      * Draw indication candidate is selected
       
   262      *
       
   263      * @since S60 V4.0
       
   264      * @param aSelection The selection index
       
   265      * @param aPressedFlag The flag indicates whether the pointer is pressed.
       
   266      *        Default value is ETrue, show pressed effect
       
   267      */    
       
   268     void DrawIndication(TInt aSelection, TBool aPressedFlag = ETrue);
       
   269     
       
   270 private:
       
   271     /**
       
   272      * Number of candiate rect in one page line
       
   273      */
       
   274     TInt iCandidateRectNum;
       
   275     
       
   276     /**
       
   277      * Selection index. From 0 to iCandiateRectNum - 1
       
   278      */
       
   279     TInt iSelection;
       
   280     
       
   281     /** 
       
   282      * Auto hide flag. When true, the candidate window will hide if no candidate in list 
       
   283      */
       
   284     TBool iAutoHide;
       
   285        
       
   286     /**
       
   287      * Hide timer delay
       
   288      */
       
   289     TTimeIntervalMicroSeconds32  iDelay;
       
   290     
       
   291     /**
       
   292      * Font information 
       
   293      */
       
   294     TFontSpec iFontSpec;
       
   295 
       
   296     /**
       
   297      * Candidate rects for each candidate. Valid rect for pen event
       
   298      */
       
   299     RArray<TRect> iCandidateRectList;
       
   300     
       
   301     /**
       
   302      * Candidate text drawing rects for each candidate.
       
   303      */
       
   304     RArray<TRect> iCandidateTextRectList;    
       
   305     
       
   306     /**
       
   307      * Candidate data
       
   308      */
       
   309     RPointerArray<HBufC> iCandidateList;
       
   310     
       
   311     /**
       
   312      * Baseline for candidate drawing
       
   313      */
       
   314     TInt iBaseline;
       
   315     
       
   316     /**
       
   317      * Hide timer
       
   318      * Ownd
       
   319      */
       
   320     CLayoutTimer* iHideTimer;
       
   321      
       
   322      /** 
       
   323       * Font object used to draw candiates
       
   324       * Ownd
       
   325       */
       
   326      CFont* iFont;
       
   327 
       
   328     /**
       
   329      *  Flag ownership flag. ETrue if CFont object is owned by this control.
       
   330      */
       
   331     TBool iFontOwnership;
       
   332 
       
   333     /**
       
   334      * Indicate whether the pointer has leaved a candidate cell
       
   335      */    
       
   336     TBool iPointerLeftCandidate;
       
   337     
       
   338     /**
       
   339      * Reserved item1
       
   340      */
       
   341      TInt iReserved1;
       
   342      
       
   343     /**
       
   344      * Reserved item2
       
   345      */
       
   346      TInt iReserved2;    
       
   347     };
       
   348 #include "peninputlayoutcandidatewnd.inl"    
       
   349 #endif //C_CCANDIDATEWND_H
       
   350 //end of CCandidateWindow