textinput/peninputcommonctrlsjp/inc/peninputjapanesecandidatewnd.h
changeset 0 eb1f2e154e89
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 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:  Candidate Window
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_CPENINPUTJAPANESECANDIDATEWND_H
       
    19 #define C_CPENINPUTJAPANESECANDIDATEWND_H
       
    20 #include <peninputpluginutils.h>
       
    21 
       
    22 // INCLUDES
       
    23 #include <eiklbo.h>
       
    24 #include <peninputlayoutpopupwnd.h>
       
    25 
       
    26 
       
    27 // CLASS DECLARATION
       
    28 class CPeninputJapaneseCandidateListBox;
       
    29 class CTextListBoxModel;
       
    30 class CFepInputContextFieldJp;
       
    31 
       
    32 class CPeninputJapaneseCandidateWnd: public CFepLayoutPopupWnd, public MEikListBoxObserver, public MAknFepTimerHandler
       
    33     {
       
    34 public:
       
    35     enum TPeninputUICtrlScroll
       
    36         {
       
    37         EScrollNone,
       
    38         EScrollUp,
       
    39         EScrollDown
       
    40         };
       
    41     /**
       
    42     * Two-phased constructor.
       
    43     */
       
    44     IMPORT_C static CPeninputJapaneseCandidateWnd* NewL(CFepUiLayout* aUiLayout,
       
    45                                                           TInt aControlId, const CCoeControl* aParent);
       
    46 
       
    47     /**
       
    48     * Destructor.
       
    49     */
       
    50     virtual ~CPeninputJapaneseCandidateWnd();
       
    51 
       
    52     //from base control CFepUiBaseCtrl
       
    53     /**
       
    54      * From CFepUiBaseCtrl
       
    55      * Set control's rectangle
       
    56      *
       
    57      * @since S60 V4.0
       
    58      * @param aRect The new control area
       
    59      */
       
    60     IMPORT_C virtual void SetRect(const TRect& aRect);
       
    61 
       
    62     /**
       
    63     * @since 2.6
       
    64     * @param aTPoint aPos     display position
       
    65     *
       
    66     */
       
    67     IMPORT_C void SetPosition(const TPoint& aPos);
       
    68 
       
    69     /**
       
    70     * @since 2.6
       
    71     * @param aInputContextField
       
    72     *
       
    73     */
       
    74     void SetIcf(CFepInputContextFieldJp* aInputContextField);
       
    75 
       
    76     /**
       
    77     * From MAknFepUICtrlCandidatePaneInterface
       
    78     * Show candidate list popup window
       
    79     * @since 2.6
       
    80     * @param aItems     array of candidate list
       
    81     * @param aIndex     selecting number when displaying
       
    82     *
       
    83     */
       
    84     IMPORT_C void ShowPopupL(CDesCArrayFlat* aItems, TInt aIndex);
       
    85 
       
    86     /**
       
    87     * From MAknFepUICtrlCandidatePaneInterface
       
    88     * Hide candidate list popup window
       
    89     * @since 2.6
       
    90     * @param aItems     array of candidate list
       
    91     * @return None
       
    92     *
       
    93     */
       
    94     IMPORT_C void HidePopup();
       
    95 
       
    96     /**
       
    97     * @return  a selected candidate item number currently
       
    98     * @since 2.6
       
    99     */
       
   100     IMPORT_C TInt CurrentItemIndex() const;
       
   101 
       
   102     /**
       
   103     * Update Maxrow accoding to font
       
   104     * @param aUnitHeight
       
   105     * @param aUnitCount
       
   106     * @return None
       
   107     */
       
   108     void UpdateMaximumRows(TInt aUnitHeight, TInt aUnitCount);
       
   109 
       
   110     /**
       
   111     * @param aData Carry information of key pressed
       
   112     * @return None
       
   113     *
       
   114     */
       
   115     void MoveToL(TPeninputUICtrlScroll aDirection);
       
   116 
       
   117     /**
       
   118      * Get item whose region contains the point.
       
   119      *
       
   120      * @since S60 V4.0
       
   121      * @param aPoint The point position the layout
       
   122      * @return The index of choice item. -1 if no item contains
       
   123      *         the point
       
   124      */
       
   125      TInt HitTest(const TPoint& aPoint);
       
   126 
       
   127     /**
       
   128      * Handle pointer down event
       
   129      *
       
   130      * @since S60 V4.0
       
   131      * @param aPoint The point position relative the layout
       
   132      * @return The control which handles the event.
       
   133      */
       
   134     virtual CFepUiBaseCtrl* HandlePointerDownEventL(const TPoint& aPoint);
       
   135 
       
   136     /**
       
   137      * Handle pointer move event
       
   138      *
       
   139      * @since S60 V4.0
       
   140      * @param aPoint The point position relative the layout
       
   141      * @return The control which handles the event.
       
   142      */
       
   143     virtual CFepUiBaseCtrl* HandlePointerMoveEventL(const TPoint& aPoint);
       
   144 
       
   145     /**
       
   146      * Handle pointer up event
       
   147      *
       
   148      * @since S60 V4.0
       
   149      * @param aPoint The point position relative the layout
       
   150      * @return The control which handles the event.
       
   151      */
       
   152     virtual CFepUiBaseCtrl* HandlePointerUpEventL(const TPoint& aPoint);
       
   153 
       
   154     // from MEikListBoxObserver
       
   155     /**
       
   156      * Handle pointer up event
       
   157      *
       
   158      * @since S60 V4.0
       
   159      * @param aListBox ListBox control
       
   160      * @param aEventType
       
   161      * @return None
       
   162      */
       
   163     virtual void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
       
   164 
       
   165     /**
       
   166      * Cancel ScrollBar repeat
       
   167      *
       
   168      * @since S60 v3.2
       
   169      * @return None
       
   170      */
       
   171     void CancelScrollBarRepeat();
       
   172 
       
   173     /**
       
   174      * from MAknFepTimerHandler
       
   175      * HandleTimerOut. Handling time out event
       
   176      *
       
   177      * @since S60 v3.2
       
   178      * @param aTimer The timer which sending the request
       
   179      * @return None
       
   180      */
       
   181     void HandleTimerOut(const CAknFepTimer* aTimer);
       
   182 
       
   183     /**
       
   184     * @return  listbox control
       
   185     * @since 2.6
       
   186     */
       
   187     CPeninputJapaneseCandidateListBox* ListBox() const;
       
   188 
       
   189     /**
       
   190      * From CFepUiBaseCtrl
       
   191      * DeActivate popup window
       
   192      *
       
   193      * @since S60 V4.0
       
   194      */ 
       
   195     void OnDeActivate();
       
   196 
       
   197 protected:
       
   198 
       
   199     /**
       
   200      * Constructor.
       
   201      *
       
   202      * @since S60 V4.0
       
   203      * @param aUiLayout Ui layout who contains this control.Ownership not transferred
       
   204      * @param aControlId control Id
       
   205      */
       
   206     CPeninputJapaneseCandidateWnd(CFepUiLayout* aUiLayout,
       
   207                                   TInt aControlId);
       
   208 
       
   209 private:
       
   210     /**
       
   211     * Symbian 2nd phase constructor can leave.
       
   212     * @return None
       
   213     */
       
   214     void ConstructL(const CCoeControl* aParent);
       
   215 
       
   216     /**
       
   217     * This function returns maximum columns to be able to display in listbox, this function
       
   218     * find longest candidate string in candidate list. Return 11 columns in case more than 11 columns, and minimum is 3 columns.
       
   219     * @since 2.6
       
   220     * @param aModel listbox model object
       
   221     * @return maximum columns
       
   222     */
       
   223     TInt MaximumColumns(const CTextListBoxModel* aModel) const;
       
   224 
       
   225     /**
       
   226     * This function returns maximum rows to be able to display in listbox.
       
   227     * Maximum is 7 rows and  minimum is 3 columns.
       
   228     * @since 2.6
       
   229     * @param aModel listbox model object
       
   230     * @return maximum line
       
   231     */
       
   232     TInt MaximumRows(const CTextListBoxModel* aModel) const;
       
   233 
       
   234     /**
       
   235     * from CFepUiBaseCtrl
       
   236     * Called by the framework to draw the control
       
   237     * @param aRect  Rectangle in which the Cone framework believes drawing
       
   238     *               is needed
       
   239     */
       
   240     void Draw();
       
   241 
       
   242     /**
       
   243      * ReDraw
       
   244      */
       
   245     void ReDraw();
       
   246 
       
   247     /**
       
   248      * Draw Title
       
   249      */
       
   250     void DrawTitle();
       
   251 
       
   252     /**
       
   253      * Send pointer event to ListBox.
       
   254      * Used for e.g. selecting an item from the list box.
       
   255      *
       
   256      * @param aPointerEvent Details of the pointer event that is being handled.
       
   257      * @param aFlags   1: to ListBox otherwise:to ScrollBar
       
   258      * @param aDraw   ETrue: Draw if to ScrollBar EFalse: not Draw
       
   259      */
       
   260     void SendPointerEventL(const TPointerEvent& aPointerEvent, TInt aFlags, TBool aDraw);
       
   261 
       
   262 private:
       
   263 
       
   264     TInt iMaximumColumns;
       
   265     TInt iMaximumRows;
       
   266 
       
   267     /**
       
   268      * listbox
       
   269      * Own
       
   270      */
       
   271     CPeninputJapaneseCandidateListBox* iListBox;
       
   272 
       
   273     TPoint iPos;
       
   274 
       
   275     /**
       
   276      * The input context field
       
   277      * Not Own
       
   278      */
       
   279     CFepInputContextFieldJp* iInputContextField;
       
   280 
       
   281     /**
       
   282      * The maximum row according to font
       
   283      */
       
   284     TInt iFontMaximumRows;
       
   285 
       
   286     TSize iTopLeft;
       
   287 
       
   288     TPointerEvent iScrollBarPointerEvent;
       
   289 
       
   290     /**
       
   291      * long press timer (Own)
       
   292      */
       
   293     CAknFepTimer* iLongPressTimer;
       
   294 
       
   295     /**
       
   296      * repeat timer (Own)
       
   297      */
       
   298     CAknFepTimer* iRepeatTimer;
       
   299 
       
   300     /** 
       
   301      * Server application GC. It's used to keep the original window GC.
       
   302      * Not Own
       
   303      */    
       
   304     CWindowGc* iAppGc; 
       
   305     };
       
   306 
       
   307 #endif //C_CPENINPUTJAPANESECANDIDATEWND_H
       
   308 
       
   309 // End Of File