textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputlayoutlatchbutton.h
changeset 0 eb1f2e154e89
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  header file of latchable button
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_CFEPLAYOUTLATCHBUTTON_H
       
    19 #define C_CFEPLAYOUTLATCHBUTTON_H
       
    20 
       
    21 #include "peninputlayoutbutton.h"
       
    22 /**
       
    23  *  CLatchButton
       
    24  *
       
    25  *  Latchable button base control. It has two states: latched and unlatched
       
    26  *
       
    27  *  @lib feplayoutcontrol.lib
       
    28  *  @since S60 V4.0
       
    29  */
       
    30 class CFepLayoutLatchButton: public CButtonBase
       
    31 	{
       
    32 public: 
       
    33     //constructor and destructor
       
    34     /**
       
    35      * Destructor.        
       
    36      *
       
    37      * @since S60 V4.0        
       
    38      */                  
       
    39     IMPORT_C virtual ~CFepLayoutLatchButton();
       
    40 
       
    41     /**
       
    42      * Factory function.        
       
    43      *
       
    44      * @since S60 V4.0        
       
    45      * @param aRect The rectangle area for this control
       
    46      * @param aUiLayout Ui layout who contains this control.Ownership not transferred
       
    47      * @param aControlId control Id
       
    48      * @return An instance of CButtonBase class        
       
    49      */                               
       
    50     IMPORT_C static CFepLayoutLatchButton* NewL(const TRect& aRect,
       
    51     								CFepUiLayout* aUiLayout,TInt aControlId);
       
    52     								
       
    53     /**
       
    54      * Set bitmap for button latched status
       
    55      *
       
    56      * @since S60 V4.0        
       
    57      * @param aBmp The bitmap for latched button. Ownership transferred to button
       
    58      * @param aMaskBmp The mask bitmap. Ownership transferred to button
       
    59      */
       
    60 	IMPORT_C void SetLatchedBitmap(CFbsBitmap* aBmp,CFbsBitmap* aMaskBmp = NULL);
       
    61 
       
    62     /**
       
    63      * Set bitmap for button unlatched status
       
    64      *
       
    65      * @since S60 V4.0        
       
    66      * @param aBmp The bitmap for unlatched button. Ownership transferred to button
       
    67      * @param aMaskBmp The mask bitmap. Ownership transferred to button
       
    68      */
       
    69 	IMPORT_C void SetUnLatchedBitmap(CFbsBitmap* aBmp,CFbsBitmap* aMaskBmp = NULL);
       
    70 
       
    71     /**
       
    72      * set button latch state
       
    73      *
       
    74      * @since S60 V4.0        
       
    75      */                                                      
       
    76 
       
    77 	inline void SetLatched(TBool aFlag);
       
    78 
       
    79     /**
       
    80      * get button latch state
       
    81      *
       
    82      * @since S60 V4.0        
       
    83      * @return The button latch state
       
    84      */                                                      	
       
    85 	inline TBool Latched();
       
    86 	
       
    87     /**
       
    88      * From CFepUiBaseCtrl
       
    89      * Handle pointer levae event. 
       
    90      * This will be called only when it's got pointer down event before and 
       
    91      * now pointer leaves without pointer up event
       
    92      *
       
    93      * @since S60 V4.0
       
    94      * @param aPoint current pointer position
       
    95      */
       
    96     IMPORT_C void HandlePointerLeave(const TPoint& aPoint);
       
    97     
       
    98     /**
       
    99      * From CFepUiBaseCtrl
       
   100      * Handle pointer enter event. 
       
   101      * This will be called only when it's got pointer down event before and 
       
   102      * pointer leaves but now comes back without pointer up event.
       
   103      *
       
   104      * @since S60 V4.0
       
   105      * @param aPoint current pointer position     
       
   106      */
       
   107     IMPORT_C void HandlePointerEnter(const TPoint& aPoint);            
       
   108 	
       
   109     //from base class CFepUiBaseCtrl
       
   110     /**
       
   111      * From CFepUiBaseCtrl
       
   112      * Draw control
       
   113      *
       
   114      * @since S60 V4.0
       
   115      */                               
       
   116     IMPORT_C virtual void Draw();    	
       
   117 protected:
       
   118     /**
       
   119      * Constructor
       
   120      *
       
   121      * @since S60 V4.0
       
   122      * @param aRect The rectangle area for this control
       
   123      * @param aUiLayout Ui layout who contains this control.Ownership not transferred
       
   124      * @param aControlId control Id
       
   125      */           
       
   126     IMPORT_C CFepLayoutLatchButton(const TRect& aRect,
       
   127     
       
   128     								CFepUiLayout* aUiLayout,TInt aControlId);
       
   129 
       
   130     /**
       
   131      * From CFepUiBaseCtrl
       
   132      * Handle pointer down event
       
   133      *
       
   134      * @since S60 V4.0
       
   135      * @param aPoint The point position relative the layout
       
   136      * @return The control which handles the event.     
       
   137      */                                        
       
   138     IMPORT_C CFepUiBaseCtrl* HandlePointerDownEventL(const TPoint& aPoint);
       
   139     
       
   140     /**
       
   141      * From CButtonBase
       
   142      * Handle pointer up event
       
   143      *
       
   144      * @since S60 V4.0
       
   145      * @param aPoint The point position relative the layout
       
   146      * @return The control which handles the event.     
       
   147      */                  
       
   148     IMPORT_C CFepUiBaseCtrl* HandlePointerUpEventL(const TPoint& aPoint);
       
   149     
       
   150 private:
       
   151     /**
       
   152      * Change latch state when pen up/down
       
   153      *
       
   154      * @since S60 V4.0
       
   155      */                  
       
   156 	void ChangeState();   
       
   157 private:		
       
   158 	//iPressed is not used in CButtonBase, need removed in the future.
       
   159     /**
       
   160      * button latch state
       
   161      * Own.
       
   162      */	
       
   163 	TBool iLatched;
       
   164 	
       
   165     /**
       
   166      * bitmap for latched state
       
   167      * Own.
       
   168      */
       
   169     CFbsBitmap* iLatchedBmp; 
       
   170     
       
   171     /**
       
   172      * mask bitmap for latched state
       
   173      * Own.
       
   174      */
       
   175     CFbsBitmap* iLatchedMaskBmp; 
       
   176     
       
   177     /**
       
   178      * bitmap for unlatched state
       
   179      * Own.
       
   180      */
       
   181     CFbsBitmap* iUnLatchedBmp; 
       
   182     
       
   183     /**
       
   184      * mask bitmap for unlatched state
       
   185      * Own.
       
   186      */
       
   187     CFbsBitmap* iUnLatchedMaskBmp; 		
       
   188     
       
   189     /**
       
   190      * Reserved item1
       
   191      */
       
   192      TInt iReserved1;
       
   193      
       
   194     /**
       
   195      * Reserved item2
       
   196      */
       
   197      TInt iReserved2;	           		
       
   198 	};
       
   199 
       
   200 #include "peninputlayoutlatchbutton.inl"
       
   201 #endif //C_CFEPLAYOUTLATCHBUTTON_H