textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputlayoutbasecontrol.h
branchRCL_3
changeset 12 5e18d8c489d6
parent 11 c8fb4cf7b3ae
child 13 1bbdde98cc2d
equal deleted inserted replaced
11:c8fb4cf7b3ae 12:5e18d8c489d6
    41 
    41 
    42 #define KDEFAULTBASELINERATIO 3/4
    42 #define KDEFAULTBASELINERATIO 3/4
    43 //base control type
    43 //base control type
    44 typedef TInt64 TControlType;
    44 typedef TInt64 TControlType;
    45 
    45 
       
    46 const TInt KPenInputOwnDeviceChange = -1;
       
    47 const TUint KFepCtrlExtId = 0x00000000;
    46 //UI layout leave code
    48 //UI layout leave code
    47 enum TUiLayoutErrorCode
    49 enum TUiLayoutErrorCode
    48     {
    50     {
    49     EUiLayoutNotReady = -2000,
    51     EUiLayoutNotReady = -2000,
    50     EUiLayoutOwnerNotReady,
    52     EUiLayoutOwnerNotReady,
   198                         public MOnResourceChangFunctions
   200                         public MOnResourceChangFunctions
   199     {
   201     {
   200 friend class CControlGroup;    
   202 friend class CControlGroup;    
   201 friend class CInsertionPoint;
   203 friend class CInsertionPoint;
   202 public:
   204 public:
   203     enum TZOrder
       
   204         {
       
   205         EOrderBackground = 1500, //order for background control
       
   206         EOrderNomal = 1000, //default z-order for control
       
   207         EOrderFront = 500,  // front order for control
       
   208         EOrderTopMost = 0  // for top most control
       
   209         };
       
   210 
       
   211 public:
       
   212     /**
       
   213      * Constructor
       
   214      *
       
   215      * @since S60 V4.0
       
   216      * @param aRect The rectangle area for this control
       
   217      * @param aUiLayout Ui layout who contains this control. Ownership not transferred
       
   218      * @param aControlId control Id
       
   219      */    
       
   220     IMPORT_C CFepUiBaseCtrl(const TRect& aRect,CFepUiLayout* aUiLayout,
       
   221                                                             TInt aControlId);
       
   222 
       
   223     /**
       
   224      * Constructor. Used internally by CControlGroup
       
   225      *
       
   226      * @since S60 V4.0
       
   227      * @param aControl The control to be added. The control must set its extent
       
   228      *                  before added to the layout.
       
   229      * @param aUiLayout Ui layout who contains this control. Ownership not transferred               
       
   230      * @param aOwnership The ownership of the window control. ETrue if it's transfered 
       
   231      * to this control
       
   232      */                                                                    
       
   233      CFepUiBaseCtrl(CCoeControl* aControl, CFepUiLayout* aUiLayout,TBool aOwnership = ETrue);
       
   234                                                             
       
   235     /**
       
   236      * Do base contruction. Allocate event data buffer
       
   237      * Each derived control must call this in its contruction time
       
   238      * 
       
   239      * @since S60 v4.0
       
   240      */
       
   241     IMPORT_C void BaseConstructL();    
       
   242 
       
   243     /**
       
   244      * Destructor.
       
   245      *
       
   246      * @since S60 V4.0        
       
   247      */    
       
   248     IMPORT_C virtual ~CFepUiBaseCtrl();           
       
   249         
       
   250     /**
       
   251      * Pure virtual function, draws the control
       
   252      *
       
   253      * @since S60 V4.0
       
   254      */               
       
   255      IMPORT_C virtual void Draw();
       
   256      
       
   257     /**
       
   258      * Redraws the content in a control
       
   259      *
       
   260      * @since S60 V4.0
       
   261      * @param aRect The rect to be redrawed
       
   262      */               
       
   263      IMPORT_C virtual void ReDrawRect(const TRect& aRect);     
       
   264         
       
   265     /**
       
   266      * Capture or release the pointer. 
       
   267      * After capturing, all UI layout event will be processed by this control
       
   268      *
       
   269      * @since S60 V4.0
       
   270      * @param aFlag The flag indicates capturing or releasing.
       
   271      * @return The control which captures the pointer before.
       
   272      */               
       
   273     IMPORT_C CFepUiBaseCtrl* CapturePointer(TBool aFlag = ETrue);
       
   274 
       
   275     /**
       
   276      * Clear the whole control area
       
   277      *
       
   278      * @since S60 V4.0
       
   279      */        
       
   280     IMPORT_C void Clear();
       
   281    
       
   282     /**
       
   283      * Clear a area in the control
       
   284      *
       
   285      * @since S60 V4.0
       
   286      * @param aRect The rect to be cleared.
       
   287      */                        
       
   288     IMPORT_C void ClearRect(const TRect& aRect);
       
   289 
       
   290     /**
       
   291      * Hide or shoe control. A hiden control will not handle the event.
       
   292      *
       
   293      * @since S60 V4.0
       
   294      * @param aFlag ETrue if want to hide the control.
       
   295      */                                               
       
   296     IMPORT_C virtual void Hide(TBool aFlag);
       
   297 
       
   298     /**
       
   299      * Bring the control to top most in current control group and show it.
       
   300      *
       
   301      * @since S60 V5.0
       
   302      */                                               
       
   303     IMPORT_C void BringToTop();
       
   304 
       
   305     /**
       
   306      * Bring the control to back most in current control group and show it.
       
   307      *
       
   308      * @since S60 V5.0
       
   309      */                                                   
       
   310     IMPORT_C void BringToBack();
       
   311     /*
       
   312      * Set background bitmap
       
   313      *
       
   314      * @since S60 V4.0
       
   315      * @param aBmp The background bitmap. Ownership transferred to control
       
   316      */
       
   317     IMPORT_C virtual void SetBackgroundBitmapL(CFbsBitmap* aBmp);
       
   318     
       
   319     /**
       
   320      * Set background mask bitmap
       
   321      *
       
   322      * @since S60 V4.0
       
   323      * @param aBmp The background bitmap. Ownership transferred to control
       
   324      */
       
   325     IMPORT_C virtual void SetBackgroundMaskBitmapL(CFbsBitmap* aBmp);
       
   326 
       
   327     /**
       
   328      * Check whether this control contains the point
       
   329      *
       
   330      * @since S60 V4.0
       
   331      * @param aPoint The point to be checked
       
   332      * @return ETrue if control valid region contains the point, otherwise EFalse
       
   333      */
       
   334     IMPORT_C virtual TBool Contains(const TPoint& aPt);
       
   335 
       
   336     /**
       
   337      * Set control's rectangle
       
   338      *
       
   339      * @since S60 V4.0
       
   340      * @param aRect The new control area
       
   341      */                                       
       
   342     IMPORT_C virtual void SetRect(const TRect& aRect);
       
   343     
       
   344     /**
       
   345      * Set shadow rect. Shadow rect defines the outside rect of the control.
       
   346      * The shadow is drawn between this rect and control's rect using bitmaps
       
   347      *
       
   348      * @since S60 V4.0
       
   349      * @param aRect The shadow rect. Shadow rect must bigger than control's
       
   350      *        rect, otherwise no effect.
       
   351      */    
       
   352     IMPORT_C void SetShadowRect(const TRect& aRect);        
       
   353 
       
   354     /**
       
   355      * Set shadow rect for a shadow area.
       
   356      * The nth shadow is drawn in this shadow rect
       
   357      *
       
   358      * @since S60 V4.0
       
   359      * @param aRect The shadow rect.
       
   360      * @param aIndex The index position for shadow rect 
       
   361      */        
       
   362     IMPORT_C void SetShadowAreaRect(const TRect& aRect, TShadowBitmapIndex aIndex);
       
   363 
       
   364     /**
       
   365      * Add event obeserver.
       
   366      * The observer will get notified when control event happens.
       
   367      *
       
   368      * @since S60 V4.0
       
   369      * @param aObserver An event obeserver. Ownership not transferred
       
   370      */                                       
       
   371     IMPORT_C void AddEventObserver(MEventObserver* aObserver);
       
   372             
       
   373     /**
       
   374      * Remove event obeserver
       
   375      *
       
   376      * @since S60 V4.0
       
   377      * @param aObserver An event obeserver to be removed.
       
   378      */                                                       
       
   379     IMPORT_C void RemoveEventObserver(MEventObserver* aObserver);
       
   380     
       
   381     /**
       
   382      * Report event to event observer
       
   383      *
       
   384      * @since S60 V4.0
       
   385      * @param aEventType the event type
       
   386      * @param aEventData Event data
       
   387      */
       
   388     IMPORT_C void ReportEvent(TInt aEventType, const TDesC& aEventData = KNullDesC);
       
   389     
       
   390     /**
       
   391      * Update control's valid region when other control hiding or displaying.
       
   392      * This is usually used for HWR window to change it's writing area.
       
   393      *
       
   394      * @since S60 V4.0
       
   395      * @param aCtrl The control whose displaying status changed
       
   396      * @param bFlag ETrue if control is hiden, otherwise EFalse
       
   397      */        
       
   398     IMPORT_C virtual void UpdateValidRegion(CFepUiBaseCtrl* aCtrl,TBool aRemoveFlag);
       
   399     
       
   400     /**
       
   401      * Move conntrol
       
   402      *
       
   403      * @since S60 V4.0
       
   404      * @param aOffset The offset to be moved
       
   405      */                
       
   406     IMPORT_C virtual void Move(const TPoint& aOffset);
       
   407 
       
   408     /**
       
   409      * Set control active
       
   410      *
       
   411      * @since S60 V4.0
       
   412      * @param aFlag The active flag. ETrue if active, otherwise EFalse
       
   413      */                                
       
   414     IMPORT_C virtual void SetActive(TBool aFlag);   
       
   415 
       
   416 
       
   417     /**
       
   418      * Handle pointer down event
       
   419      *
       
   420      * @since S60 V4.0
       
   421      * @param aPoint The point position relative the layout
       
   422      * @return The control which handles the event.
       
   423      */                                        
       
   424     IMPORT_C virtual CFepUiBaseCtrl* HandlePointerDownEventL(const TPoint& aPoint);
       
   425     
       
   426     /**
       
   427      * Handle pointer move event
       
   428      *
       
   429      * @since S60 V4.0
       
   430      * @param aPoint The point position relative the layout
       
   431      * @return The control which handles the event.     
       
   432      */                  
       
   433     IMPORT_C virtual CFepUiBaseCtrl* HandlePointerMoveEventL(const TPoint& aPoint);
       
   434     
       
   435     /**
       
   436      * Handle pointer up event
       
   437      *
       
   438      * @since S60 V4.0
       
   439      * @param aPoint The point position relative the layout
       
   440      * @return The control which handles the event.     
       
   441      */                  
       
   442     IMPORT_C virtual CFepUiBaseCtrl* HandlePointerUpEventL(const TPoint& aPoint);
       
   443            
       
   444     
       
   445     /**
       
   446      * Cancel pointer down event.
       
   447      * This will be called when a control has pointer down but pointer up 
       
   448      * event happens in other ways. If overrided, this base implementation 
       
   449      * must be called in order to report the event.
       
   450      *
       
   451      * @since S60 V4.0
       
   452      * @param aFocusedFlag ETrue if got focused, otherwise EFalse
       
   453      */                                
       
   454     IMPORT_C virtual void CancelPointerDownL();
       
   455     
       
   456     /**
       
   457      * Handle pointer levae event. 
       
   458      * This will be called only when it's got pointer down event before and 
       
   459      * now pointer leaves without pointer up event
       
   460      *
       
   461      * @since S60 V4.0
       
   462      * @param aPoint current pointer position
       
   463      */
       
   464     IMPORT_C virtual void HandlePointerLeave(const TPoint& aPoint);
       
   465     
       
   466     /**
       
   467      * Handle pointer enter event. 
       
   468      * This will be called only when it's got pointer down event before and 
       
   469      * pointer leaves but now comes back without pointer up event.
       
   470      *
       
   471      * @since S60 V4.0
       
   472      * @param aPoint current pointer position     
       
   473      */
       
   474     IMPORT_C virtual void HandlePointerEnter(const TPoint& aPoint);    
       
   475     
       
   476 
       
   477     /**
       
   478      * Register to layout to require updaing control valid region constantly.
       
   479      *
       
   480      * @since S60 v4.0
       
   481      * @param aRequiredFlag Register or deregister. ETrue if register.
       
   482      */        
       
   483     IMPORT_C void RequireRegionUpdateL(TBool aRequiredFlag);
       
   484     
       
   485     /**
       
   486      * Set Tactile Feedback Type
       
   487      * Advanced Tactile feedback REQ417-47932
       
   488      * 
       
   489      * @since S60 v4.0
       
   490      * @param aTactileType.
       
   491      */
       
   492     IMPORT_C void SetTactileFeedbackType(TInt aTactileType);
       
   493     
       
   494     /**
       
   495     * Return control type
       
   496     *
       
   497     * @since S60 V4.0
       
   498     * @return The control type
       
   499     */                               
       
   500     inline TControlType ControlType();
       
   501     
       
   502     /**
       
   503     * Return tactile feedback type
       
   504     *
       
   505     * Advanced Tactile feedback REQ417-47932
       
   506     * @return the tactile feedback type
       
   507     */                               
       
   508     inline TInt TactileFeedbackType() const;
       
   509 
       
   510     
       
   511     /**
       
   512      * Get control Id
       
   513      *
       
   514      * @since S60 V4.0
       
   515      * @return The control id
       
   516      */                                       
       
   517     inline TInt ControlId();
       
   518     
       
   519     /**
       
   520      * Get control size in rect
       
   521      *
       
   522      * @since S60 V4.0
       
   523      * @return The control size in rect
       
   524      */                                      
       
   525     inline const TRect& Rect();    
       
   526         
       
   527     /**
       
   528      * Get valid region. A valid region is that the region responds to pointer.
       
   529      *
       
   530      * @since S60 V4.0
       
   531      * @return The control valid region
       
   532      */
       
   533     inline const RRegion& Region();    
       
   534     /**
       
   535      * Set background color
       
   536      *
       
   537      * @since S60 V4.0
       
   538      * @param aCol Background color to be used
       
   539      */                                       
       
   540     inline void SetBkColor(const TRgb& aCol);
       
   541    
       
   542     /**
       
   543      * Set mask background color
       
   544      *
       
   545      * @since S60 V4.0        
       
   546      * @param aCol The mask back ground color
       
   547      */
       
   548     inline void SetMaskBkCol(const TRgb& aCol);
       
   549    
       
   550     /**
       
   551      * Set pen size
       
   552      *
       
   553      * @since S60 V4.0
       
   554      * @param aSize New pen size
       
   555     */                                       
       
   556     inline void SetPenSize(const TSize& aSize);
       
   557     
       
   558     /**
       
   559      * Get pen size
       
   560      *
       
   561      * @since S60 V4.0
       
   562      * @return Pen size
       
   563      */                
       
   564     inline const TSize& PenSize();        
       
   565   
       
   566     /**
       
   567      * Set pen color
       
   568      *
       
   569      * @since S60 V4.0
       
   570      * @param aCol New pen color    
       
   571      */                                       
       
   572     inline void SetPenColor(const TRgb& aCol) ;
       
   573 
       
   574     /**
       
   575      * Set border size
       
   576      *
       
   577      * @since S60 V4.0
       
   578      * @param aSize New border size
       
   579     */                                       
       
   580     inline void SetBorderSize(const TSize& aSize);
       
   581     
       
   582     /**
       
   583      * Get border size
       
   584      *
       
   585      * @since S60 V4.0
       
   586      * @return Border size
       
   587      */                
       
   588     inline const TSize& BorderSize();    
       
   589  
       
   590     /**
       
   591      * Set pen color
       
   592      *
       
   593      * @since S60 V4.0
       
   594      * @param aCol New border color    
       
   595      */                                       
       
   596     inline void SetBorderColor(const TRgb& aCol) ;
       
   597 
       
   598 
       
   599     /**
       
   600      * Get pen color
       
   601      *
       
   602      * @since S60 V4.0
       
   603      * @return border color    
       
   604      */                                       
       
   605     inline const TRgb& BorderColor() ;
       
   606   
       
   607     /**
       
   608      * Get hide flag
       
   609      *
       
   610      * @since S60 V4.0
       
   611      * @return ETrue if control is hiden, otherwise EFalse
       
   612      */                                              
       
   613     inline TBool Hiden();
       
   614         
       
   615     /**
       
   616      * Get initialization status
       
   617      *
       
   618      * @since S60 V4.0
       
   619      * @return Control initialization status. ETrue if initialized, otherwise EFalse.
       
   620      */
       
   621     inline TBool Ready();
       
   622 
       
   623     /**
       
   624      * set control drawing status. It won't be drawn if not ready
       
   625      *
       
   626      * @since S60 V4.0
       
   627      * @param aReadyFlag The control ready flag
       
   628      */
       
   629     inline void SetReady(TBool aReadyFlag);
       
   630             
       
   631     /**
       
   632      * Test whether the control belongs one kind of control class
       
   633      *
       
   634      * @since S60 V4.0
       
   635      * @param aCtrlClass The control class type
       
   636      * @return ETrue if the control belongs to the class, otherwise EFalse
       
   637      */
       
   638     inline TBool IsKindOfControl(TStockBaseCtrlType aCtrlClass);       
       
   639 
       
   640 
       
   641     /**
       
   642      * Get active status
       
   643      *
       
   644      * @since S60 V4.0
       
   645      * @return active status
       
   646      */    
       
   647     inline TBool IsActive();
       
   648 
       
   649     /**
       
   650      * Set control type
       
   651      *
       
   652      * @since S60 V4.0
       
   653      * @param aCtrlType The control type
       
   654      */        
       
   655     inline void SetControlType(TControlType aCtrlType);
       
   656 
       
   657     /**
       
   658      * get control pointer down status
       
   659      *
       
   660      * @since S60 V4.0
       
   661      * @return The pointer down status. ETrue if has pointer down
       
   662      */    
       
   663     inline TBool PointerDown();
       
   664 
       
   665     /**
       
   666      * change control pointer down status
       
   667      *     
       
   668      * @since S60 V4.0
       
   669      * @param aFlag The pointer down flag.
       
   670      */    
       
   671     inline void SetPointerDown(TBool aFlag);
       
   672    
       
   673     
       
   674     /**
       
   675      * Set control valid region
       
   676      *     
       
   677      * @since S60 V4.0
       
   678      * @param aRegion The new control region
       
   679      */   
       
   680     inline void SetRegion(const RRegion& aRegion);
       
   681     
       
   682     /**
       
   683      * Tell whether it allows other control moving on top of it
       
   684      *
       
   685      * @since S60 V4.0
       
   686      * @return Overlap flag
       
   687      */
       
   688     inline TBool AllowOverlap();
       
   689     
       
   690     /**
       
   691      * Set overlap flag
       
   692      *
       
   693      * @since S60 V4.0
       
   694      * @param aFlag The new overlap falg
       
   695      */
       
   696     inline void SetAllowOverlap(TBool aFlag);
       
   697     
       
   698     
       
   699     // from base class MPositionObserver
       
   700 
       
   701     /**
       
   702      * From MPositionObserver
       
   703      * Handle position change event.
       
   704      * It's called to change the position after it's being dragging 
       
   705      *
       
   706      * @since S60 V4.0
       
   707      * @param aOffset The moving offset
       
   708      * @return The flag whether this observer has processed the event. ETrue if processed.
       
   709      */            
       
   710     IMPORT_C TBool HandlePositionChange(const TPoint& aOffset);
       
   711     
       
   712     /**
       
   713      * From MPositionObserver
       
   714      * Get observer's area to be moved when position changed
       
   715      *
       
   716      * @since S60 V4.0
       
   717      * @return The rect of observer's moving area
       
   718      */            
       
   719     IMPORT_C const TRect& MovingArea();
       
   720     
       
   721     /**
       
   722      * From MPositionObserver
       
   723      * Tell whether this observer is a fep base control
       
   724      *
       
   725      * @since S60 v4.0
       
   726      * @return ETrue if this observer is a control, otherwise, EFalse.
       
   727      */
       
   728     IMPORT_C TBool IsFepBaseControl();   
       
   729 
       
   730     /**
       
   731      * Get shadow rect
       
   732      * @since S60 V4.0
       
   733      * @return control shadow rect
       
   734      */                        
       
   735     inline const TRect& ShadowRect();
       
   736 
       
   737     /**
       
   738      * set control shadow bitmap and mask bmp
       
   739      * @since S60 V4.0
       
   740      * @param The shadow background bitmap. Ownership transferred
       
   741      * @param The shadow background mask bitmap. Ownership transferred
       
   742      * @param aIndex The shadow bitmap position index
       
   743      */   
       
   744     IMPORT_C void SetShadowBmp(CFbsBitmap* aBmp,CFbsBitmap* aMaskBmp,
       
   745                                 TShadowBitmapIndex aIndex);
       
   746     
       
   747     /**
       
   748      * OnActivate. Called when the layout is going to be shown.
       
   749      *
       
   750      * @since S60 v4.0
       
   751      */        
       
   752     IMPORT_C virtual void OnActivate();
       
   753     
       
   754     /**
       
   755      * OnDeActivate. Called when the layout is going to be hidden
       
   756      *
       
   757      * @since S60 v4.0
       
   758      */        
       
   759     IMPORT_C virtual void OnDeActivate();
       
   760     /**
       
   761      * Update layout area, cause screen update. However the updating is buffered until 
       
   762      * refresh timer time out.
       
   763      *
       
   764      * @since S60 V4.0
       
   765      * @param aRect the rect to be flushed in screen
       
   766      * @param aUpdateFlag ETrue if full update.
       
   767      */
       
   768     IMPORT_C void UpdateArea(const TRect& aRect,TBool aUpdateFlag= EFalse); 
       
   769 
       
   770     /**
       
   771      * Update layout area immediately
       
   772      *
       
   773      * @since S60 V4.0
       
   774      * @param aRect the rect to be flushed in screen
       
   775      * @param aUpdateFlag ETrue if full update.
       
   776      */
       
   777     IMPORT_C void UpdateAreaImmed(const TRect& aRect,TBool aUpdateFlag= EFalse); 
       
   778     
       
   779     /**
       
   780      * Get shadow area rect
       
   781      *
       
   782      * @since S60 V4.0
       
   783      * @param aIndex The index for shadow rect
       
   784      */
       
   785     inline TRect ShadowAreaRect(TShadowBitmapIndex aIndex);
       
   786     
       
   787     /**
       
   788      * Call back function when layout starts dragging
       
   789      *
       
   790      * @since S60 V4.0
       
   791      */
       
   792     IMPORT_C virtual void OnLayoutDraggingStart();
       
   793 
       
   794     /**
       
   795      * Call back function when layout ends dragging
       
   796      *
       
   797      * @since S60 V4.0
       
   798      */
       
   799     IMPORT_C virtual void OnLayoutDraggingEnd();
       
   800     
       
   801     /**
       
   802      * Get window based control
       
   803      *
       
   804      * @since S60 V4.0
       
   805      * @return The window based control associated with this control
       
   806      */
       
   807     inline CCoeControl* WndBasedControl();
       
   808     
       
   809     // from base class MOnResourceChangFunctions
       
   810     
       
   811     /**
       
   812      * From MOnResourceChangFunctions
       
   813      * Set resource Id
       
   814      *
       
   815      * @since S60 V4.0
       
   816      * @param aResId The resource id;
       
   817      */                
       
   818     IMPORT_C void SetResourceId(TInt32 aResId);    
       
   819     
       
   820     /**
       
   821      * Get hide flag
       
   822      *
       
   823      * @since S60 V4.0
       
   824      * @return ETrue if all controls are hiden, otherwise EFalse
       
   825      */ 
       
   826     IMPORT_C TBool WholeHiden();
       
   827     
       
   828     /**
       
   829      * From MOnResourceChangFunctions
       
   830      * Construct from resource
       
   831      *
       
   832      * @since S60 V4.0
       
   833      */                
       
   834     IMPORT_C void ConstructFromResourceL();
       
   835     
       
   836     /**
       
   837      * Get resource Id
       
   838      *
       
   839      * @since S60 V4.0
       
   840      * @return The resource id;
       
   841      */                
       
   842     inline TInt32 ResourceId();
       
   843     
       
   844     IMPORT_C void SetParent(CFepUiBaseCtrl* aParent);
       
   845     
       
   846     inline CFepUiBaseCtrl* ParentCtrl();
       
   847     
       
   848     /**
       
   849      * Get the associated CCoeControl control
       
   850      *
       
   851      * @since S60 V5.0
       
   852      * @return The CCoeControl it contains;
       
   853      */                    
       
   854     inline CCoeControl* WndControl();
       
   855     
       
   856     /**
       
   857      * Simulates a internal raw event. The event is handled inside pen input ui,
       
   858      * will not go for window server.
       
   859      *
       
   860      * @since S60 V5.0
       
   861      * @param aPtEvent The simulated raw event
       
   862      */
       
   863     IMPORT_C void SimulateRawEvent(const TRawEvent& aEvent);    
       
   864     
       
   865     IMPORT_C void SetOrdinalPos(TInt aPos);
       
   866     
       
   867     inline TInt OrderPos() const;
       
   868     
       
   869     TInt AbsOrderPos();
       
   870     
       
   871     /**
       
   872      * Check whether this control is on top of another control. If a control is on top of another
       
   873      * it will draw later so it will overwrite the overlapped area.
       
   874      *
       
   875      * @since S60 V5.0
       
   876      * @param aCtrl The compared control
       
   877      * @return ETrue if this control is on top of the specified  one. 
       
   878      */    
       
   879     TBool IsOnTopOf(CFepUiBaseCtrl* aCtrl);
       
   880     
       
   881     /**
       
   882      * Check whether this control has overlapped area with another one
       
   883      *
       
   884      * @since S60 V5.0
       
   885      * @param aCtrl The compared control
       
   886      * @return ETrue if this control has overlapped area with the specified  one. 
       
   887      */        
       
   888     TBool Overlapped(CFepUiBaseCtrl* aCtrl);
       
   889     
       
   890     /**
       
   891      * Compare order pos
       
   892      *
       
   893      * @since S60 V5.0
       
   894      * @return ETrue if this control is on top of the specified one.
       
   895      */                                                   
       
   896     TBool CompareOrder(CFepUiBaseCtrl* aCtrl);
       
   897     
       
   898     
       
   899     /**
       
   900      * Compare order pos for two control within the same control grop
       
   901      *
       
   902      * @since S60 V5.0
       
   903      * @return ETrue if this control is on top of the specified one.
       
   904      */                                                       
       
   905     TBool CompareOrderInSameGroup(CFepUiBaseCtrl* aCtrl);
       
   906     
       
   907     /**
       
   908      * Enable/disable extra response area support
       
   909      * 
       
   910      * @param aEnable ETrue to enable, or EFalse to disable
       
   911      * @param aExtMargin margin of extra response area
       
   912      * @return none
       
   913      */
       
   914     IMPORT_C void EnableExtResponseArea( TBool aEnable, const TRect& aExtMargin );
       
   915     
       
   916     /**
       
   917      * Active extra response area
       
   918      */
       
   919     IMPORT_C void ActiveExtResponseArea();
       
   920     
       
   921     /**
       
   922      * Cancel extra response area
       
   923      */
       
   924     IMPORT_C void CancelExtResponseArea();
       
   925        
       
   926 protected:
       
   927          
       
   928     /**
       
   929      * Draw bitmap to control rect
       
   930      *
       
   931      * @param aBitmap The given bitmap
       
   932      * @param aStretchFlag The flag tells whether this bitmap should be stretched
       
   933      */  	
       
   934 	IMPORT_C void DrawBitmap(const CFbsBitmap* aBitmap,TBool aStretchFlag);    
       
   935      
       
   936     /**
       
   937      * Draw bitmap to control rect
       
   938      *
       
   939      * @param aRect The drawn rect
       
   940      * @param aBitmap The given bitmap
       
   941      * @param aStretchFlag The flag tells whether this bitmap should be stretched
       
   942      */  	
       
   943 	IMPORT_C void DrawBitmap(const TRect aRect, const CFbsBitmap* aBitmap,TBool aStretchFlag);    
       
   944     
       
   945     /**
       
   946      * Get background color
       
   947      *
       
   948      * @since S60 V4.0
       
   949      * @return Background color
       
   950      */                        
       
   951     inline const TRgb& BkColor();
       
   952 
       
   953     /**
       
   954      * get mask background color
       
   955      *
       
   956      * @since S60 V4.0        
       
   957      * @return The mask back ground color
       
   958      */
       
   959     inline const TRgb& MaskBkCol();       
       
   960     
       
   961     /**
       
   962     * Get pen color
       
   963     * @since S60 V4.0
       
   964     * @return Pen colore
       
   965     */                        
       
   966     inline const TRgb& PenColor();
       
   967 
       
   968     /**
       
   969      * Get Ui layout
       
   970      *
       
   971      * @since S60 V4.0
       
   972      * @return The ui layout
       
   973      */        
       
   974     inline CFepUiLayout* UiLayout();  
       
   975     
       
   976     /**
       
   977      * Get ui layout root control
       
   978      *
       
   979      * @since S60 v4.0
       
   980      * @param aPos The new position. 
       
   981      */                        
       
   982     inline CFepUiLayoutRootCtrl* RootControl();        
       
   983     
       
   984     /**
       
   985      * get graphics context for sprite or window
       
   986      * @since S60 V4.0
       
   987      * @return The graphic context
       
   988      */
       
   989     inline CBitmapContext* BitGc();
       
   990 
       
   991     /**
       
   992      * get Bitmap device for sprite or window
       
   993      * @since S60 V4.0
       
   994      * @return The bitmap device
       
   995      */
       
   996     inline CFbsBitmapDevice* BitmapDevice();
       
   997 
       
   998     /**
       
   999      * get Mask bitmap device for sprite or window
       
  1000      * @since S60 V4.0
       
  1001      * @return The mask bitmap device
       
  1002      */
       
  1003     inline CFbsBitmapDevice* MaskBitmapDevice();
       
  1004     
       
  1005     /**
       
  1006      * get control background mask bmp
       
  1007      * @since S60 V4.0
       
  1008      * @return The background mask bitmap
       
  1009      */
       
  1010     inline CFbsBitmap* BkMaskBmp();
       
  1011     
       
  1012     /**
       
  1013      * get control background  bmp
       
  1014      * @since S60 V4.0
       
  1015      * @return The background bitmap
       
  1016      */
       
  1017     inline CFbsBitmap* BackgroundBmp();
       
  1018 
       
  1019     /**
       
  1020      * set control background  bmp
       
  1021      * @since S60 V4.0
       
  1022      * @param The background bitmap to be set. Ownership transferred.
       
  1023      */   
       
  1024     inline void SetBackgroundBmp(CFbsBitmap* aBmp);
       
  1025 
       
  1026     /**
       
  1027      * set control background mask bmp
       
  1028      * @since S60 V4.0
       
  1029      * @param The background mask bitmap to be set. Ownership transferred
       
  1030      */   
       
  1031     inline void SetBackgroundMaskBmp(CFbsBitmap* aBmp);  
       
  1032     /**
       
  1033      * Draw shadow
       
  1034      *
       
  1035      * @since S60 V4.0
       
  1036      */   
       
  1037     IMPORT_C void DrawShadow();
       
  1038     
       
  1039     /**
       
  1040      * Do base contruction. Allocate event data buffer
       
  1041      * Each derived control must call this in its contruction time
       
  1042      * 
       
  1043      * @since S60 v4.0
       
  1044      * @param aRoot The root control.
       
  1045      */
       
  1046     void BaseConstructL(CFepUiLayoutRootCtrl* aRoot);
       
  1047     
       
  1048     /**
       
  1049      * Draw mask background
       
  1050      * 
       
  1051      * @since S60 v4.0
       
  1052      * @param aBmpStretchFlag Flag tells whether the bitmap will be stretched
       
  1053      * to fit the rect. Default value is ETrue.
       
  1054      */    
       
  1055     IMPORT_C void DrawMaskBackground(TBool aBmpStretchFlag = ETrue);
       
  1056     
       
  1057     /**
       
  1058      * Draw opaque mask background. Draw an opaque ground.
       
  1059      * 
       
  1060      * @since S60 v4.0
       
  1061      * @param aBmpStretchFlag Flag tells whether the bitmap will be stretched
       
  1062      * to fit the rect. Default value is ETrue.
       
  1063      */        
       
  1064     IMPORT_C void DrawOpaqueMaskBackground(TBool aBmpStretchFlag = ETrue);
       
  1065     
       
  1066     /**
       
  1067      * Draw opaque mask background. Draw an opaque ground.
       
  1068      * 
       
  1069      * @since S60 v4.0
       
  1070      * @param aBmpStretchFlag Flag tells whether the bitmap will be stretched
       
  1071      * @param aRect Rect to be draw
       
  1072      * to fit the rect. Default value is ETrue.
       
  1073      */        
       
  1074     IMPORT_C void DrawOpaqueMaskBackground(const TRect aRect, TBool aBmpStretchFlag = ETrue);
       
  1075     
       
  1076     /**
       
  1077      * Draw transparent mask background
       
  1078      * 
       
  1079      * @since S60 v4.0
       
  1080      * @param aBmpStretchFlag Flag tells whether the bitmap will be stretched
       
  1081      * to fit the rect. Default value is ETrue.
       
  1082      */           
       
  1083     IMPORT_C void DrawTransparentMaskBackground(const TRect& aRect, TBool aBmpStretchFlag = ETrue);
       
  1084 
       
  1085     /**
       
  1086      * Draw background.
       
  1087      * 
       
  1088      * @since S60 v4.0
       
  1089      * @param aBmpStretchFlag Flag tells whether the bitmap will be stretched
       
  1090      * to fit the rect. Default value is ETrue.
       
  1091      */            
       
  1092     IMPORT_C void DrawBackground(TBool aBmpStretchFlag = ETrue);   
       
  1093 
       
  1094     /**
       
  1095      * Draw background.
       
  1096      * 
       
  1097      * @since S60 v4.0
       
  1098      * @param aBmpStretchFlag Flag tells whether the bitmap will be stretched
       
  1099      * @param aRect Rect to be draw
       
  1100      * to fit the rect. Default value is ETrue.
       
  1101      */            
       
  1102     IMPORT_C void DrawBackground(const TRect aRect,TBool aBmpStretchFlag = ETrue);  
       
  1103         
       
  1104     /**
       
  1105      * Test whether control is able to be drawn. e.g, is ready or shown?
       
  1106      * 
       
  1107      * @since S60 v4.0
       
  1108      * @return ETrue if able to be drawn.
       
  1109      */                
       
  1110 	IMPORT_C TBool AbleToDraw();    
       
  1111 	
       
  1112     /**
       
  1113      * Draw background to device
       
  1114      * 
       
  1115      * @since S60 v4.0
       
  1116      * @param aRect The device rect to be filled.
       
  1117      * @param aDevie The device to be drawn
       
  1118      * @param aBmp The background bmp
       
  1119      * @param aBrushCol The brush color
       
  1120      * @param aPenCol The pen color
       
  1121      * @param aBmpStretchFlag The stretch flag for drawing bitmap.
       
  1122      */  	
       
  1123     void DrawBackgroundToDevice(TRect aRect,CFbsDevice *aDevice, CFbsBitmap* aBmp, 
       
  1124     		const TRgb& aBrushCol, const TRgb& aPenCol,TBool aBmpStretchFlag);
       
  1125 	
       
  1126     /**
       
  1127      * Enable region update
       
  1128      * 
       
  1129      * @since S60 v5.0     
       
  1130      */	
       
  1131     inline void EnableRegionUpdating();
       
  1132     
       
  1133     /**
       
  1134      * Enable region update
       
  1135      * 
       
  1136      * @since S60 v5.0     
       
  1137      */    
       
  1138     inline void DisableRegionUpdating();
       
  1139     
       
  1140     /**
       
  1141      * Get the clip region 
       
  1142      * 
       
  1143      * @since S60 v5.0     
       
  1144      * @return The clip region
       
  1145      */                
       
  1146     IMPORT_C const TRegion& ValidClipRegion(); 
       
  1147     
       
  1148     //From CBase
       
  1149     /**
       
  1150      * Get the extension
       
  1151      *
       
  1152      * @since S60 v5.0
       
  1153      * @param aExtensionId Extension UID
       
  1154      * @param a0 The extension returned
       
  1155      * @param a1 Any passed in parameter.
       
  1156      * @return Operation result. Implementation dependent
       
  1157      */													     
       
  1158     virtual IMPORT_C TInt Extension_(TUint aExtensionId, TAny *&a0, TAny *a1);    
       
  1159     /**
       
  1160      * Handle system resource change
       
  1161      *
       
  1162      * @since S60 V5.0
       
  1163      * @param aType The system resource change type
       
  1164      */
       
  1165     virtual IMPORT_C void HandleResourceChange(TInt aType);
       
  1166 
       
  1167     /**
       
  1168      * Handle pen UI graphic device size change event
       
  1169      *
       
  1170      * @since S60 V5.0
       
  1171      */
       
  1172     virtual IMPORT_C void GraphicDeviceSizeChanged();
       
  1173     
       
  1174     inline void SetHidenFlag(TBool aFlag);
       
  1175 private:
       
  1176     /**
       
  1177      * Draw shadow bitmap
       
  1178      *
       
  1179      * @since S60 V4.0
       
  1180      * @param aRect The rect to be drawn
       
  1181      * @param aIndex The shadow bitmap position index
       
  1182      */   
       
  1183     void DrawShadowBitmap(const TRect& aRect,TInt aIndex);
       
  1184 
       
  1185     /**
       
  1186      * Update extra response area
       
  1187      * 
       
  1188      * @param aRect new response area
       
  1189      * @return none
       
  1190      */
       
  1191     void UpdateExtResponseArea( const TRect& aRect );
       
  1192     
       
  1193 protected:
       
  1194     /**
       
  1195      * Indicate whether the pointer has leaved a control
       
  1196      */    
       
  1197     TBool iPointerLeft;
       
  1198     /**
       
  1199      * Control rect. It's relative to ui layout 
       
  1200      */
       
  1201     TRect iRect;        
       
  1202 
       
  1203     /**
       
  1204      * Control shadow rect. It's relative to ui layout 
       
  1205      */
       
  1206     TRect iShadowRect;        
       
  1207 
       
  1208     /**
       
  1209      * Shadow area rect
       
  1210      */
       
  1211     TRect iShadowAreaRect[KShadowBitmapTotalNum]; 
       
  1212 
       
  1213     /**
       
  1214      * CCoeControl based control
       
  1215      * Own
       
  1216      */ 
       
  1217     CCoeControl* iWndControl;
       
  1218 
       
  1219     /**
       
  1220      * The resource Id associatied with this control
       
  1221      */
       
  1222     TInt32 iResourceId;
       
  1223 
       
  1224     /**
       
  1225      * Control border color
       
  1226      */
       
  1227     TRgb iBorderColor;
       
  1228     
       
  1229     /**
       
  1230      * Control border size
       
  1231      */
       
  1232     TSize iBorderSize;
       
  1233     
       
  1234     /** 
       
  1235      * Valid region which reacts to the pointer event
       
  1236      */
       
  1237     RRegion iValidRegion;   
       
  1238 
       
  1239     /**
       
  1240      * Parent control
       
  1241      * Not own
       
  1242      */
       
  1243     CFepUiBaseCtrl* iParentCtrl;
       
  1244 
       
  1245     /**
       
  1246      * Flag indicates whether rect changed should report to parent
       
  1247      */
       
  1248     TBool iUpdateFlagEnabled;
       
  1249 
       
  1250     /**
       
  1251      * The actual drawing region. so drawing won't happend outside of the region.
       
  1252      */    
       
  1253     RRegion iClipRegion; 
       
  1254     
       
  1255 private:    
       
  1256     /**
       
  1257      * Control id
       
  1258      */
       
  1259     TInt iControlId;
       
  1260     /**
       
  1261      * Control type. 
       
  1262      * User derivated control should starts from EUserCtrlBase
       
  1263      */
       
  1264     TControlType iControlType;
       
  1265 
       
  1266     /**
       
  1267      * Background color
       
  1268      */
       
  1269     TRgb iBackgroundCol;
       
  1270 
       
  1271     /**
       
  1272      * Maks backgroud color
       
  1273      */
       
  1274     TRgb iMaskBkCol;
       
  1275 
       
  1276     /**
       
  1277      * pen size
       
  1278      */
       
  1279     TSize iPenSize;
       
  1280 
       
  1281     /**
       
  1282      * Pen color
       
  1283      */
       
  1284     TRgb iPenColor;
       
  1285 
       
  1286     /**
       
  1287      * Flag indicates whether the control is hiden
       
  1288      */
       
  1289     TBool iHiden;
       
  1290     
       
  1291     /* 
       
  1292      * Event type of current event
       
  1293      */
       
  1294     TEventType iEventType;
       
  1295 
       
  1296     /**
       
  1297      * flag to show whether pen has beed pressed down in this control
       
  1298      */
       
  1299     TBool iPointerDown;
       
  1300     
       
  1301     /**
       
  1302      * flag to indicate whehter this control is ready to drawn
       
  1303      */
       
  1304     TBool iReady;
       
  1305     
       
  1306     
       
  1307     /**
       
  1308      * control active status.
       
  1309      */
       
  1310     TBool iIsActive;    
       
  1311     
       
  1312     /**
       
  1313      * Flag tells whether a draging component can be moved on top of this control
       
  1314      */
       
  1315     TBool iAllowOverlap;
       
  1316     
       
  1317     /** 
       
  1318      * event observer list
       
  1319      */
       
  1320     RPointerArray<MEventObserver> iEventObserverList;               
       
  1321 
       
  1322     //pointer members
       
  1323 
       
  1324     /**
       
  1325      * Background bitmap
       
  1326      * Own.
       
  1327      */
       
  1328     CFbsBitmap* iBackgroundBmp;
       
  1329 
       
  1330     /**
       
  1331      * Background mask bitmap
       
  1332      * Own.
       
  1333      */
       
  1334     CFbsBitmap* iBkMaskBmp;
       
  1335 
       
  1336     /**
       
  1337      * The ui layout which contains this control
       
  1338      * Not own.
       
  1339      */
       
  1340     CFepUiLayout* iUiLayout;
       
  1341     
       
  1342     /** 
       
  1343      * Root control. It's a control group.
       
  1344      * Not Own
       
  1345      */
       
  1346     CFepUiLayoutRootCtrl* iRootCtrl;        
       
  1347     /**
       
  1348      * Shadow bitmaps.
       
  1349      * Own
       
  1350      */ 
       
  1351     CFbsBitmap* iShadowBmp[2*KShadowBitmapTotalNum+1];
       
  1352 
       
  1353     /**
       
  1354      * Layout owner
       
  1355      * Not own
       
  1356      */
       
  1357     MLayoutOwner* iLayoutOwner;
       
  1358     
       
  1359     /**
       
  1360      * Ownership of the window control. If true, it will delete the window control during
       
  1361      * destruction.
       
  1362      */
       
  1363     TBool iOwnWndCtrl;    
       
  1364     
       
  1365     
       
  1366     //When pop up shown, the locked area will be also reduced from control.
       
  1367     RRegion iClipRegionWithoutLockedArea;     
       
  1368     
       
  1369     
       
  1370     TInt iOrdinalPos;
       
  1371 
       
  1372 private:    
       
  1373     NONSHARABLE_CLASS(CFepUiBaseCtrlExtension) : public CBase
   205     NONSHARABLE_CLASS(CFepUiBaseCtrlExtension) : public CBase
  1374         {
   206         {
  1375         public: 
   207         public: 
  1376             
   208             
  1377         CFepUiBaseCtrlExtension();
   209         CFepUiBaseCtrlExtension();
  1387         *
   219         *
  1388         * Advanced Tactile feedback REQ417-47932
   220         * Advanced Tactile feedback REQ417-47932
  1389         * @return the tactile feedback type
   221         * @return the tactile feedback type
  1390         */  
   222         */  
  1391         IMPORT_C TInt TactileFeedbackType();
   223         IMPORT_C TInt TactileFeedbackType();
  1392         public:
   224 public:
  1393             TBool iExtResponseAreaActive;
   225             TBool iExtResponseAreaActive;
  1394             TRect iExtResponseArea;
   226             TRect iExtResponseArea;
  1395             TBool iExtResponseAreaEnabled;
   227             TBool iExtResponseAreaEnabled;
  1396             TRect  iExtResponseAreaMargin;
   228             TRect  iExtResponseAreaMargin;
       
   229                 
       
   230         private:
       
   231         /**
       
   232          * Tactile Feedback type
       
   233          */
       
   234         TInt iTactileType;    
       
   235 
       
   236         public:
       
   237             ~CFepUiBaseCtrlExtension();
       
   238             CFbsBitmap* Bitmap() { return iBitmap;}
       
   239             CFbsBitmap* MaskBitmap() { return iMaskBitmap;}
       
   240             CFbsBitGc* Gc() { return iGc;}
       
   241             CFbsBitmapDevice* BitmapDevice() { return iBitmapDevice;}
       
   242             CFbsBitmapDevice* MaskBitmapDevice() { return iMaskBitmapDevice;}
       
   243 
       
   244             void SetBitmap(CFbsBitmap* aBmp) { iBitmap = aBmp;}
       
   245             void SetGc(CFbsBitGc* aGc) { iGc = aGc;}
       
   246             void SetBmpDevice(CFbsBitmapDevice* aDevice) { iBitmapDevice = aDevice;}
       
   247             void SetMaskBmpDevice(CFbsBitmapDevice* aDevice) { iMaskBitmapDevice = aDevice;}
  1397             
   248             
  1398         private:
   249         private:
  1399             /**
   250             CFbsBitmap* iBitmap; // not own, don't delete
  1400              * Tactile Feedback type
   251             CFbsBitmap* iMaskBitmap; // not own, don't delete
  1401              */
   252             /** 
  1402             TInt iTactileType;
   253              * graphic context
  1403         };    
   254              * Not own
       
   255              */    
       
   256             CFbsBitGc* iGc;
       
   257             CFbsBitmapDevice* iBitmapDevice;
       
   258             CFbsBitmapDevice* iMaskBitmapDevice;
       
   259 friend class CFepUiBaseCtrl;            
       
   260         };
       
   261 		
       
   262 public:
       
   263     enum TZOrder
       
   264         {
       
   265         EOrderBackground = 1500, //order for background control
       
   266         EOrderNomal = 1000, //default z-order for control
       
   267         EOrderFront = 500,  // front order for control
       
   268         EOrderTopMost = 0  // for top most control
       
   269         };
       
   270 
       
   271 public:
       
   272     /**
       
   273      * Constructor
       
   274      *
       
   275      * @since S60 V4.0
       
   276      * @param aRect The rectangle area for this control
       
   277      * @param aUiLayout Ui layout who contains this control. Ownership not transferred
       
   278      * @param aControlId control Id
       
   279      */    
       
   280     IMPORT_C CFepUiBaseCtrl(const TRect& aRect,CFepUiLayout* aUiLayout,
       
   281                                                             TInt aControlId);
       
   282 
       
   283     /**
       
   284      * Constructor. Used internally by CControlGroup
       
   285      *
       
   286      * @since S60 V4.0
       
   287      * @param aControl The control to be added. The control must set its extent
       
   288      *                  before added to the layout.
       
   289      * @param aUiLayout Ui layout who contains this control. Ownership not transferred               
       
   290      * @param aOwnership The ownership of the window control. ETrue if it's transfered 
       
   291      * to this control
       
   292      */                                                                    
       
   293      CFepUiBaseCtrl(CCoeControl* aControl, CFepUiLayout* aUiLayout,TBool aOwnership = ETrue);
       
   294                                                             
       
   295     /**
       
   296      * Do base contruction. Allocate event data buffer
       
   297      * Each derived control must call this in its contruction time
       
   298      * 
       
   299      * @since S60 v4.0
       
   300      */
       
   301     IMPORT_C void BaseConstructL();    
       
   302 
       
   303     /**
       
   304      * Destructor.
       
   305      *
       
   306      * @since S60 V4.0        
       
   307      */    
       
   308     IMPORT_C virtual ~CFepUiBaseCtrl();           
       
   309         
       
   310     /**
       
   311      * Pure virtual function, draws the control
       
   312      *
       
   313      * @since S60 V4.0
       
   314      */               
       
   315      IMPORT_C virtual void Draw();
       
   316      
       
   317     /**
       
   318      * Redraws the content in a control
       
   319      *
       
   320      * @since S60 V4.0
       
   321      * @param aRect The rect to be redrawed
       
   322      */               
       
   323      IMPORT_C virtual void ReDrawRect(const TRect& aRect);     
       
   324         
       
   325     /**
       
   326      * Capture or release the pointer. 
       
   327      * After capturing, all UI layout event will be processed by this control
       
   328      *
       
   329      * @since S60 V4.0
       
   330      * @param aFlag The flag indicates capturing or releasing.
       
   331      * @return The control which captures the pointer before.
       
   332      */               
       
   333     IMPORT_C CFepUiBaseCtrl* CapturePointer(TBool aFlag = ETrue);
       
   334 
       
   335     /**
       
   336      * Clear the whole control area
       
   337      *
       
   338      * @since S60 V4.0
       
   339      */        
       
   340     IMPORT_C void Clear();
       
   341    
       
   342     /**
       
   343      * Clear a area in the control
       
   344      *
       
   345      * @since S60 V4.0
       
   346      * @param aRect The rect to be cleared.
       
   347      */                        
       
   348     IMPORT_C void ClearRect(const TRect& aRect);
       
   349 
       
   350     /**
       
   351      * Hide or shoe control. A hiden control will not handle the event.
       
   352      *
       
   353      * @since S60 V4.0
       
   354      * @param aFlag ETrue if want to hide the control.
       
   355      */                                               
       
   356     IMPORT_C virtual void Hide(TBool aFlag);
       
   357 
       
   358     /**
       
   359      * Bring the control to top most in current control group and show it.
       
   360      *
       
   361      * @since S60 V5.0
       
   362      */                                               
       
   363     IMPORT_C void BringToTop();
       
   364 
       
   365     /**
       
   366      * Bring the control to back most in current control group and show it.
       
   367      *
       
   368      * @since S60 V5.0
       
   369      */                                                   
       
   370     IMPORT_C void BringToBack();
       
   371     /*
       
   372      * Set background bitmap
       
   373      *
       
   374      * @since S60 V4.0
       
   375      * @param aBmp The background bitmap. Ownership transferred to control
       
   376      */
       
   377     IMPORT_C virtual void SetBackgroundBitmapL(CFbsBitmap* aBmp);
       
   378     
       
   379     /**
       
   380      * Set background mask bitmap
       
   381      *
       
   382      * @since S60 V4.0
       
   383      * @param aBmp The background bitmap. Ownership transferred to control
       
   384      */
       
   385     IMPORT_C virtual void SetBackgroundMaskBitmapL(CFbsBitmap* aBmp);
       
   386 
       
   387     /**
       
   388      * Check whether this control contains the point
       
   389      *
       
   390      * @since S60 V4.0
       
   391      * @param aPoint The point to be checked
       
   392      * @return ETrue if control valid region contains the point, otherwise EFalse
       
   393      */
       
   394     IMPORT_C virtual TBool Contains(const TPoint& aPt);
       
   395 
       
   396     /**
       
   397      * Set control's rectangle
       
   398      *
       
   399      * @since S60 V4.0
       
   400      * @param aRect The new control area
       
   401      */                                       
       
   402     IMPORT_C virtual void SetRect(const TRect& aRect);
       
   403     
       
   404     /**
       
   405      * Set shadow rect. Shadow rect defines the outside rect of the control.
       
   406      * The shadow is drawn between this rect and control's rect using bitmaps
       
   407      *
       
   408      * @since S60 V4.0
       
   409      * @param aRect The shadow rect. Shadow rect must bigger than control's
       
   410      *        rect, otherwise no effect.
       
   411      */    
       
   412     IMPORT_C void SetShadowRect(const TRect& aRect);        
       
   413 
       
   414     /**
       
   415      * Set shadow rect for a shadow area.
       
   416      * The nth shadow is drawn in this shadow rect
       
   417      *
       
   418      * @since S60 V4.0
       
   419      * @param aRect The shadow rect.
       
   420      * @param aIndex The index position for shadow rect 
       
   421      */        
       
   422     IMPORT_C void SetShadowAreaRect(const TRect& aRect, TShadowBitmapIndex aIndex);
       
   423 
       
   424     /**
       
   425      * Add event obeserver.
       
   426      * The observer will get notified when control event happens.
       
   427      *
       
   428      * @since S60 V4.0
       
   429      * @param aObserver An event obeserver. Ownership not transferred
       
   430      */                                       
       
   431     IMPORT_C void AddEventObserver(MEventObserver* aObserver);
       
   432             
       
   433     /**
       
   434      * Remove event obeserver
       
   435      *
       
   436      * @since S60 V4.0
       
   437      * @param aObserver An event obeserver to be removed.
       
   438      */                                                       
       
   439     IMPORT_C void RemoveEventObserver(MEventObserver* aObserver);
       
   440     
       
   441     /**
       
   442      * Report event to event observer
       
   443      *
       
   444      * @since S60 V4.0
       
   445      * @param aEventType the event type
       
   446      * @param aEventData Event data
       
   447      */
       
   448     IMPORT_C void ReportEvent(TInt aEventType, const TDesC& aEventData = KNullDesC);
       
   449     
       
   450     /**
       
   451      * Update control's valid region when other control hiding or displaying.
       
   452      * This is usually used for HWR window to change it's writing area.
       
   453      *
       
   454      * @since S60 V4.0
       
   455      * @param aCtrl The control whose displaying status changed
       
   456      * @param bFlag ETrue if control is hiden, otherwise EFalse
       
   457      */        
       
   458     IMPORT_C virtual void UpdateValidRegion(CFepUiBaseCtrl* aCtrl,TBool aRemoveFlag);
       
   459     
       
   460     /**
       
   461      * Move conntrol
       
   462      *
       
   463      * @since S60 V4.0
       
   464      * @param aOffset The offset to be moved
       
   465      */                
       
   466     IMPORT_C virtual void Move(const TPoint& aOffset);
       
   467 
       
   468     /**
       
   469      * Set control active
       
   470      *
       
   471      * @since S60 V4.0
       
   472      * @param aFlag The active flag. ETrue if active, otherwise EFalse
       
   473      */                                
       
   474     IMPORT_C virtual void SetActive(TBool aFlag);   
       
   475 
       
   476 
       
   477     /**
       
   478      * Handle pointer down event
       
   479      *
       
   480      * @since S60 V4.0
       
   481      * @param aPoint The point position relative the layout
       
   482      * @return The control which handles the event.
       
   483      */                                        
       
   484     IMPORT_C virtual CFepUiBaseCtrl* HandlePointerDownEventL(const TPoint& aPoint);
       
   485     
       
   486     /**
       
   487      * Handle pointer move event
       
   488      *
       
   489      * @since S60 V4.0
       
   490      * @param aPoint The point position relative the layout
       
   491      * @return The control which handles the event.     
       
   492      */                  
       
   493     IMPORT_C virtual CFepUiBaseCtrl* HandlePointerMoveEventL(const TPoint& aPoint);
       
   494     
       
   495     /**
       
   496      * Handle pointer up event
       
   497      *
       
   498      * @since S60 V4.0
       
   499      * @param aPoint The point position relative the layout
       
   500      * @return The control which handles the event.     
       
   501      */                  
       
   502     IMPORT_C virtual CFepUiBaseCtrl* HandlePointerUpEventL(const TPoint& aPoint);
       
   503            
       
   504     
       
   505     /**
       
   506      * Cancel pointer down event.
       
   507      * This will be called when a control has pointer down but pointer up 
       
   508      * event happens in other ways. If overrided, this base implementation 
       
   509      * must be called in order to report the event.
       
   510      *
       
   511      * @since S60 V4.0
       
   512      * @param aFocusedFlag ETrue if got focused, otherwise EFalse
       
   513      */                                
       
   514     IMPORT_C virtual void CancelPointerDownL();
       
   515     
       
   516     /**
       
   517      * Handle pointer levae event. 
       
   518      * This will be called only when it's got pointer down event before and 
       
   519      * now pointer leaves without pointer up event
       
   520      *
       
   521      * @since S60 V4.0
       
   522      * @param aPoint current pointer position
       
   523      */
       
   524     IMPORT_C virtual void HandlePointerLeave(const TPoint& aPoint);
       
   525     
       
   526     /**
       
   527      * Handle pointer enter event. 
       
   528      * This will be called only when it's got pointer down event before and 
       
   529      * pointer leaves but now comes back without pointer up event.
       
   530      *
       
   531      * @since S60 V4.0
       
   532      * @param aPoint current pointer position     
       
   533      */
       
   534     IMPORT_C virtual void HandlePointerEnter(const TPoint& aPoint);    
       
   535     
       
   536 
       
   537     /**
       
   538      * Register to layout to require updaing control valid region constantly.
       
   539      *
       
   540      * @since S60 v4.0
       
   541      * @param aRequiredFlag Register or deregister. ETrue if register.
       
   542      */        
       
   543     IMPORT_C void RequireRegionUpdateL(TBool aRequiredFlag);
       
   544     
       
   545     /**
       
   546      * Set Tactile Feedback Type
       
   547      * Advanced Tactile feedback REQ417-47932
       
   548      * 
       
   549      * @since S60 v4.0
       
   550      * @param aTactileType.
       
   551      */
       
   552     IMPORT_C void SetTactileFeedbackType(TInt aTactileType);
       
   553     
       
   554     /**
       
   555     * Return control type
       
   556     *
       
   557     * @since S60 V4.0
       
   558     * @return The control type
       
   559     */                               
       
   560     inline TControlType ControlType();
       
   561     
       
   562     /**
       
   563     * Return tactile feedback type
       
   564     *
       
   565     * Advanced Tactile feedback REQ417-47932
       
   566     * @return the tactile feedback type
       
   567     */                               
       
   568     inline TInt TactileFeedbackType() const;
       
   569 
       
   570     
       
   571     /**
       
   572      * Get control Id
       
   573      *
       
   574      * @since S60 V4.0
       
   575      * @return The control id
       
   576      */                                       
       
   577     inline TInt ControlId();
       
   578     
       
   579     /**
       
   580      * Get control size in rect
       
   581      *
       
   582      * @since S60 V4.0
       
   583      * @return The control size in rect
       
   584      */                                      
       
   585     inline const TRect& Rect();    
       
   586         
       
   587     /**
       
   588      * Get valid region. A valid region is that the region responds to pointer.
       
   589      *
       
   590      * @since S60 V4.0
       
   591      * @return The control valid region
       
   592      */
       
   593     inline const RRegion& Region();    
       
   594     /**
       
   595      * Set background color
       
   596      *
       
   597      * @since S60 V4.0
       
   598      * @param aCol Background color to be used
       
   599      */                                       
       
   600     inline void SetBkColor(const TRgb& aCol);
       
   601    
       
   602     /**
       
   603      * Set mask background color
       
   604      *
       
   605      * @since S60 V4.0        
       
   606      * @param aCol The mask back ground color
       
   607      */
       
   608     inline void SetMaskBkCol(const TRgb& aCol);
       
   609    
       
   610     /**
       
   611      * Set pen size
       
   612      *
       
   613      * @since S60 V4.0
       
   614      * @param aSize New pen size
       
   615     */                                       
       
   616     inline void SetPenSize(const TSize& aSize);
       
   617     
       
   618     /**
       
   619      * Get pen size
       
   620      *
       
   621      * @since S60 V4.0
       
   622      * @return Pen size
       
   623      */                
       
   624     inline const TSize& PenSize();        
       
   625   
       
   626     /**
       
   627      * Set pen color
       
   628      *
       
   629      * @since S60 V4.0
       
   630      * @param aCol New pen color    
       
   631      */                                       
       
   632     inline void SetPenColor(const TRgb& aCol) ;
       
   633 
       
   634     /**
       
   635      * Set border size
       
   636      *
       
   637      * @since S60 V4.0
       
   638      * @param aSize New border size
       
   639     */                                       
       
   640     inline void SetBorderSize(const TSize& aSize);
       
   641     
       
   642     /**
       
   643      * Get border size
       
   644      *
       
   645      * @since S60 V4.0
       
   646      * @return Border size
       
   647      */                
       
   648     inline const TSize& BorderSize();    
       
   649  
       
   650     /**
       
   651      * Set pen color
       
   652      *
       
   653      * @since S60 V4.0
       
   654      * @param aCol New border color    
       
   655      */                                       
       
   656     inline void SetBorderColor(const TRgb& aCol) ;
       
   657 
       
   658 
       
   659     /**
       
   660      * Get pen color
       
   661      *
       
   662      * @since S60 V4.0
       
   663      * @return border color    
       
   664      */                                       
       
   665     inline const TRgb& BorderColor() ;
       
   666   
       
   667     /**
       
   668      * Get hide flag
       
   669      *
       
   670      * @since S60 V4.0
       
   671      * @return ETrue if control is hiden, otherwise EFalse
       
   672      */                                              
       
   673     inline TBool Hiden();
       
   674         
       
   675     /**
       
   676      * Get initialization status
       
   677      *
       
   678      * @since S60 V4.0
       
   679      * @return Control initialization status. ETrue if initialized, otherwise EFalse.
       
   680      */
       
   681     inline TBool Ready();
       
   682 
       
   683     /**
       
   684      * set control drawing status. It won't be drawn if not ready
       
   685      *
       
   686      * @since S60 V4.0
       
   687      * @param aReadyFlag The control ready flag
       
   688      */
       
   689     inline void SetReady(TBool aReadyFlag);
       
   690             
       
   691     /**
       
   692      * Test whether the control belongs one kind of control class
       
   693      *
       
   694      * @since S60 V4.0
       
   695      * @param aCtrlClass The control class type
       
   696      * @return ETrue if the control belongs to the class, otherwise EFalse
       
   697      */
       
   698     inline TBool IsKindOfControl(TStockBaseCtrlType aCtrlClass);       
       
   699 
       
   700 
       
   701     /**
       
   702      * Get active status
       
   703      *
       
   704      * @since S60 V4.0
       
   705      * @return active status
       
   706      */    
       
   707     inline TBool IsActive();
       
   708 
       
   709     /**
       
   710      * Set control type
       
   711      *
       
   712      * @since S60 V4.0
       
   713      * @param aCtrlType The control type
       
   714      */        
       
   715     inline void SetControlType(TControlType aCtrlType);
       
   716 
       
   717     /**
       
   718      * get control pointer down status
       
   719      *
       
   720      * @since S60 V4.0
       
   721      * @return The pointer down status. ETrue if has pointer down
       
   722      */    
       
   723     inline TBool PointerDown();
       
   724 
       
   725     /**
       
   726      * change control pointer down status
       
   727      *     
       
   728      * @since S60 V4.0
       
   729      * @param aFlag The pointer down flag.
       
   730      */    
       
   731     inline void SetPointerDown(TBool aFlag);
       
   732    
       
   733     
       
   734     /**
       
   735      * Set control valid region
       
   736      *     
       
   737      * @since S60 V4.0
       
   738      * @param aRegion The new control region
       
   739      */   
       
   740     inline void SetRegion(const RRegion& aRegion);
       
   741     
       
   742     /**
       
   743      * Tell whether it allows other control moving on top of it
       
   744      *
       
   745      * @since S60 V4.0
       
   746      * @return Overlap flag
       
   747      */
       
   748     inline TBool AllowOverlap();
       
   749     
       
   750     /**
       
   751      * Set overlap flag
       
   752      *
       
   753      * @since S60 V4.0
       
   754      * @param aFlag The new overlap falg
       
   755      */
       
   756     inline void SetAllowOverlap(TBool aFlag);
       
   757     
       
   758     
       
   759     // from base class MPositionObserver
       
   760 
       
   761     /**
       
   762      * From MPositionObserver
       
   763      * Handle position change event.
       
   764      * It's called to change the position after it's being dragging 
       
   765      *
       
   766      * @since S60 V4.0
       
   767      * @param aOffset The moving offset
       
   768      * @return The flag whether this observer has processed the event. ETrue if processed.
       
   769      */            
       
   770     IMPORT_C TBool HandlePositionChange(const TPoint& aOffset);
       
   771     
       
   772     /**
       
   773      * From MPositionObserver
       
   774      * Get observer's area to be moved when position changed
       
   775      *
       
   776      * @since S60 V4.0
       
   777      * @return The rect of observer's moving area
       
   778      */            
       
   779     IMPORT_C const TRect& MovingArea();
       
   780     
       
   781     /**
       
   782      * From MPositionObserver
       
   783      * Tell whether this observer is a fep base control
       
   784      *
       
   785      * @since S60 v4.0
       
   786      * @return ETrue if this observer is a control, otherwise, EFalse.
       
   787      */
       
   788     IMPORT_C TBool IsFepBaseControl();   
       
   789 
       
   790     /**
       
   791      * Get shadow rect
       
   792      * @since S60 V4.0
       
   793      * @return control shadow rect
       
   794      */                        
       
   795     inline const TRect& ShadowRect();
       
   796 
       
   797     /**
       
   798      * set control shadow bitmap and mask bmp
       
   799      * @since S60 V4.0
       
   800      * @param The shadow background bitmap. Ownership transferred
       
   801      * @param The shadow background mask bitmap. Ownership transferred
       
   802      * @param aIndex The shadow bitmap position index
       
   803      */   
       
   804     IMPORT_C void SetShadowBmp(CFbsBitmap* aBmp,CFbsBitmap* aMaskBmp,
       
   805                                 TShadowBitmapIndex aIndex);
       
   806     
       
   807     /**
       
   808      * OnActivate. Called when the layout is going to be shown.
       
   809      *
       
   810      * @since S60 v4.0
       
   811      */        
       
   812     IMPORT_C virtual void OnActivate();
       
   813     
       
   814     /**
       
   815      * OnDeActivate. Called when the layout is going to be hidden
       
   816      *
       
   817      * @since S60 v4.0
       
   818      */        
       
   819     IMPORT_C virtual void OnDeActivate();
       
   820     /**
       
   821      * Update layout area, cause screen update. However the updating is buffered until 
       
   822      * refresh timer time out.
       
   823      *
       
   824      * @since S60 V4.0
       
   825      * @param aRect the rect to be flushed in screen
       
   826      * @param aUpdateFlag ETrue if full update.
       
   827      */
       
   828     IMPORT_C virtual void UpdateArea(const TRect& aRect,TBool aUpdateFlag= EFalse); 
       
   829 
       
   830     /**
       
   831      * Update layout area immediately
       
   832      *
       
   833      * @since S60 V4.0
       
   834      * @param aRect the rect to be flushed in screen
       
   835      * @param aUpdateFlag ETrue if full update.
       
   836      */
       
   837     IMPORT_C void UpdateAreaImmed(const TRect& aRect,TBool aUpdateFlag= EFalse); 
       
   838     
       
   839     /**
       
   840      * Get shadow area rect
       
   841      *
       
   842      * @since S60 V4.0
       
   843      * @param aIndex The index for shadow rect
       
   844      */
       
   845     inline TRect ShadowAreaRect(TShadowBitmapIndex aIndex);
       
   846     
       
   847     /**
       
   848      * Call back function when layout starts dragging
       
   849      *
       
   850      * @since S60 V4.0
       
   851      */
       
   852     IMPORT_C virtual void OnLayoutDraggingStart();
       
   853 
       
   854     /**
       
   855      * Call back function when layout ends dragging
       
   856      *
       
   857      * @since S60 V4.0
       
   858      */
       
   859     IMPORT_C virtual void OnLayoutDraggingEnd();
       
   860     
       
   861     /**
       
   862      * Get window based control
       
   863      *
       
   864      * @since S60 V4.0
       
   865      * @return The window based control associated with this control
       
   866      */
       
   867     inline CCoeControl* WndBasedControl();
       
   868     
       
   869     // from base class MOnResourceChangFunctions
       
   870     
       
   871     /**
       
   872      * From MOnResourceChangFunctions
       
   873      * Set resource Id
       
   874      *
       
   875      * @since S60 V4.0
       
   876      * @param aResId The resource id;
       
   877      */                
       
   878     IMPORT_C void SetResourceId(TInt32 aResId);    
       
   879     
       
   880     /**
       
   881      * Get hide flag
       
   882      *
       
   883      * @since S60 V4.0
       
   884      * @return ETrue if all controls are hiden, otherwise EFalse
       
   885      */ 
       
   886     IMPORT_C TBool WholeHiden();
       
   887     
       
   888     /**
       
   889      * From MOnResourceChangFunctions
       
   890      * Construct from resource
       
   891      *
       
   892      * @since S60 V4.0
       
   893      */                
       
   894     IMPORT_C void ConstructFromResourceL();
       
   895     
       
   896     /**
       
   897      * Get resource Id
       
   898      *
       
   899      * @since S60 V4.0
       
   900      * @return The resource id;
       
   901      */                
       
   902     inline TInt32 ResourceId();
       
   903     
       
   904     IMPORT_C void SetParent(CFepUiBaseCtrl* aParent);
       
   905     
       
   906     inline CFepUiBaseCtrl* ParentCtrl();
       
   907     
       
   908     /**
       
   909      * Get the associated CCoeControl control
       
   910      *
       
   911      * @since S60 V5.0
       
   912      * @return The CCoeControl it contains;
       
   913      */                    
       
   914     inline CCoeControl* WndControl();
       
   915     
       
   916     /**
       
   917      * Simulates a internal raw event. The event is handled inside pen input ui,
       
   918      * will not go for window server.
       
   919      *
       
   920      * @since S60 V5.0
       
   921      * @param aPtEvent The simulated raw event
       
   922      */
       
   923     IMPORT_C void SimulateRawEvent(const TRawEvent& aEvent);    
       
   924     
       
   925     IMPORT_C void SetOrdinalPos(TInt aPos);
       
   926     
       
   927     inline TInt OrderPos() const;
       
   928     
       
   929     TInt AbsOrderPos();
       
   930     
       
   931     /**
       
   932      * Check whether this control is on top of another control. If a control is on top of another
       
   933      * it will draw later so it will overwrite the overlapped area.
       
   934      *
       
   935      * @since S60 V5.0
       
   936      * @param aCtrl The compared control
       
   937      * @return ETrue if this control is on top of the specified  one. 
       
   938      */    
       
   939     TBool IsOnTopOf(CFepUiBaseCtrl* aCtrl);
       
   940     
       
   941     /**
       
   942      * Check whether this control has overlapped area with another one
       
   943      *
       
   944      * @since S60 V5.0
       
   945      * @param aCtrl The compared control
       
   946      * @return ETrue if this control has overlapped area with the specified  one. 
       
   947      */        
       
   948     TBool Overlapped(CFepUiBaseCtrl* aCtrl);
       
   949     
       
   950     /**
       
   951      * Compare order pos
       
   952      *
       
   953      * @since S60 V5.0
       
   954      * @return ETrue if this control is on top of the specified one.
       
   955      */                                                   
       
   956     TBool CompareOrder(CFepUiBaseCtrl* aCtrl);
       
   957     
       
   958     
       
   959     /**
       
   960      * Compare order pos for two control within the same control grop
       
   961      *
       
   962      * @since S60 V5.0
       
   963      * @return ETrue if this control is on top of the specified one.
       
   964      */                                                       
       
   965     TBool CompareOrderInSameGroup(CFepUiBaseCtrl* aCtrl);
       
   966     
       
   967     /**
       
   968      * Enable/disable extra response area support
       
   969      * 
       
   970      * @param aEnable ETrue to enable, or EFalse to disable
       
   971      * @param aExtMargin margin of extra response area
       
   972      * @return none
       
   973      */
       
   974     IMPORT_C void EnableExtResponseArea( TBool aEnable, const TRect& aExtMargin );
       
   975     
       
   976     /**
       
   977      * Active extra response area
       
   978      */
       
   979     IMPORT_C void ActiveExtResponseArea();
       
   980     
       
   981     /**
       
   982      * Cancel extra response area
       
   983      */
       
   984     IMPORT_C void CancelExtResponseArea();
       
   985        
       
   986 protected:
       
   987          
       
   988     /**
       
   989      * Draw bitmap to control rect
       
   990      *
       
   991      * @param aBitmap The given bitmap
       
   992      * @param aStretchFlag The flag tells whether this bitmap should be stretched
       
   993      */  	
       
   994 	IMPORT_C void DrawBitmap(const CFbsBitmap* aBitmap,TBool aStretchFlag);    
       
   995      
       
   996     /**
       
   997      * Draw bitmap to control rect
       
   998      *
       
   999      * @param aRect The drawn rect
       
  1000      * @param aBitmap The given bitmap
       
  1001      * @param aStretchFlag The flag tells whether this bitmap should be stretched
       
  1002      */  	
       
  1003 	IMPORT_C void DrawBitmap(const TRect aRect, const CFbsBitmap* aBitmap,TBool aStretchFlag);    
       
  1004     
       
  1005     /**
       
  1006      * Get background color
       
  1007      *
       
  1008      * @since S60 V4.0
       
  1009      * @return Background color
       
  1010      */                        
       
  1011     inline const TRgb& BkColor();
       
  1012 
       
  1013     /**
       
  1014      * get mask background color
       
  1015      *
       
  1016      * @since S60 V4.0        
       
  1017      * @return The mask back ground color
       
  1018      */
       
  1019     inline const TRgb& MaskBkCol();       
       
  1020     
       
  1021     /**
       
  1022     * Get pen color
       
  1023     * @since S60 V4.0
       
  1024     * @return Pen colore
       
  1025     */                        
       
  1026     inline const TRgb& PenColor();
       
  1027 
       
  1028     /**
       
  1029      * Get Ui layout
       
  1030      *
       
  1031      * @since S60 V4.0
       
  1032      * @return The ui layout
       
  1033      */        
       
  1034     inline CFepUiLayout* UiLayout();  
       
  1035     
       
  1036     /**
       
  1037      * Get ui layout root control
       
  1038      *
       
  1039      * @since S60 v4.0
       
  1040      * @param aPos The new position. 
       
  1041      */                        
       
  1042     inline CFepUiLayoutRootCtrl* RootControl();        
       
  1043     
       
  1044     /**
       
  1045      * get graphics context for sprite or window
       
  1046      * @since S60 V4.0
       
  1047      * @return The graphic context
       
  1048      */
       
  1049     IMPORT_C CBitmapContext* BitGc();
       
  1050 
       
  1051     /**
       
  1052      * get Bitmap device for sprite or window
       
  1053      * @since S60 V4.0
       
  1054      * @return The bitmap device
       
  1055      */
       
  1056     IMPORT_C CFbsBitmapDevice* BitmapDevice();
       
  1057 
       
  1058     /**
       
  1059      * get Mask bitmap device for sprite or window
       
  1060      * @since S60 V4.0
       
  1061      * @return The mask bitmap device
       
  1062      */
       
  1063     IMPORT_C CFbsBitmapDevice* MaskBitmapDevice();
       
  1064     
       
  1065     /**
       
  1066      * get control background mask bmp
       
  1067      * @since S60 V4.0
       
  1068      * @return The background mask bitmap
       
  1069      */
       
  1070     IMPORT_C CFbsBitmap* BkMaskBmp();    
       
  1071     
       
  1072     /**
       
  1073      * get control background  bmp
       
  1074      * @since S60 V4.0
       
  1075      * @return The background bitmap
       
  1076      */
       
  1077     inline CFbsBitmap* BackgroundBmp();
       
  1078 
       
  1079     /**
       
  1080      * set control background  bmp
       
  1081      * @since S60 V4.0
       
  1082      * @param The background bitmap to be set. Ownership transferred.
       
  1083      */   
       
  1084     inline void SetBackgroundBmp(CFbsBitmap* aBmp);
       
  1085 
       
  1086     /**
       
  1087      * set control background mask bmp
       
  1088      * @since S60 V4.0
       
  1089      * @param The background mask bitmap to be set. Ownership transferred
       
  1090      */   
       
  1091     inline void SetBackgroundMaskBmp(CFbsBitmap* aBmp);  
       
  1092     /**
       
  1093      * Draw shadow
       
  1094      *
       
  1095      * @since S60 V4.0
       
  1096      */   
       
  1097     IMPORT_C void DrawShadow();
       
  1098     
       
  1099     /**
       
  1100      * Do base contruction. Allocate event data buffer
       
  1101      * Each derived control must call this in its contruction time
       
  1102      * 
       
  1103      * @since S60 v4.0
       
  1104      * @param aRoot The root control.
       
  1105      */
       
  1106     void BaseConstructL(CFepUiLayoutRootCtrl* aRoot);
       
  1107     
       
  1108     /**
       
  1109      * Draw mask background
       
  1110      * 
       
  1111      * @since S60 v4.0
       
  1112      * @param aBmpStretchFlag Flag tells whether the bitmap will be stretched
       
  1113      * to fit the rect. Default value is ETrue.
       
  1114      */    
       
  1115     IMPORT_C void DrawMaskBackground(TBool aBmpStretchFlag = ETrue);
       
  1116     
       
  1117     /**
       
  1118      * Draw opaque mask background. Draw an opaque ground.
       
  1119      * 
       
  1120      * @since S60 v4.0
       
  1121      * @param aBmpStretchFlag Flag tells whether the bitmap will be stretched
       
  1122      * to fit the rect. Default value is ETrue.
       
  1123      */        
       
  1124     IMPORT_C void DrawOpaqueMaskBackground(TBool aBmpStretchFlag = ETrue);
       
  1125     
       
  1126     /**
       
  1127      * Draw opaque mask background. Draw an opaque ground.
       
  1128      * 
       
  1129      * @since S60 v4.0
       
  1130      * @param aBmpStretchFlag Flag tells whether the bitmap will be stretched
       
  1131      * @param aRect Rect to be draw
       
  1132      * to fit the rect. Default value is ETrue.
       
  1133      */        
       
  1134     IMPORT_C void DrawOpaqueMaskBackground(const TRect aRect, TBool aBmpStretchFlag = ETrue);
       
  1135     
       
  1136     /**
       
  1137      * Draw transparent mask background
       
  1138      * 
       
  1139      * @since S60 v4.0
       
  1140      * @param aBmpStretchFlag Flag tells whether the bitmap will be stretched
       
  1141      * to fit the rect. Default value is ETrue.
       
  1142      */           
       
  1143     IMPORT_C void DrawTransparentMaskBackground(const TRect& aRect, TBool aBmpStretchFlag = ETrue);
       
  1144 
       
  1145     /**
       
  1146      * Draw background.
       
  1147      * 
       
  1148      * @since S60 v4.0
       
  1149      * @param aBmpStretchFlag Flag tells whether the bitmap will be stretched
       
  1150      * to fit the rect. Default value is ETrue.
       
  1151      */            
       
  1152     IMPORT_C void DrawBackground(TBool aBmpStretchFlag = ETrue);   
       
  1153 
       
  1154     /**
       
  1155      * Draw background.
       
  1156      * 
       
  1157      * @since S60 v4.0
       
  1158      * @param aBmpStretchFlag Flag tells whether the bitmap will be stretched
       
  1159      * @param aRect Rect to be draw
       
  1160      * to fit the rect. Default value is ETrue.
       
  1161      */            
       
  1162     IMPORT_C void DrawBackground(const TRect aRect,TBool aBmpStretchFlag = ETrue);  
       
  1163         
       
  1164     /**
       
  1165      * Test whether control is able to be drawn. e.g, is ready or shown?
       
  1166      * 
       
  1167      * @since S60 v4.0
       
  1168      * @return ETrue if able to be drawn.
       
  1169      */                
       
  1170 	IMPORT_C TBool AbleToDraw();    
       
  1171 	
       
  1172     /**
       
  1173      * Draw background to device
       
  1174      * 
       
  1175      * @since S60 v4.0
       
  1176      * @param aRect The device rect to be filled.
       
  1177      * @param aDevie The device to be drawn
       
  1178      * @param aBmp The background bmp
       
  1179      * @param aBrushCol The brush color
       
  1180      * @param aPenCol The pen color
       
  1181      * @param aBmpStretchFlag The stretch flag for drawing bitmap.
       
  1182      */  	
       
  1183     void DrawBackgroundToDevice(TRect aRect,CFbsDevice *aDevice, CFbsBitmap* aBmp, 
       
  1184     		const TRgb& aBrushCol, const TRgb& aPenCol,TBool aBmpStretchFlag);
       
  1185 	
       
  1186     /**
       
  1187      * Enable region update
       
  1188      * 
       
  1189      * @since S60 v5.0     
       
  1190      */	
       
  1191     inline void EnableRegionUpdating();
       
  1192     
       
  1193     /**
       
  1194      * Enable region update
       
  1195      * 
       
  1196      * @since S60 v5.0     
       
  1197      */    
       
  1198     inline void DisableRegionUpdating();
       
  1199     
       
  1200     /**
       
  1201      * Get the clip region 
       
  1202      * 
       
  1203      * @since S60 v5.0     
       
  1204      * @return The clip region
       
  1205      */                
       
  1206     IMPORT_C const TRegion& ValidClipRegion(); 
       
  1207     
       
  1208     //From CBase
       
  1209     /**
       
  1210      * Get the extension
       
  1211      *
       
  1212      * @since S60 v5.0
       
  1213      * @param aExtensionId Extension UID
       
  1214      * @param a0 The extension returned
       
  1215      * @param a1 Any passed in parameter.
       
  1216      * @return Operation result. Implementation dependent
       
  1217      */													     
       
  1218     virtual IMPORT_C TInt Extension_(TUint aExtensionId, TAny *&a0, TAny *a1);    
       
  1219     /**
       
  1220      * Handle system resource change
       
  1221      *
       
  1222      * @since S60 V5.0
       
  1223      * @param aType The system resource change type
       
  1224      */
       
  1225     virtual IMPORT_C void HandleResourceChange(TInt aType);
       
  1226 
       
  1227     /**
       
  1228      * Handle pen UI graphic device size change event
       
  1229      *
       
  1230      * @since S60 V5.0
       
  1231      */
       
  1232     virtual IMPORT_C void GraphicDeviceSizeChanged();
       
  1233     
       
  1234     inline void SetHidenFlag(TBool aFlag);
       
  1235     void CreateOwnDeviceL(CFbsBitmap* aBmp, CFbsBitmap* aMaskBmp = 0);
       
  1236     
       
  1237     void ResizeDeviceL();
  1404 private:
  1238 private:
       
  1239     /**
       
  1240      * Draw shadow bitmap
       
  1241      *
       
  1242      * @since S60 V4.0
       
  1243      * @param aRect The rect to be drawn
       
  1244      * @param aIndex The shadow bitmap position index
       
  1245      */   
       
  1246     void DrawShadowBitmap(const TRect& aRect,TInt aIndex);
       
  1247 
       
  1248     /**
       
  1249      * Update extra response area
       
  1250      * 
       
  1251      * @param aRect new response area
       
  1252      * @return none
       
  1253      */
       
  1254     void UpdateExtResponseArea( const TRect& aRect );
       
  1255     
       
  1256 protected:
       
  1257     /**
       
  1258      * Indicate whether the pointer has leaved a control
       
  1259      */    
       
  1260     TBool iPointerLeft;
       
  1261     /**
       
  1262      * Control rect. It's relative to ui layout 
       
  1263      */
       
  1264     TRect iRect;        
       
  1265 
       
  1266     /**
       
  1267      * Control shadow rect. It's relative to ui layout 
       
  1268      */
       
  1269     TRect iShadowRect;        
       
  1270 
       
  1271     /**
       
  1272      * Shadow area rect
       
  1273      */
       
  1274     TRect iShadowAreaRect[KShadowBitmapTotalNum]; 
       
  1275 
       
  1276     /**
       
  1277      * CCoeControl based control
       
  1278      * Own
       
  1279      */ 
       
  1280     CCoeControl* iWndControl;
       
  1281 
       
  1282     /**
       
  1283      * The resource Id associatied with this control
       
  1284      */
       
  1285     TInt32 iResourceId;
       
  1286 
       
  1287     /**
       
  1288      * Control border color
       
  1289      */
       
  1290     TRgb iBorderColor;
       
  1291     
       
  1292     /**
       
  1293      * Control border size
       
  1294      */
       
  1295     TSize iBorderSize;
       
  1296     
       
  1297     /** 
       
  1298      * Valid region which reacts to the pointer event
       
  1299      */
       
  1300     RRegion iValidRegion;   
       
  1301 
       
  1302     /**
       
  1303      * Parent control
       
  1304      * Not own
       
  1305      */
       
  1306     CFepUiBaseCtrl* iParentCtrl;
       
  1307 
       
  1308     /**
       
  1309      * Flag indicates whether rect changed should report to parent
       
  1310      */
       
  1311     TBool iUpdateFlagEnabled;
       
  1312 
       
  1313     /**
       
  1314      * The actual drawing region. so drawing won't happend outside of the region.
       
  1315      */    
       
  1316     RRegion iClipRegion; 
       
  1317     
       
  1318 private:    
       
  1319     /**
       
  1320      * Control id
       
  1321      */
       
  1322     TInt iControlId;
       
  1323     /**
       
  1324      * Control type. 
       
  1325      * User derivated control should starts from EUserCtrlBase
       
  1326      */
       
  1327     TControlType iControlType;
       
  1328 
       
  1329     /**
       
  1330      * Background color
       
  1331      */
       
  1332     TRgb iBackgroundCol;
       
  1333 
       
  1334     /**
       
  1335      * Maks backgroud color
       
  1336      */
       
  1337     TRgb iMaskBkCol;
       
  1338 
       
  1339     /**
       
  1340      * pen size
       
  1341      */
       
  1342     TSize iPenSize;
       
  1343 
       
  1344     /**
       
  1345      * Pen color
       
  1346      */
       
  1347     TRgb iPenColor;
       
  1348 
       
  1349     /**
       
  1350      * Flag indicates whether the control is hiden
       
  1351      */
       
  1352     TBool iHiden;
       
  1353     
       
  1354     /* 
       
  1355      * Event type of current event
       
  1356      */
       
  1357     TEventType iEventType;
       
  1358 
       
  1359     /**
       
  1360      * flag to show whether pen has beed pressed down in this control
       
  1361      */
       
  1362     TBool iPointerDown;
       
  1363     
       
  1364     /**
       
  1365      * flag to indicate whehter this control is ready to drawn
       
  1366      */
       
  1367     TBool iReady;
       
  1368     
       
  1369     
       
  1370     /**
       
  1371      * control active status.
       
  1372      */
       
  1373     TBool iIsActive;    
       
  1374     
       
  1375     /**
       
  1376      * Flag tells whether a draging component can be moved on top of this control
       
  1377      */
       
  1378     TBool iAllowOverlap;
       
  1379     
       
  1380     /** 
       
  1381      * event observer list
       
  1382      */
       
  1383     RPointerArray<MEventObserver> iEventObserverList;               
       
  1384 
       
  1385     //pointer members
       
  1386 
       
  1387     /**
       
  1388      * Background bitmap
       
  1389      * Own.
       
  1390      */
       
  1391     CFbsBitmap* iBackgroundBmp;
       
  1392 
       
  1393     /**
       
  1394      * Background mask bitmap
       
  1395      * Own.
       
  1396      */
       
  1397     CFbsBitmap* iBkMaskBmp;
       
  1398 
       
  1399     /**
       
  1400      * The ui layout which contains this control
       
  1401      * Not own.
       
  1402      */
       
  1403     CFepUiLayout* iUiLayout;
       
  1404     
       
  1405     /** 
       
  1406      * Root control. It's a control group.
       
  1407      * Not Own
       
  1408      */
       
  1409     CFepUiLayoutRootCtrl* iRootCtrl;        
       
  1410     /**
       
  1411      * Shadow bitmaps.
       
  1412      * Own
       
  1413      */ 
       
  1414     CFbsBitmap* iShadowBmp[2*KShadowBitmapTotalNum+1];
       
  1415 
       
  1416     /**
       
  1417      * Layout owner
       
  1418      * Not own
       
  1419      */
       
  1420     MLayoutOwner* iLayoutOwner;
       
  1421     
       
  1422     /**
       
  1423      * Ownership of the window control. If true, it will delete the window control during
       
  1424      * destruction.
       
  1425      */
       
  1426     TBool iOwnWndCtrl;    
       
  1427     
       
  1428     
       
  1429     //When pop up shown, the locked area will be also reduced from control.
       
  1430     RRegion iClipRegionWithoutLockedArea;     
       
  1431     
       
  1432     
       
  1433     TInt iOrdinalPos;
       
  1434 
       
  1435     //class CFepUiBaseCtrlExtension;
       
  1436 
  1405     /**
  1437     /**
  1406      * Reservered
  1438      * Reservered
  1407      */
  1439      */
  1408     CFepUiBaseCtrlExtension* iExtension;
  1440     CFepUiBaseCtrlExtension* iExtension;
  1409 
  1441