textinput/peninputarc/inc/pensrvcliinc/peninputserver.h
changeset 0 eb1f2e154e89
child 6 6ceef9a83b1a
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:  Defination for peninput server
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CPENINPUTSERVER_H
       
    20 #define C_CPENINPUTSERVER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <w32std.h>
       
    25 #include <e32msgqueue.h>
       
    26 #include <peninputlayoutplugininterface.h>
       
    27 #include <peninputlayouteng.h>
       
    28 #include "peninputmsgqueue.h"
       
    29 #include <e32property.h>
       
    30 #include <centralrepository.h>
       
    31 
       
    32 #include "peninputcmdparamext.h"
       
    33 
       
    34 // the maximum count of TUpdateArea that area pool can hold
       
    35 const TInt KMaxRectNumInBuf = 100;
       
    36 class CCoeControl;
       
    37 class CPeninputAnimObj;
       
    38 class CPeninputUiLayoutOwner;
       
    39 class CPenUiWndCtrl;
       
    40 class CInternalBkCtrl;
       
    41 class CKeyRotator;
       
    42 class CPenInputCrpServiceClient;
       
    43 // panic code
       
    44 enum TPeninputServerPanic
       
    45     {
       
    46     EBadRequest = -2000,
       
    47     EBadDescriptor,
       
    48     EMainSchedulerError,
       
    49     ESvrCreateServer,
       
    50     ESvrStartServer,
       
    51     ECreateTrapCleanup,
       
    52     ENotImplementedYet,
       
    53     ESessionTimeout,
       
    54     ENullSession
       
    55     };
       
    56 
       
    57 //#define __LOG_WNDGROU__
       
    58 
       
    59 // ==================== GLOBAL FUNCTIONS ====================
       
    60 
       
    61 /** 
       
    62  * Function to panic the server
       
    63  *
       
    64  * @since S60 ?S60_version
       
    65  * @param aPanic The panic id
       
    66  */
       
    67 GLREF_C void PanicServer(TPeninputServerPanic aPanic );
       
    68 
       
    69 
       
    70 // CONSTANTS
       
    71 
       
    72 // FORWARD DECLARATIONS
       
    73 class CPeninputServerSession;
       
    74 class RMessage;
       
    75 class CEventQueue;
       
    76 class CPtiEngine;
       
    77 class CAknLayoutChangeWatcher;
       
    78 // DESCRIPTION
       
    79 /**
       
    80  * Class MRawEventHandler
       
    81  * Raw event handler interface
       
    82  *
       
    83  * @since S60 v4.0
       
    84  */
       
    85 
       
    86 class MRawEventHandler
       
    87     {
       
    88 public:
       
    89     /**
       
    90      * Handle event. Handle raw event from pen input animation
       
    91      *
       
    92      * @since S60 v4.0
       
    93      * @param aEvent The event to be processed
       
    94      */                
       
    95     virtual void HandleRawEventL(const TRawEvent& aEvent) = 0 ;
       
    96     };
       
    97     
       
    98     
       
    99 // DESCRIPTION
       
   100 /**
       
   101  * The server class; an active object.
       
   102  *
       
   103  * Contains an instance of RServer; a handle to the kernel server representation which is used 
       
   104  * to receive messages. 
       
   105  *
       
   106  * @since S60 v4.0
       
   107  */
       
   108 
       
   109 NONSHARABLE_CLASS(CPeninputServer) : public CServer2, MRawEventHandler
       
   110 {
       
   111 public:
       
   112     // reasons for server panic
       
   113     // Constructors and destructor
       
   114     /** 
       
   115      * Epoc constructor. Leaves the created object on cleanup stack.
       
   116      *
       
   117      * @since S60 v4.0
       
   118      */
       
   119     static CPeninputServer* NewL();    
       
   120     
       
   121     /**
       
   122      * Destructor
       
   123      *
       
   124      * @since S60 v4.0
       
   125      */
       
   126     virtual ~CPeninputServer();
       
   127  
       
   128     /**
       
   129      * Increase number of sessions
       
   130      *
       
   131      * @since S60 v4.0
       
   132      */
       
   133     void IncreaseSessionCount();
       
   134 
       
   135     /**
       
   136      * Decrease number of sessions
       
   137      *
       
   138      * @since S60 v4.0
       
   139      * @param aSession The session to be closed.
       
   140      */
       
   141     void DecreaseSessionCount(CPeninputServerSession* aSession);
       
   142 
       
   143     /**
       
   144      * Handle client command
       
   145      *
       
   146      * @since S60 v4.0
       
   147      * @param aMessage The client messasge
       
   148      * @return Operation result code
       
   149      */
       
   150     TInt HandleCommandL(const RMessage2& aMessage);
       
   151     
       
   152     /**
       
   153      * Handle client message
       
   154      *
       
   155      * @since S60 v4.0
       
   156      * @param aMessage The client messasge
       
   157      * @return KErrNone if operation successfully. Otherwise any operation 
       
   158      *                  specified error
       
   159      */
       
   160     TInt HandleMessageL(const RMessage2& aMessage);
       
   161     
       
   162     /**
       
   163      * Signal server obserer
       
   164      *
       
   165      * @since S60 v4.0
       
   166      * @param aEventId The event id
       
   167      * @param aEventData The event data
       
   168      */
       
   169     void SignalObserverL(TInt aEventId , const TDesC& aEventData);
       
   170 
       
   171     /**
       
   172      * Create ui layout
       
   173      *
       
   174      * @since S60 v4.0
       
   175      * @param aLayoutId The layout id
       
   176      * @return ETrue if creation successfully. Otherwise EFalse
       
   177      */
       
   178     TBool SetLayoutId(TInt aLayoutId);
       
   179 
       
   180     /**
       
   181      * Handling client sieze change event
       
   182      *
       
   183      * @since S60 v4.0
       
   184      */
       
   185     void SizeChanged();
       
   186     
       
   187     /**
       
   188      * Change display mode
       
   189      *
       
   190      * @since S60 v4.0
       
   191      * @param aMode The new display mode
       
   192      * @param aMaskMode The new display mode for mask device
       
   193      */    
       
   194     void ChangeDisplayModeL(TDisplayMode aMode,TDisplayMode aMaskMode);
       
   195     
       
   196     /**
       
   197      * Timer call back for CPeriod
       
   198      *
       
   199      * @since S60 v4.0
       
   200      * @param aPtr The data passed to callback function
       
   201      * @return The processed result. Always ETrue, not used here.
       
   202      */  
       
   203     static TInt FlushTimerCallBack(TAny *aPtr);    
       
   204 
       
   205     /**
       
   206      * Flush the window session. This causes all bufferd command sent to pen 
       
   207      * input animation.
       
   208      *
       
   209      * @since S60 v4.0     
       
   210      */      
       
   211      void FlushWsSession();
       
   212      
       
   213     /**
       
   214      * low priority construction.
       
   215      *
       
   216      * @since S60 v4.0     
       
   217      */           
       
   218     void DoIdleConstructL();
       
   219     
       
   220     /**
       
   221      * Handle application resource change
       
   222      *
       
   223      * @since S60 v4.0     
       
   224      * @param aType The event type
       
   225      */               
       
   226     void HandleResourceChange(TInt aType);
       
   227     
       
   228     /**
       
   229      * Handle property change
       
   230      *
       
   231      * @since S60 v4.0     
       
   232      * @param aData The event data
       
   233      */                   
       
   234     static TInt PropertyChangeCallBack(TAny* aData);
       
   235     
       
   236     /**
       
   237      * Hide layout temporary
       
   238      *
       
   239      * @since S60 v4.0     
       
   240      * @param aData The event data
       
   241      */                       
       
   242     void HideLayoutTemporaryL();    
       
   243     void PrepareExit();
       
   244     
       
   245     /**
       
   246      * Set new disabled layouts of current session
       
   247      *
       
   248      * @since S60 v4.0     
       
   249      * @return KErrNone if everything ok.
       
   250      */         
       
   251     TInt SetDisabledLayouts( TInt aDisabledLayouts );
       
   252     
       
   253     /**
       
   254      * Get new disabled layouts of current TProcessId
       
   255      *
       
   256      * @since S60 v4.0     
       
   257      * @return KErrNone if everything ok.
       
   258      */  
       
   259     TInt GetProcessLayouts( const TProcessId& aProcessId, TInt& aLayouts );
       
   260   
       
   261     /**
       
   262      * Set new disabled layouts of current TProcessId
       
   263      *
       
   264      * @since S60 v4.0     
       
   265      * @return KErrNone if everything ok.
       
   266      */  
       
   267     TInt SetProcessLayouts( const TProcessId& aProcessId, TInt aLayouts);
       
   268     
       
   269     /**
       
   270      * Delete new disabled layouts of current TProcessId
       
   271      *
       
   272      * @since S60 v4.0     
       
   273      * @return KErrNone if everything ok.
       
   274      */  
       
   275     void DelProcessLayouts( const TProcessId& aProcessId );
       
   276     //from base class CServer2
       
   277 
       
   278     /** 
       
   279      * From CServer2
       
   280      * Create sesssion
       
   281      *
       
   282      * @since S60 v4.0
       
   283      * @param aVersion server version
       
   284      * @param aMessage Client message
       
   285      * @return a CSharableSession instance
       
   286      */
       
   287     CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
       
   288     
       
   289 public: // From MRawEventHandler
       
   290     /**
       
   291      * From MRawEventHandler
       
   292      * handle raw event
       
   293      *
       
   294      * @since S60 v4.0
       
   295      * @param aEvent The event to be processed.
       
   296      */    
       
   297     void HandleRawEventL(const TRawEvent& aEvent);
       
   298 
       
   299 public: // handle layoutowner event
       
   300     /** 
       
   301      * Update the UI area
       
   302      * @since S60 v4.0
       
   303      * @param aRect The rect to be updated
       
   304      * @param aFullUpdate Full update flag
       
   305      * @param aImmedFlag Flags indicates immediately update
       
   306      */
       
   307     void UpdateArea(const TRect& aRect,TBool aFullUpdate, TBool aImmedFlag );
       
   308 
       
   309     /**
       
   310      * Set layout position
       
   311      *
       
   312      * @since S60 v4.0
       
   313      * @param aNewPos The layout position
       
   314      */
       
   315     TPoint SetPosition(const TPoint& aNewPos);
       
   316 
       
   317     /**
       
   318      * Get bitmap context
       
   319      *
       
   320      * @since S60 v4.0
       
   321      * @return The bitmap context
       
   322      */
       
   323     CBitmapContext* BitmapContext();
       
   324 
       
   325     /**
       
   326      * Get bitmap device
       
   327      *
       
   328      * @since S60 v4.0
       
   329      * @return The bitmap device
       
   330      */
       
   331     CFbsBitmapDevice* BitmapDevice();
       
   332 
       
   333     /**
       
   334      * Get mask bitmap device
       
   335      *
       
   336      * @since S60 v4.0
       
   337      * @return The mask bitmap device
       
   338      */
       
   339     CFbsBitmapDevice* MaskBmpDevice();
       
   340 
       
   341     /**
       
   342      * Show or hide sprite
       
   343      *
       
   344      * @since S60 v4.0
       
   345      * @param aHideFlag ETrue if hide sprite, otherwise show.
       
   346      */
       
   347     void Hide(TBool aHideFlag=ETrue);
       
   348 
       
   349     /**
       
   350      * Signal owner that there is an event
       
   351      *
       
   352      * @since S60 v4.0     
       
   353      * @param aEventType The event type
       
   354      * @param aEventData The event data
       
   355      */        
       
   356     void SignalOwner(TInt aEventType, const TDesC& aEventData);
       
   357 
       
   358     /**
       
   359      * Handle layout size change event
       
   360      *
       
   361      * @since S60 v4.0
       
   362      * @param aBut The character buffer
       
   363      * @param aCtrlId The control which sends the data
       
   364      */
       
   365     TInt LayoutSizeChanged(const TSize& aSize, TBool aNeedUpdate = ETrue);
       
   366     
       
   367     /**
       
   368      * Get layout position and it's rect.
       
   369      * The position is relative to it's parent window or screen.
       
   370      * The size includes all invisible layout area.
       
   371      *
       
   372      * @since S60 v4.0     
       
   373      * @return layout position.
       
   374      */       
       
   375     TRect LayoutRect();    
       
   376     
       
   377     void ExecutePendingAnimCmd();
       
   378   
       
   379     void HandleWsEventL(const TWsEvent &aEvent, CCoeControl *aDestination);    
       
   380     
       
   381     TBool AnimOpNeedWaiting(TInt aSignalCode);
       
   382 
       
   383     TInt HandleAppInfoChange(CPeninputServerSession* aSession,
       
   384                             const TDesC& aAppInfo, TPeninputAppInfo aType) const;
       
   385 protected:  // New functions
       
   386 
       
   387     /**
       
   388      * Default constructor.
       
   389      *
       
   390      * @since S60 v4.0
       
   391      * @param aPriority priority of the server
       
   392      */
       
   393     CPeninputServer( TInt aPriority );
       
   394 
       
   395 
       
   396     //from base class CServer2
       
   397     /**
       
   398      * From CServer.
       
   399      *Handles possible leaves in 
       
   400      *
       
   401      * @since S60 v4.0
       
   402      * @param aError leave code of ServiceL()
       
   403      * @return error code after error handling
       
   404      */
       
   405     TInt RunError( TInt aError );
       
   406 
       
   407 private:    // New functions
       
   408                    
       
   409     /**
       
   410      * Second phase constructror.
       
   411      *
       
   412      * @since S60 v4.0
       
   413      */
       
   414     void ConstructL( );
       
   415 
       
   416     /**
       
   417      * Constructs the sprite anim ie. PENINPUT UI which is a window server plugin
       
   418      *
       
   419      * @since S60 v4.0
       
   420      */
       
   421     void ConstructSpriteL();
       
   422     
       
   423 
       
   424     /**
       
   425      * Constructs the sprite anim ie. PENINPUT UI which is a window server plugin
       
   426      *
       
   427      * @since S60 v4.0
       
   428      */
       
   429     void ConstructAnimL();    
       
   430 
       
   431     /**
       
   432      * Creates bimaps for the sprite.
       
   433      *
       
   434      * @since S60 v4.0
       
   435      * @param aBitmapSize size of the bitmap
       
   436      * @param aDisplayMode display mode of the bitmap
       
   437      * @return The initialized bitmap object (cleared to white)
       
   438      */
       
   439     CFbsBitmap* CreateBitmapL( const TSize& aBitmapSize, TDisplayMode aDisplayMode ) const;
       
   440 
       
   441     /**
       
   442      * Make peninput window visible
       
   443      *
       
   444      * @since S60 v4.0
       
   445      */
       
   446     void ActivateSprite();
       
   447 
       
   448     /**
       
   449      * Make peninput window visible
       
   450      *
       
   451      * @since S60 v5.0
       
   452      * @param aScrMode The required screen mode
       
   453      */
       
   454     void ActivateSprite(TInt aScrMode);
       
   455 
       
   456     /**
       
   457      * Show pen UI in global notes editor.
       
   458      *
       
   459      * @since S60 v5.0
       
   460      */
       
   461     void ActivateSpriteInGlobalNotesL();
       
   462     /**
       
   463      * Make peninput window invisible
       
   464      *
       
   465      * @since S60 v4.0
       
   466      * @param aImmediateHideFlag ETrue if UI is asked to be hidden immediately. Otherwise
       
   467      * hidding is wait until UI observer handles the notification
       
   468      */
       
   469     void DeactivateSprite(TBool aImmediateHideFlag = EFalse, TBool aRotation = EFalse);
       
   470 
       
   471     /**
       
   472      * Deactivate pen ui, but not close the UI.
       
   473      *
       
   474      * @since S60 v4.0
       
   475      * @param aWaitFlag Flag indicates whether operation should be waited until
       
   476      * observer processed.
       
   477      * @return ETrue if operation sucessfully.     
       
   478      */    
       
   479     TBool DeactivatePenUiLayout(TBool aWaitFlag);    
       
   480 
       
   481     /**
       
   482      * Deactivate pen ui, but not close the UI.
       
   483      *
       
   484      * @since S60 v4.0
       
   485      * @param aWaitFlag Flag indicates whether operation should be waited until
       
   486      * observer processed.
       
   487      * @return ETrue if operation sucessfully.     
       
   488      */    
       
   489     TBool DeactivateDimPenUiLayout(TBool aWaitFlag); 
       
   490 
       
   491     /**
       
   492      * Activate pen ui, but not redraw/open the UI.
       
   493      *
       
   494      * @since S60 v4.0
       
   495      * @param aWaitFlag Flag indicates whether operation should be waited until
       
   496      * observer processed.
       
   497      * @return ETrue if operation sucessfully.
       
   498      */    
       
   499     TBool ActivatePenUiLayout(TBool aWaitFlag, TBool aSkipDraw = EFalse);    
       
   500     
       
   501     /**
       
   502      * Create UI layout.
       
   503      *
       
   504      * @since S60 v4.0
       
   505      * @param aMessage The msg data from client
       
   506      * @return KErrNone if layout is created. Otherwise KErrNoLayout.
       
   507      */    
       
   508     TInt CreateLayoutL(const RMessage2& aMessage );
       
   509 
       
   510     /**
       
   511      * Clear the sprite
       
   512      *
       
   513      * @since S60 v4.0
       
   514      */        
       
   515     void ClearSpriteGc();
       
   516     
       
   517     /**
       
   518      * Draw sprite. It will draw the UI layout
       
   519      *
       
   520      * @since S60 v4.0
       
   521      */        
       
   522     void DrawSprite();
       
   523     /**
       
   524      * Get the session represents the foreground application
       
   525      *
       
   526      * @since S60 v4.0
       
   527      * @return The session represents foregound application
       
   528      */
       
   529     //CPeninputServerSession* ForegroundSession();
       
   530     
       
   531     /**
       
   532      * Get IME plugin implementation id list.
       
   533      *
       
   534      * @since S60 v4.0
       
   535      * @param aMessage The msg data from client
       
   536      * @return None.
       
   537      */    
       
   538     void GetImePluginIdListL(const RMessage2& aMessage);
       
   539     
       
   540     /**
       
   541      * Get touch input support language lists.
       
   542      *
       
   543      * @since S60 v4.0
       
   544      * @param aMessage The msg data from client
       
   545      * @return None.
       
   546      */    
       
   547     void GetPenSupportLanguagesL(const RMessage2& aMessage);
       
   548     
       
   549     /**
       
   550      * Set the fore ground ui handler which handles the UI notification.
       
   551      * 
       
   552      * @since S60 v4.0
       
   553      */
       
   554     void SetForeGroundUiHandlerL();
       
   555     
       
   556     /**
       
   557      * Get support input mode
       
   558      * 
       
   559      * @since S60 v4.0
       
   560      */
       
   561     TInt GetSupportModeL();
       
   562 
       
   563 #ifdef RD_TACTILE_FEEDBACK    
       
   564     /**
       
   565      * Add feedback area.
       
   566      * 
       
   567      * @since S60 v4.0
       
   568      * @param aAreaData The area data
       
   569      */    
       
   570     void AddFeedbackArea(const TTactileFeedbackArea& aAreaData);
       
   571     
       
   572     /**
       
   573      * Remove feedback area.
       
   574      * 
       
   575      * @since S60 v4.0
       
   576      * @param aAreaData The area data     
       
   577      */        
       
   578     void RemoveFeedbackArea(const TTactileFeedbackArea& aAreaData);
       
   579     
       
   580     /**
       
   581      * Change feedback area.
       
   582      * 
       
   583      * @since S60 v4.0
       
   584      * @param aAreaData The area data     
       
   585      */        
       
   586     void ChangeFeedbackArea(const TTactileFeedbackArea& aAreaData);
       
   587 
       
   588     /**
       
   589      * Change feedback type.
       
   590      * 
       
   591      * @since S60 v4.0
       
   592      * @param aAreaData The area data     
       
   593      */        
       
   594     void ChangeFeedbackType(const TTactileFeedbackArea& aAreaData);    
       
   595     
       
   596     /**
       
   597      * Find the feedback area.
       
   598      * 
       
   599      * @since S60 v4.0
       
   600      * @param aArea The area data
       
   601      */                    
       
   602     TInt FindFeedbackArea(const TTactileFeedbackArea& aArea);
       
   603     
       
   604     /**
       
   605      * converter event data to feedback area data.
       
   606      * 
       
   607      * @since S60 v4.0
       
   608      * @param aAreaData The area data     
       
   609      */                
       
   610     inline TTactileFeedbackArea FeedbackData(const TDesC& aAreaData)
       
   611         {
       
   612         return *(reinterpret_cast<const TTactileFeedbackArea*>(aAreaData.Ptr()));
       
   613         }
       
   614 #endif // RD_TACTILE_FEEDBACK
       
   615 
       
   616     //bug fix for missing simulated key up event when UI is closed.
       
   617     void RecoverSimulatedKeyEventState(); 
       
   618     
       
   619     void RecoverButtonEventState();       
       
   620 
       
   621     /**
       
   622      * Add a new TUpdateArea to area pool, and make sure if area pool is full,
       
   623      * it's sent to sprite for updating
       
   624      * 
       
   625      * @since S60 v4.0
       
   626      * @param aArea The area data
       
   627      * @return None
       
   628      */
       
   629     void AddFlushArea(const TUpdateArea& aArea);    
       
   630 
       
   631     /**
       
   632      * Make sure if area pool is full, it's sent to sprite for updating
       
   633      * 
       
   634      * @since S60 v4.0
       
   635      * @return None     
       
   636      */
       
   637     void EnsureUpdateBuffer();
       
   638 
       
   639     void DimPenUiWnd(TBool aFlag);
       
   640     
       
   641     void CleanAll();
       
   642     
       
   643     void PackFlushArea();
       
   644 
       
   645     /**
       
   646      * Request to enable or disable window group change event
       
   647      * 
       
   648      * @since S60 v5.0
       
   649      * @param aMonitorFlag ETrue indicates to request events. Default value is ETrue
       
   650      */    
       
   651     void MonitorWsGroupEvent(TBool aMonitorFlag = ETrue);
       
   652 
       
   653     /**
       
   654      * Tests whether two sessions from same process.
       
   655      * 
       
   656      * @since S60 v5.0
       
   657      * @param aSession1 The session to be tested
       
   658      * @param aSession2 The session to be tested
       
   659      * @return ETrue if they are from same process, otherwise, EFalse.
       
   660      */                
       
   661     inline TBool IsSameProcess(CPeninputServerSession* aSession1,
       
   662                                         CPeninputServerSession* aSession2) const;
       
   663     
       
   664     /**
       
   665      * Tests whether a given session is foreground session.
       
   666      * 
       
   667      * @since S60 v5.0
       
   668      * @param aSession The session to be tested
       
   669      * @return ETrue if it's foreground session, otherwise, EFalse.
       
   670      */        
       
   671     inline TBool IsForegroundSession(CPeninputServerSession* aSession) const;
       
   672     
       
   673     /**
       
   674      * Set up the size of drawing device
       
   675      * 
       
   676      * @since S60 v5.0
       
   677      * @param aSize The new size
       
   678      */            
       
   679     void ResizeDrawingDevice(const TSize& aSize);
       
   680     
       
   681     void DimPenUiForMenu(TInt aPriority);
       
   682     void BackgroudDefaultOri( TInt aOri );
       
   683     void DimPenInternalUi(TBool aFlag,TInt aPriority);
       
   684     void DimPenUi();
       
   685     void CheckSessionValidL(CPeninputServerSession* aSession1,
       
   686                             CPeninputServerSession* aSession2) const;
       
   687     
       
   688 public:    
       
   689     TInt DisabledByDSA(); 
       
   690     TInt DisabledByDSAFromAnim();   
       
   691     TInt DisabledByOrientation();
       
   692     
       
   693 private:    // Data
       
   694 
       
   695     /** 
       
   696     /** 
       
   697      * Number of connected client sessions. 
       
   698      */
       
   699     TInt iSessionCount;
       
   700 
       
   701 
       
   702     /** 
       
   703      * Sprite member of iSprite containing bitmap and mask 
       
   704      */
       
   705     TSpriteMember iSpriteMember;
       
   706     
       
   707     /** 
       
   708      * Id of the client thread that activated PENINPUT last 
       
   709      */
       
   710     TInt iForegroundAppId;    
       
   711 
       
   712     /** 
       
   713      * Semaphore that make the key event handling to be critical section
       
   714      */
       
   715     RSemaphore iKeyEventSemaphore;
       
   716     /**
       
   717      * the sprite active flag
       
   718      */
       
   719     TBool iActive ; 
       
   720     
       
   721     /**
       
   722      * Display mode. Defualt value = EColor16MU
       
   723      */
       
   724     TDisplayMode iDispMode;
       
   725     
       
   726     /**
       
   727      * Display mode for mask device. By default it's the same as display mode
       
   728      */
       
   729     TDisplayMode iDispModeForMask;    
       
   730     
       
   731     /**
       
   732      * current layout id
       
   733      */
       
   734     TUid iLayoutId;   
       
   735 
       
   736     /** 
       
   737      * Current sprite size
       
   738      */
       
   739     TSize iSpriteSize;    
       
   740     
       
   741     /** 
       
   742      * Current position of the sprite 
       
   743      */
       
   744     TPoint iSpritePosition;
       
   745     /**
       
   746      * event queue for key response. Pen input server needs send the 
       
   747      * key event response immediately.
       
   748      */    
       
   749     RMsgQueue<TBool> iKeyMsgResponseQueue;
       
   750     
       
   751     /**
       
   752      * The rect to be updated.
       
   753      */
       
   754     TUpdateArea iFlushArea[KMaxRectNumInBuf];
       
   755 
       
   756     /**
       
   757      * Flag tells whether full rect updating needed.
       
   758      */ 
       
   759     TBool iFullUpdate;    
       
   760 
       
   761     /**
       
   762      * Window server animation client id.
       
   763      */    
       
   764     CPeninputServerSession* iForegroundSession;
       
   765 
       
   766     /**
       
   767      * Layout engine
       
   768      * Own
       
   769      */
       
   770     CFepLayoutEngine* iLayoutEng;
       
   771 
       
   772     /**
       
   773      * Current ui layout
       
   774      */
       
   775     MPenUiLayoutBase* iUiLayout;
       
   776     
       
   777     /** 
       
   778      * Bitmap device for sprite 
       
   779      * Own
       
   780      **/
       
   781     CFbsBitmapDevice *iBitmapDevice;
       
   782     /** 
       
   783      * Bitmap device for spite mask 
       
   784      * Own
       
   785      */
       
   786     CFbsBitmapDevice *iMaskBitmapDevice;
       
   787 
       
   788     /** 
       
   789      * Graphics context for sprite 
       
   790      * Own
       
   791      */
       
   792     CFbsBitGc *iSpriteGc; 
       
   793     
       
   794     /** 
       
   795      * Window GC. Used for window based control to draw content.
       
   796      * Own
       
   797      */    
       
   798     CWindowGc* iWindowGc;
       
   799     
       
   800     /** 
       
   801      * Server application GC. It's used to keep the original window GC.
       
   802      * Not Own
       
   803      */    
       
   804     CWindowGc* iAppGc; 
       
   805     
       
   806     /** 
       
   807      * event queue for pointer event
       
   808      */    
       
   809     CEventQueue* iEventBufferQueue;
       
   810         
       
   811     /**
       
   812      * Timer to flush the window session command
       
   813      */
       
   814     CPeriodic* iFlushTimer;   
       
   815     
       
   816     /**
       
   817      * Ptiengine
       
   818      */
       
   819     CPtiEngine* iPtiEngine;
       
   820     
       
   821     /**
       
   822      * Previous ui layout  -- Not used now
       
   823      */
       
   824     //MPenUiLayoutBase* iPrevUiLayout;
       
   825 
       
   826     CPeninputUiLayoutOwner* iLayoutOwner;	    
       
   827     /**
       
   828      * Previous layout id
       
   829      */
       
   830     TUid iPrevLayoutId;   
       
   831     
       
   832     /**
       
   833      * Flag indicating whether layout is active when Hide is called. It's used
       
   834      * to restore the state.
       
   835      */
       
   836     TBool iPrevActive;    
       
   837     /**
       
   838      * Watcher to monitor the screen dynamically changing.
       
   839      */    
       
   840     CAknLayoutChangeWatcher* iHardwareLayoutChangeWatcher;       
       
   841     
       
   842     /**
       
   843      * Watcher to monitor the screen layout changing which is caused by touch pane
       
   844      */        
       
   845     CAknLayoutChangeWatcher* iSoftwareLayoutChangeWatcher; 
       
   846     
       
   847     /**
       
   848      * Foreground UI handler which will handle pen ui activattion/deactivation event.
       
   849      */            
       
   850     CPeninputServerSession* iForegroundUiHandler;
       
   851     
       
   852     /**
       
   853      * Ui handler list. See iForegroundUiHandler.
       
   854      */            
       
   855     RArray<CPeninputServerSession*> iUiHandlerArray;
       
   856     
       
   857     /**
       
   858      * Pen input animation object which managers different animation command
       
   859      */                
       
   860     CPeninputAnimObj* iAnimObj;												
       
   861     
       
   862     /**
       
   863      * Pen UI ready flag.
       
   864      */
       
   865     TInt iUILayoutReady;     
       
   866      
       
   867     /**
       
   868      * Flag tells whether tactile feedback is supported.
       
   869      */     
       
   870     TBool iSupportFeedback;
       
   871     
       
   872 #ifdef RD_TACTILE_FEEDBACK     
       
   873     /**
       
   874      * Array of feedback area 
       
   875      */          
       
   876     RArray<TTactileFeedbackArea> iFeedbackAreaArray;       
       
   877 #endif // RD_TACTILE_FEEDBACK    
       
   878     /**
       
   879      * Record the last key event simulated by pen UI
       
   880      */          
       
   881     TRawEvent iLastSimulatedKeyEvent;
       
   882     
       
   883     /**
       
   884      * The CCoeControl where the pen UI is bitblted.
       
   885      */              
       
   886     CPenUiWndCtrl* iPenUiCtrl;
       
   887     
       
   888     /**
       
   889      * The CCoeControl which acts as the parent of all child controls in the pen UI. 
       
   890      */              
       
   891     CInternalBkCtrl* iInternalBackgroundCtrl; 
       
   892     
       
   893     /**
       
   894      * Flag tells whether pen UI is shown in sprite or CCoeControl 
       
   895      */              
       
   896     TBool iUseWindowCtrl;
       
   897     
       
   898     /**
       
   899      * Flag tells whether current pen UI is opaque. 
       
   900      */              
       
   901     TBool iOpaqueUi;
       
   902 
       
   903     // TUpdateArea count in area pool
       
   904     TInt iCurRectNumInBuf;
       
   905 
       
   906     RArray<TProcessId> iClientProcess;
       
   907     RArray<TInt> iClientLayouts; 
       
   908     TBool iDimmed;
       
   909     /**
       
   910      * Flag tells whether currently app is globle notes app
       
   911      */          
       
   912     TBool iInGlobalNotesApp; 
       
   913     
       
   914     /**
       
   915      * Flag tells whether currently global notes is shown. This is used in Finger UI case, where finger UI is asked 
       
   916      * to dimmed instead of closed when global notes shown.
       
   917      */     
       
   918     TBool iInGlobalEditorState;
       
   919     
       
   920     /**
       
   921      * Record previous active window group which is not global notes. 
       
   922      */             
       
   923     TInt iPreNonGloebalNotesWndGrpId;
       
   924     
       
   925     /**
       
   926      * current global notes app id. 
       
   927      */              
       
   928     TInt iCurGlobalNotesId;
       
   929     
       
   930     /**
       
   931      * Flag tells whether cleanning needed durint destruction to avoid unnecessary clear
       
   932      */         
       
   933     TBool iNoNeedClean; 
       
   934     /**
       
   935      * Focused window group id in current screen
       
   936      */             
       
   937     TInt iCurScreenFocusedWndGrpId; 
       
   938     
       
   939     /**
       
   940      * Flag indicating the layout is being destroyed/
       
   941      */
       
   942     TBool  iDestroyingLayout;
       
   943 
       
   944     /**
       
   945      * Current screen mode
       
   946      */
       
   947     TInt iCurScrMode;    
       
   948     
       
   949     TInt iBackgroudDefaultOri;
       
   950     
       
   951     TBool iInGlobalNotesState;
       
   952     
       
   953     TBool iResourceChange;
       
   954     
       
   955     TRawEvent iLastRawEvent;
       
   956             
       
   957 #ifdef __WINS__
       
   958     TBool iCloseServer;
       
   959 #endif
       
   960 
       
   961 #ifdef __LOG_WNDGROU__ 
       
   962     RFile iLogFile;
       
   963 #endif  
       
   964     CPenInputCrpServiceClient* iCrpService;
       
   965     //TBool iUiLayoutChange;
       
   966     CRepository* iSensorRepository;
       
   967     
       
   968     TInt iInputLanguage;
       
   969     };
       
   970 
       
   971 /**
       
   972  * Class CEventQueue
       
   973  * Event message queue. It's an active object.
       
   974  *
       
   975  * @since S60 v4.0
       
   976  */
       
   977 
       
   978 class CEventQueue : public CActive
       
   979     {
       
   980 public:
       
   981     /** 
       
   982      * factory constructor. 
       
   983      *
       
   984      * @since S60 v4.0
       
   985      * @param aHandler The event handler.
       
   986      * @param aName The event queue global name
       
   987      * @return The created messge queue object
       
   988      */   
       
   989     static CEventQueue* NewL(MRawEventHandler* aHandler,const TDesC& aName);
       
   990     /** 
       
   991      * desstructor. 
       
   992      *
       
   993      * @since S60 v4.0
       
   994      */       
       
   995     ~CEventQueue();
       
   996     
       
   997     /** 
       
   998      * Request event.
       
   999      *
       
  1000      * @since S60 v4.0
       
  1001      */      
       
  1002     void GetEvent();
       
  1003     
       
  1004 protected:
       
  1005     /** 
       
  1006      * 2nd phase constructor.
       
  1007      *
       
  1008      * @since S60 v4.0
       
  1009      * @aName The message queue name
       
  1010      */      
       
  1011      void ConstructL(const TDesC& aName);
       
  1012     /** 
       
  1013      * Default construcotr.
       
  1014      *
       
  1015      * @since S60 v4.0
       
  1016      * @aHandler The event handler
       
  1017      */         
       
  1018     CEventQueue(MRawEventHandler* aHandler);
       
  1019     
       
  1020     //From CActive        
       
  1021     /**
       
  1022      * From CActive
       
  1023      * Called when there is event in the queue
       
  1024      *
       
  1025      * @since S60 v4.0
       
  1026      */
       
  1027     void RunL();
       
  1028 
       
  1029     /**
       
  1030      * From CActive
       
  1031      * will be called if RunL leaves
       
  1032      *
       
  1033      * @since S60 v4.0
       
  1034      * @param aError The error number
       
  1035      */
       
  1036     TInt RunError(TInt aError);
       
  1037 
       
  1038     /**
       
  1039      * From CActive
       
  1040      * will be called when Cancel is issued
       
  1041      *
       
  1042      * @since S60 v4.0
       
  1043      */
       
  1044     void DoCancel();
       
  1045 
       
  1046 private:
       
  1047     /**
       
  1048      * Message buffer queue
       
  1049      */    
       
  1050     RMsgQueue<TRawEventBuffer> iMsgBufQueue;    
       
  1051     
       
  1052     /**
       
  1053      * Event handler
       
  1054      */       
       
  1055     MRawEventHandler* iHandler;
       
  1056     };
       
  1057 
       
  1058 
       
  1059 /**
       
  1060  * CAknLayoutChangeWatcher
       
  1061  * Watcher to monitor the screen dynamical changing.
       
  1062  *
       
  1063  * @since S60 v4.0
       
  1064  */    
       
  1065 class CAknLayoutChangeWatcher : public CActive
       
  1066     {
       
  1067 public:
       
  1068     /** 
       
  1069      * factory constructor. 
       
  1070      *
       
  1071      * @since S60 v4.0
       
  1072      * @param aHandler The event handler.
       
  1073      * @param aKey The property key
       
  1074      * @return The created watcher
       
  1075      */   
       
  1076     static CAknLayoutChangeWatcher* NewL(CPeninputServer* aHandler, TUint aKey);
       
  1077     
       
  1078     /** 
       
  1079      * desstructor. 
       
  1080      *
       
  1081      * @since S60 v4.0
       
  1082      */       
       
  1083     ~CAknLayoutChangeWatcher();
       
  1084     
       
  1085     /** 
       
  1086      * Start monitoring.
       
  1087      *
       
  1088      * @since S60 v4.0
       
  1089      */      
       
  1090     void StartWatching();
       
  1091     
       
  1092 protected:
       
  1093     /** 
       
  1094      * Default construcotr.
       
  1095      *
       
  1096      * @since S60 v4.0
       
  1097      * @aHandler The event handler
       
  1098      */         
       
  1099     CAknLayoutChangeWatcher(CPeninputServer* aHandler,TUint aKey);
       
  1100     
       
  1101     //From CActive        
       
  1102     /**
       
  1103      * From CActive
       
  1104      * Called when there is event in the queue
       
  1105      *
       
  1106      * @since S60 v4.0
       
  1107      */
       
  1108     void RunL();
       
  1109 
       
  1110     /**
       
  1111      * From CActive
       
  1112      * will be called if RunL leaves
       
  1113      *
       
  1114      * @since S60 v4.0
       
  1115      * @param aError The error number
       
  1116      */
       
  1117     TInt RunError(TInt aError);
       
  1118 
       
  1119     /**
       
  1120      * From CActive
       
  1121      * will be called when Cancel is issued
       
  1122      *
       
  1123      * @since S60 v4.0
       
  1124      */
       
  1125     void DoCancel();
       
  1126 
       
  1127 private:
       
  1128     /**
       
  1129      * Event handler. Pen input server shall handle the chaning event.
       
  1130      */       
       
  1131     CPeninputServer* iHandler;
       
  1132     
       
  1133     /**
       
  1134      * The property to be monitored.
       
  1135      */           
       
  1136     RProperty iProperty;
       
  1137 
       
  1138     /**
       
  1139      * The Ui layout state.
       
  1140      */           
       
  1141     TInt iLayoutState;
       
  1142 
       
  1143     /**
       
  1144      * The orientation state.
       
  1145      */           
       
  1146     TInt iOrientationState;
       
  1147     };
       
  1148     
       
  1149 #endif //C_CPENINPUTSERVER_H
       
  1150 
       
  1151 // End of File