textinput/peninputhwrfscn/inc/peninputfullscrlayoutbase.h
branchRCL_3
changeset 21 ecbabf52600f
parent 0 eb1f2e154e89
equal deleted inserted replaced
20:ebd48d2de13c 21:ecbabf52600f
       
     1 /*
       
     2 * Copyright (c) 2006-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 peninput fullscreen HWR layout base
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __PENINPUTFULLSCRLAYOUTBASE_H__
       
    20 #define __PENINPUTFULLSCRLAYOUTBASE_H__
       
    21 
       
    22 // INCLUDES
       
    23 #include "peninputlayout.h"
       
    24 
       
    25 class CPenInputFullScreenLayoutBase : public CFepUiLayout
       
    26     {
       
    27 public:
       
    28     /**
       
    29      * Destructor.
       
    30      *
       
    31      * @since S60 v4.0
       
    32      */
       
    33     virtual ~CPenInputFullScreenLayoutBase();
       
    34 
       
    35     /**
       
    36      * BaseConstructL
       
    37      * Does the base construction. Derivated class must call this when constructed.
       
    38      *
       
    39      * @since S60 v4.0
       
    40      */
       
    41     virtual void BaseConstructL();
       
    42 
       
    43     /**
       
    44      * Constructor
       
    45      *
       
    46      * @since S60 v4.0
       
    47      * @param aLayoutOwner The layout owner
       
    48      * @param aDuration The maximum time to buffer the event.
       
    49      */
       
    50     CPenInputFullScreenLayoutBase( MLayoutOwner* aLayoutOwner );
       
    51 
       
    52     /**
       
    53      * From MFepLayoutBase
       
    54      * HandleEventL. Handle UI event.
       
    55      * There are only 3 kinds of UI event right now: raw event,
       
    56      * pointer and pointer buffer event.
       
    57      *
       
    58      * @since S60 v4.0
       
    59      * @param aType The event type. See TEventType
       
    60      * @param aEventData The event data.
       
    61      * @return The control which processes the event
       
    62      */
       
    63     TBool HandleEventL( TEventType aType, const TAny* aEventData );
       
    64 
       
    65     /**
       
    66      * SemiTransparencyRequired. Tell whether this layout requires semi-transparency.
       
    67      * This is to save memory used in mask bitmap. If transparency not deeded,
       
    68      * We use black-white bitmap.
       
    69      *
       
    70      * @since S60 v5.0
       
    71      * @return ETrue if layout require transparency, otherwise EFalse.
       
    72      */
       
    73     TBool SemiTransparencyRequired();
       
    74 
       
    75     /**
       
    76      * Set stroke filter.
       
    77      *
       
    78      * @since S60 v4.0
       
    79      * @param aEnable stroke filter
       
    80      */
       
    81     void EnableStrokeFilter( TBool aEnable );
       
    82     
       
    83     /**
       
    84      * Get current stroke filter status
       
    85      *
       
    86      * @since S60 v5.0
       
    87      * @return stroke filter status
       
    88      */
       
    89     TBool StrokeFilter() const;
       
    90     
       
    91 protected:
       
    92 	/**
       
    93 	* PreHandleEvent
       
    94 	*
       
    95 	* @since S60 v5.0
       
    96 	*/
       
    97 	virtual void PreHandleEvent( TEventType aType, const TRawEvent &aEvent );
       
    98     
       
    99     /**
       
   100     * Notify the subclass to do someting before sending the events to background
       
   101     *
       
   102     * @since S60 v5.0
       
   103     */
       
   104     virtual void BeforeSendingEventsToBackground();
       
   105     
       
   106 private:
       
   107     /**
       
   108      * PeriodicCallBack. call back function for periodic timer object.
       
   109      *
       
   110      * @since S60 v5.0
       
   111      * @return KErrNone if no error.
       
   112      */
       
   113     static TInt PeriodicCallBack( TAny *aAnyPtr );
       
   114 
       
   115     /**
       
   116      * OnLongTapTimeOut. called when longtap periodic time-out.
       
   117      *
       
   118      * @since S60 v5.0
       
   119      * @return KErrNone if no error.
       
   120      */
       
   121     TInt OnLongTapTimeOut();
       
   122 
       
   123     /**
       
   124      * OnRawEvent_Button1Down. handle TRawEven::EButton1Down event.
       
   125      *
       
   126      * @since S60 v5.0
       
   127      * @return ETrue if event is handled, or return EFalse.
       
   128      */
       
   129     TBool OnRawEvent_Button1Down( const TRawEvent &event );
       
   130 
       
   131     /**
       
   132      * OnRawEvent_Button1Up. handle TRawEven::EButton1Up event.
       
   133      *
       
   134      * @since S60 v5.0
       
   135      * @return ETrue if event is handled, or return EFalse.
       
   136      */
       
   137 	TBool OnRawEvent_Button1Up( const TRawEvent &event );
       
   138 
       
   139     /**
       
   140      * OnRawEvent_PointerMove. handle TRawEven::EPointerMove event.
       
   141      *
       
   142      * @since S60 v5.0
       
   143      * @return ETrue if event is handled, or return EFalse.
       
   144      */
       
   145 	TBool OnRawEvent_PointerMove( const TRawEvent &event );
       
   146 
       
   147     /**
       
   148      * StartLongTapTimer. start long tap timer.
       
   149      *
       
   150      * @since S60 v5.0
       
   151      */
       
   152 	void StartLongTapTimer();
       
   153 
       
   154     /**
       
   155      * StopLongTapTimer. stop long tap timer.
       
   156      *
       
   157      * @since S60 v5.0
       
   158      */
       
   159 	void StopLongTapTimer();
       
   160 
       
   161     /**
       
   162      * RecordPointerEvent. add aEvent to iEventBuf.
       
   163      *
       
   164      * @since S60 v5.0
       
   165      */
       
   166 	void RecordPointerEvent( const TRawEvent &aEvent );
       
   167 
       
   168     /**
       
   169      * SendBufferEventToLayout. send event in buffer to peninput layout and reset buffer.
       
   170      *
       
   171      * @since S60 v5.0
       
   172      */
       
   173 	void SendBufferEventToLayoutL();
       
   174 
       
   175     /**
       
   176      * SendBufferEventToBackground. send event in buffer to background application and reset buffer.
       
   177      *
       
   178      * @since S60 v5.0
       
   179      */
       
   180 	void SendBufferEventToBackground();
       
   181 
       
   182     /**
       
   183      * IsStroke. test if the pointer event in buffer is a stroke.
       
   184      *
       
   185      * @since S60 v5.0
       
   186      * @return ETure if it is a stroke, or return EFalse.
       
   187      */
       
   188 	TBool IsStroke();
       
   189 
       
   190     /**
       
   191      * CalcDiagonalDistance. calculate the diagonal distance of the events in buffer.
       
   192      *
       
   193      * @since S60 v5.0
       
   194      * @return the diagonal distance value.
       
   195      */
       
   196 	TReal CalcDiagonalDistance();
       
   197 
       
   198     /**
       
   199      * CalcAngle. calculate the anti-clockwise angle of the first and last pointer event pos in the buffer.
       
   200      *
       
   201      * @since S60 v5.0
       
   202      * @return the angle value.
       
   203      */
       
   204 	TInt CalcAngle();
       
   205 
       
   206 private:
       
   207 	/**
       
   208 	* pointer/pen state
       
   209 	*/
       
   210 	enum TPenState
       
   211 		{
       
   212 		EPenStateUnknown,
       
   213 		EPenStateStroke,
       
   214 		EPenStateLongTap,
       
   215 		};
       
   216 	TPenState iPenState;
       
   217 
       
   218     /**
       
   219      * Timer to check whether event needs simulatation or handling.
       
   220      * Own.
       
   221      */
       
   222     CPeriodic* iLongTapPeriodic;
       
   223 
       
   224     /*
       
   225      * Event buffer.
       
   226      */
       
   227     RArray<TRawEvent> iEventBuf;
       
   228     
       
   229     /*
       
   230      * Stroke filter
       
   231      */
       
   232     TBool iEnableStrokeFilter;
       
   233     };
       
   234 
       
   235 #endif	//__PENINPUTFULLSCRLAYOUTBASE_H__
       
   236 // End of file