textinput/peninputarc/inc/pensrvcliinc/peninputanimcommand.h
changeset 0 eb1f2e154e89
child 6 6ceef9a83b1a
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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_CPENINPUTANIM_CMD_H
       
    20 #define C_CPENINPUTANIM_CMD_H
       
    21 #include <e32def.h>
       
    22 #include <e32cmn.h>
       
    23 #include <w32std.h>
       
    24 //pen input animation client
       
    25 class RPeninputAnim;
       
    26 #include "peninputcmdparamext.h"
       
    27 const TInt KMaxNum = 1;
       
    28 /**
       
    29  * Class for handling animation command. This is the base class for all command
       
    30  * 
       
    31  *
       
    32  * @since S60 v4.0
       
    33  */
       
    34 class TAnimCmd  
       
    35 {
       
    36 public:
       
    37     /**
       
    38      * Default constructor. 
       
    39      *
       
    40      * @since S60 v4.0
       
    41      * @param aAnim The animation cliet which executes the command
       
    42      * @param aReayFlag The waiting flag indicats whether this command should be 
       
    43      * executed immediately. Deafult value is ETrue, i.e, execute the command.
       
    44      */    
       
    45     TAnimCmd(RPeninputAnim& aAnim,TBool aReayFlag = ETrue);
       
    46     
       
    47     /**
       
    48      * Set command waiting flag.
       
    49      *
       
    50      * @since S60 v4.0
       
    51      * @param aFlag new waiting flag
       
    52      */            
       
    53     inline void SetReady(TBool aFlag); 
       
    54     
       
    55     /**
       
    56      * Test whether this command is executable now.
       
    57      *
       
    58      * @since S60 v4.0
       
    59      * @return ETrue if command is ready to run
       
    60      */    
       
    61     inline TBool Ready() const;
       
    62     
       
    63     /**
       
    64      * Execute the command
       
    65      *
       
    66      * @since S60 v4.0
       
    67      * @return ETrue if command has been executed successfully.
       
    68      */     
       
    69     virtual TBool ExecuteAnimCommand() const;                
       
    70 protected:
       
    71     /**
       
    72      * animation object which execute the command. Not owned.
       
    73      */       	
       
    74 	RPeninputAnim& iAnim;
       
    75 	/**
       
    76 	 * flags tells whether this command can be execute immediately
       
    77 	 */
       
    78 	TBool iReady; 
       
    79 } ;
       
    80    
       
    81 
       
    82 //class TAnimActivateUiCmd
       
    83 /**
       
    84  * Class for handling animation activation/deactivation command. 
       
    85  * 
       
    86  *
       
    87  * @since S60 v4.0
       
    88  */
       
    89 class TAnimActivateUiCmd : public TAnimCmd
       
    90 	{
       
    91 public:
       
    92     /**
       
    93      * Default constructor. 
       
    94      *
       
    95      * @since S60 v4.0
       
    96      * @param aAnim The animation cliet which executes the command     
       
    97      * @param aUiFlag The UI activation flag
       
    98      * @param aReadyFlag indicates whether this command is ready. Default value is false
       
    99      */   
       
   100 	TAnimActivateUiCmd(RPeninputAnim& aAnim,TBool aUiFlag,TBool aReadyFlag = EFalse);
       
   101 	
       
   102 	/**
       
   103      * Execute the command
       
   104      *
       
   105      * @since S60 v4.0
       
   106 	 * @return ETrue if command has been executed successfully.     
       
   107      */     
       
   108     virtual TBool ExecuteAnimCommand() const;
       
   109 
       
   110 private:
       
   111 	/**
       
   112 	 * The activation flag.
       
   113 	 */
       
   114 	TBool iActiveFlag;		
       
   115 	};
       
   116 	
       
   117 
       
   118 /**
       
   119  * Class for handling changing animation sprite size command. 
       
   120  * 
       
   121  *
       
   122  * @since S60 v4.0
       
   123  */	
       
   124 class TAnimChangeSizeCmd : public TAnimCmd
       
   125 	{
       
   126 public:
       
   127     /**
       
   128      * Default constructor. 
       
   129      *
       
   130      * @since S60 v4.0
       
   131      * @param aAnim The animation cliet which executes the command     
       
   132      * @param aSize The new sprite size
       
   133      */   
       
   134 	TAnimChangeSizeCmd(RPeninputAnim& aAnim,const TSize& aSize);
       
   135 	/**
       
   136      * Execute the command
       
   137      *
       
   138      * @since S60 v4.0
       
   139 	 * @return ETrue if command has been executed successfully.          
       
   140      */     
       
   141  	virtual TBool ExecuteAnimCommand() const;
       
   142 
       
   143 private:
       
   144 	/**
       
   145 	 * sprite new size
       
   146 	 */
       
   147 	TSize iSize;		
       
   148 	};
       
   149 	
       
   150 /**
       
   151  * Class for handling set animation sprite position command. 
       
   152  * 
       
   153  *
       
   154  * @since S60 v4.0
       
   155  */		
       
   156 class TAnimSetPosCmd : public TAnimCmd
       
   157 	{
       
   158 public:
       
   159     /**
       
   160      * Default constructor. 
       
   161      *
       
   162      * @since S60 v4.0
       
   163      * @param aAnim The animation cliet which executes the command          
       
   164      * @param aPt The new position
       
   165      */   
       
   166 	TAnimSetPosCmd(RPeninputAnim& aAnim,const TPoint& aPt);
       
   167 	
       
   168 	/**
       
   169 	 * Execute the command
       
   170 	 *
       
   171 	 * @since S60 v4.0
       
   172 	 * @return ETrue if command has been executed successfully.     	 
       
   173 	 */     
       
   174 	virtual TBool ExecuteAnimCommand() const;
       
   175 
       
   176 private:
       
   177 	/**
       
   178 	 * The new sprite position
       
   179 	 */
       
   180 	TPoint iPos;		
       
   181 	};
       
   182 
       
   183 /**
       
   184  * Class for handling change animation sprite display mode command. 
       
   185  * 
       
   186  *
       
   187  * @since S60 v4.0
       
   188  */		
       
   189 class TAnimChangeDispModeCmd : public TAnimCmd
       
   190 	{
       
   191 public:
       
   192     /**
       
   193      * Default constructor. 
       
   194      *
       
   195      * @since S60 v4.0
       
   196      * @param aAnim The animation cliet which executes the command          
       
   197      * @param aSprite The sprite which needs to be changed.
       
   198      * @param aMember The sprite member to be changed.
       
   199      */   
       
   200 	TAnimChangeDispModeCmd(RPeninputAnim& aAnim,
       
   201 							RWsSprite& aSprite,TSpriteMember& aMember);
       
   202 	/**
       
   203 	 * Execute the command
       
   204 	 *
       
   205 	 * @since S60 v4.0
       
   206 	 * @return ETrue if command has been executed successfully.     	 
       
   207 	 */     
       
   208 	virtual TBool ExecuteAnimCommand() const;
       
   209 
       
   210 private:
       
   211 	/**
       
   212 	 * The sprite to be changed.
       
   213 	 */
       
   214 	RWsSprite& iSprite;
       
   215 	
       
   216 	/**
       
   217 	 * The sprite member to be changed.
       
   218 	 */	
       
   219 	TSpriteMember& iSpriteMember;		
       
   220 };
       
   221 	
       
   222 	
       
   223 /**
       
   224  * Class for handling update animation sprite command. 
       
   225  * 
       
   226  *
       
   227  * @since S60 v4.0
       
   228  */		    
       
   229 class TAnimUpdateUiRectCmd : public TAnimCmd
       
   230 	{
       
   231 public:
       
   232     /**
       
   233      * Default constructor. 
       
   234      *
       
   235      * @since S60 v4.0
       
   236      * @param aAnim The animation cliet which executes the command          
       
   237      * @param aRect The rect to be updated
       
   238      * @param aFullFlag Flag indicates whether full sprite should be updated. 
       
   239      */   
       
   240 	TAnimUpdateUiRectCmd(RPeninputAnim& aAnim,
       
   241 									const TRect& aRect,TBool aFullFlag);
       
   242 	
       
   243     /**
       
   244      *
       
   245      * @since S60 v4.0
       
   246      * @param aAnim The animation client which executes the command
       
   247      * @param aArea* The pointer point to 1st TUpdateArea that need to be udpated
       
   248      * @param aNum The count of TUpdateArea that need to be updated
       
   249      */   
       
   250     TAnimUpdateUiRectCmd(RPeninputAnim& aAnim, TUpdateArea *aArea, TInt aNum);
       
   251 
       
   252     /**
       
   253      * Destructor. 
       
   254      *
       
   255      * @since S60 v4.0
       
   256      */   
       
   257     ~TAnimUpdateUiRectCmd();
       
   258 
       
   259     /**
       
   260      * Execute the command
       
   261      *
       
   262      * @since S60 v4.0
       
   263 	   * @return ETrue if command has been executed successfully.          
       
   264      */     
       
   265     virtual TBool ExecuteAnimCommand() const;
       
   266 
       
   267 private:
       
   268 	  /**
       
   269 	   * The rect to be updated
       
   270 	   */
       
   271 	  mutable RArray<TUpdateArea> iArea;
       
   272 	/**
       
   273 	 * The flag for full sprite updating. iRect is ignored if this flag is true
       
   274 	 */
       
   275 	TBool iFullUpdateFlag;		
       
   276 	
       
   277 	TInt iRectNum;
       
   278 	};
       
   279 	
       
   280 /**
       
   281  * Class for handling capture pointer command. 
       
   282  * 
       
   283  *
       
   284  * @since S60 v4.0
       
   285  */			
       
   286 class TAnimCapturePtCmd : public TAnimCmd
       
   287 	{
       
   288 public:
       
   289     /**
       
   290      * Default constructor. 
       
   291      *
       
   292      * @since S60 v4.0
       
   293      * @param aAnim The animation cliet which executes the command          
       
   294      * @param aFlag flag indicates capturing or releasing the point capture
       
   295      */   
       
   296 	TAnimCapturePtCmd(RPeninputAnim& aAnim,TBool aFlag, TInt aCaptureCtrlID);
       
   297 	/**
       
   298      * Execute the command
       
   299      *
       
   300      * @since S60 v4.0
       
   301 	 * @return ETrue if command has been executed successfully.          
       
   302      */     
       
   303     virtual TBool ExecuteAnimCommand() const;
       
   304 
       
   305 private:
       
   306 	/**
       
   307 	 * The capture flag
       
   308 	 */
       
   309 	TBool iCaptureFlag;		
       
   310 	
       
   311 	TInt iCaptureCtrlID;
       
   312 	};	
       
   313 	
       
   314 /**
       
   315  * Class for handling ignoring simuated event command. 
       
   316  * 
       
   317  *
       
   318  * @since S60 v4.0
       
   319  */			
       
   320 class TAnimSimulateEventCmd : public TAnimCmd
       
   321 	{
       
   322 public:
       
   323     /**
       
   324      * Default constructor. 
       
   325      *
       
   326      * @since S60 v4.0
       
   327      * @param aAnim The animation cliet which executes the command          
       
   328      * @param aFlag The flag
       
   329      */   
       
   330 	TAnimSimulateEventCmd(RPeninputAnim& aAnim,const TRawEvent& aEvent);
       
   331 	
       
   332 	/**
       
   333      * Execute the command
       
   334      *
       
   335      * @since S60 v4.0
       
   336 	 * @return ETrue if command has been executed successfully.          
       
   337      */     
       
   338     virtual TBool ExecuteAnimCommand() const;
       
   339 
       
   340 private:
       
   341 	/**
       
   342 	 * Event to be simulated. 
       
   343 	 */
       
   344 	TRawEvent iEvent; 
       
   345 	};			
       
   346 	
       
   347 /**
       
   348  * Class for handling flush ws session command. 
       
   349  * 
       
   350  *
       
   351  * @since S60 v4.0
       
   352  */			
       
   353 class TAnimFlushWsSessionCmd : public TAnimCmd
       
   354 	{
       
   355 public:		
       
   356     /**
       
   357      * Default constructor. 
       
   358      *
       
   359      * @since S60 v4.0
       
   360      * @param aAnim The animation cliet which executes the command          
       
   361      * @aWs The session to be flushed
       
   362      */   
       
   363 	TAnimFlushWsSessionCmd(RPeninputAnim& aAnim,RWsSession& aWs);
       
   364 	
       
   365 	/**
       
   366      * Execute the command
       
   367      *
       
   368      * @since S60 v4.0
       
   369 	 * @return ETrue if command has been executed successfully.          
       
   370      */     
       
   371     virtual TBool ExecuteAnimCommand() const;
       
   372 
       
   373 private:
       
   374 	/**
       
   375 	 * The window session.
       
   376 	 */
       
   377 	RWsSession& iWs;		
       
   378 	};			
       
   379 
       
   380 #ifdef RD_TACTILE_FEEDBACK
       
   381 //class TAnimFeedbackAreaCmd
       
   382 /**
       
   383  * Class for handling register/de-register feedback area command
       
   384  * 
       
   385  *
       
   386  * @since S60 v4.0
       
   387  */
       
   388  
       
   389 class TAnimFeedbackAreaCmd : public TAnimCmd
       
   390 	{
       
   391 public:
       
   392     enum TFeedbackAreaOpEnum
       
   393         {
       
   394         TFeedbackAreaOpAdd,
       
   395         TFeedbackAreaOpRemove,
       
   396         TFeedbackAreaOpChange,
       
   397         TFeedbackTypeOpChange
       
   398         };
       
   399 
       
   400 public:
       
   401     /**
       
   402      * Default constructor. 
       
   403      *
       
   404      * @since S60 v4.0
       
   405      * @param aAnim The animation cliet which executes the command     
       
   406      * @param aArea The feedback area data
       
   407      * @param aOp command op tells whether register or deregister area.
       
   408      * @param aReplyFlag Flag tells how the command sent to server.
       
   409      */   
       
   410 	  TAnimFeedbackAreaCmd(RPeninputAnim& aAnim,
       
   411 	                       const TTactileFeedbackArea& aArea,
       
   412 	                       TFeedbackAreaOpEnum aOp,
       
   413 	                       TBool aReplyFlag);
       
   414 
       
   415     /**
       
   416      * The constructor is not open yet. 
       
   417      *  constructor. 
       
   418      *
       
   419      * @since S60 v4.0
       
   420      * @param aAnim The animation cliet which executes the command     
       
   421      * @param aArea The feedback area data
       
   422      * @param aOp command op tells whether register or deregister area.
       
   423      * @param aReplyFlag Flag tells how the command sent to server.     
       
   424      */   
       
   425      /*TAnimFeedbackAreaCmd(RPeninputAnim& aAnim,
       
   426 	                    const RArray<TTactileFeedbackArea>& aArea,
       
   427 	                       TFeedbackAreaOpEnum aOp,
       
   428 	                       TBool aReplyFlag);*/
       
   429 
       
   430 	/**
       
   431      * Execute the command
       
   432      *
       
   433      * @since S60 v4.0
       
   434 	 * @return ETrue if command has been executed successfully.     
       
   435      */     
       
   436     virtual TBool ExecuteAnimCommand() const;
       
   437 
       
   438 private:
       
   439 	/**
       
   440 	 * The feedback area list.
       
   441 	 */
       
   442     TTactileFeedbackArea	iFeedbackAreaArray[KMaxNum];
       
   443 	
       
   444 	/**
       
   445 	 * count of the area.
       
   446 	 */	
       
   447     TInt iAreaCount;	
       
   448 	
       
   449 	/**
       
   450 	 * command op tells whether register or deregister area.
       
   451 	 */
       
   452 	TFeedbackAreaOpEnum iCmdOp;
       
   453 	
       
   454 	/**
       
   455 	 * Flags tells whether this command is send by Command or CommandReply.
       
   456 	 */	
       
   457 	TBool iCmdReplyFlag;
       
   458 	};
       
   459 #endif // RD_TACTILE_FEEDBACK
       
   460 	
       
   461 class TAnimEnableSpriteCmd :  public TAnimCmd
       
   462     {
       
   463 public:
       
   464     TAnimEnableSpriteCmd(RPeninputAnim& aAnim,TBool aFlag);
       
   465 	/**
       
   466      * Execute the command
       
   467      *
       
   468      * @since S60 v4.0
       
   469 	 * @return ETrue if command has been executed successfully.     
       
   470      */     
       
   471     virtual TBool ExecuteAnimCommand() const;
       
   472 private:
       
   473     TBool iSpriteFlag;    
       
   474     };
       
   475 	
       
   476 #include "peninputanimcommand.inl"
       
   477 	
       
   478 #endif //C_CPENINPUTANIM_CMD_H
       
   479 
       
   480 
       
   481