idlehomescreen/xmluirendering/uiengine/inc/xnhittest.h
changeset 0 f72a12da539e
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Class to hold hit region information
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef _XNHITTEST_H
       
    20 #define _XNHITTEST_H
       
    21 
       
    22 // System includes
       
    23 #include <e32base.h>
       
    24 #include <coemain.h>
       
    25 
       
    26 // Forward declarations
       
    27 class CXnControlAdapter;
       
    28 
       
    29 namespace XnHitTest
       
    30     {
       
    31     const TInt EIgnoreEventsUntilNextPointerUp = 0x01;
       
    32     const TInt EIgnoreStylusUpTriggers = 0x02;
       
    33     }
       
    34  
       
    35 // Class declaration
       
    36 
       
    37 /**
       
    38  *  Holds hit region information
       
    39  * 
       
    40  *  @ingroup group_xnlayoutengine
       
    41  *  @lib xn3layoutengine.lib
       
    42  *  @since S60 5.0
       
    43  */    
       
    44 NONSHARABLE_CLASS( CXnHitTest ) : public CBase,
       
    45     public MCoeMessageMonitorObserver
       
    46     {
       
    47 public:
       
    48     // Constructors and destructor
       
    49 
       
    50     /**
       
    51      * Two-phased constructor.
       
    52      */
       
    53     static CXnHitTest* NewL();
       
    54     
       
    55     /**
       
    56      * Two-phased constructor. Leaving on stack
       
    57      */    
       
    58     static CXnHitTest* NewLC();
       
    59 
       
    60     ~CXnHitTest();
       
    61 
       
    62 private:
       
    63     CXnHitTest();
       
    64 
       
    65 private: 
       
    66     // from MCoeMessageMonitorObserver
       
    67     
       
    68     /**
       
    69     * @see MCoeMessageMonitorObserver documentation
       
    70     */
       
    71     void MonitorWsMessage( const TWsEvent& aEvent );
       
    72     
       
    73 public:
       
    74     // New functions
       
    75 
       
    76     /**
       
    77      * Adds a control to hit region.
       
    78      * 
       
    79      * @since S60 5.0
       
    80      * @param aControl The control to be added.
       
    81      */
       
    82     void AddControl( CXnControlAdapter* aControl );
       
    83 
       
    84     /**
       
    85      * Removes a control from hit region.
       
    86      * 
       
    87      * @since S60 5.0
       
    88      * @param aControl The control to be removed.
       
    89      */
       
    90     void RemoveControl( CXnControlAdapter* aControl );
       
    91 
       
    92     /**
       
    93      * Set flags
       
    94      * 
       
    95      * @since S60 5.0
       
    96      * @param aFlags flags to be added
       
    97      */
       
    98     void SetFlags( const TInt aFlags );
       
    99 
       
   100     /**
       
   101      * Clear flags
       
   102      * 
       
   103      * @since S60 5.0
       
   104      * @param aFlags flags to be cleared, 0x0F default 
       
   105      */
       
   106     void ClearFlags( const TInt aFlags = 0x0F );
       
   107 
       
   108     /**
       
   109      * Get flags
       
   110      * 
       
   111      * @since S60 5.0
       
   112      * @return Flags
       
   113      */
       
   114     TInt Flags() const;
       
   115 
       
   116     /**
       
   117      * Flushes hit test state
       
   118      * 
       
   119      * @since S60 5.0	
       
   120      */
       
   121     void Flush();
       
   122 
       
   123     /**
       
   124      * Gets hit region count
       
   125      * 
       
   126      * @since S60 5.0	
       
   127      * @return Count
       
   128      */
       
   129     TInt HitRegionCount() const;
       
   130 
       
   131     /**
       
   132      * Gets hit region
       
   133      * 
       
   134      * @since S60 5.0    
       
   135      * @return Region
       
   136      */
       
   137     CXnControlAdapter* HitRegion() const;
       
   138 
       
   139     /**
       
   140      * Tests whether a pointer event occurred inside the control's hit region.    
       
   141      * 
       
   142      * @since S60 5.0
       
   143      * @param aPointEvent The pointer event.
       
   144      * @param aControl
       
   145      * @return ETrue if the specified point lies inside the hit region, 
       
   146      *         EFalse if not.
       
   147      */
       
   148     TBool HitRegionContainsL( const TPointerEvent& aPointerEvent,
       
   149         const CXnControlAdapter& aControl );
       
   150 
       
   151     /**
       
   152      * Gets the last pointer event
       
   153      * 
       
   154      * @since S60 5.0		
       
   155      * @return Last pointer event 
       
   156      */
       
   157     const TPointerEvent& PointerEvent() const;
       
   158     
       
   159 protected:
       
   160     /**
       
   161      * Two-phased constructor.
       
   162      */
       
   163     void ConstructL();
       
   164 
       
   165 private:
       
   166     // data
       
   167 
       
   168     /** Hit region */
       
   169     RPointerArray< CXnControlAdapter > iHitRegion;
       
   170     /** Pointer event */
       
   171     TPointerEvent iPointerEvent;
       
   172     /** Flags */
       
   173     TInt iFlags;
       
   174     };
       
   175 
       
   176 #endif // _XNHITTEST_H