uiacceltk/hitchcock/coretoolkit/src/HuiEvent.cpp
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "uiacceltk/HuiEvent.h"  // Class definition
       
    21 
       
    22 
       
    23 THuiEvent::THuiEvent(CHuiDisplay* aDisplay, TType aType)
       
    24         : iDisplay(aDisplay),
       
    25           iCode(EEventNull),
       
    26           iParam( KErrNotFound),
       
    27           iType(aType),
       
    28           iVisual(0)
       
    29     {
       
    30     }
       
    31 
       
    32 
       
    33 EXPORT_C THuiEvent::THuiEvent(TInt aCustomParam)
       
    34         : iDisplay(0),
       
    35           iCode(EEventNull),
       
    36           iParam(aCustomParam),
       
    37           iType(ETypeCustom),
       
    38           iVisual(0)
       
    39     {
       
    40     }
       
    41 
       
    42 
       
    43 EXPORT_C THuiEvent::THuiEvent(CHuiDisplay* aDisplay, const TPointerEvent& aPointerEvent)
       
    44         : iDisplay(aDisplay),
       
    45           iCode(EEventNull),         
       
    46           iParam( KErrNotFound),
       
    47           iType(ETypePointer),
       
    48           iVisual(0)          
       
    49     {        
       
    50     if ( aPointerEvent.iModifiers &EModifierAdvancedPointerEvent )
       
    51         {
       
    52         iPointerEvent = *aPointerEvent.AdvancedPointerEvent();
       
    53         }
       
    54     else
       
    55         {
       
    56         iPointerEvent.iType=aPointerEvent.iType;       
       
    57         iPointerEvent.iPosition=aPointerEvent.iPosition;
       
    58         iPointerEvent.iParentPosition=aPointerEvent.iParentPosition;
       
    59         }
       
    60     }
       
    61 
       
    62 
       
    63 THuiEvent::THuiEvent(CHuiDisplay* aDisplay,
       
    64                      const TKeyEvent& aKeyEvent,
       
    65                      TEventCode aType)
       
    66         : iDisplay(aDisplay),
       
    67           iCode(aType),
       
    68           iKeyEvent(aKeyEvent),
       
    69           iParam( KErrNotFound ),
       
    70           iType(ETypeKey),
       
    71           iVisual(0)
       
    72     {
       
    73     }
       
    74 
       
    75 
       
    76 
       
    77 EXPORT_C THuiEvent::TType THuiEvent::Type() const
       
    78     {
       
    79     return iType;
       
    80     }
       
    81 
       
    82 
       
    83 EXPORT_C TBool THuiEvent::IsCustomEvent() const
       
    84     {
       
    85     return iType == ETypeCustom;
       
    86     }
       
    87 
       
    88 
       
    89 EXPORT_C TBool THuiEvent::IsKeyEvent() const
       
    90     {
       
    91     return iType == ETypeKey;
       
    92     }
       
    93 
       
    94 
       
    95 EXPORT_C TBool THuiEvent::IsPointerEvent() const
       
    96     {
       
    97     return iType == ETypePointer;
       
    98     }
       
    99 
       
   100 
       
   101 EXPORT_C CHuiDisplay& THuiEvent::Display() const
       
   102     {
       
   103     ASSERT( iDisplay );
       
   104     return *iDisplay;
       
   105     }
       
   106 
       
   107 
       
   108 EXPORT_C TBool THuiEvent::PointerDown() const
       
   109     {
       
   110     return iType == ETypePointer &&
       
   111            iPointerEvent.iType == TPointerEvent::EButton1Down;
       
   112     }
       
   113 
       
   114 
       
   115 EXPORT_C TBool THuiEvent::PointerUp() const
       
   116     {
       
   117     return iType == ETypePointer &&
       
   118            iPointerEvent.iType == TPointerEvent::EButton1Up;
       
   119     }
       
   120     
       
   121 EXPORT_C TBool THuiEvent::PointerLongTap() const
       
   122     {
       
   123     return iType == ETypePointer &&
       
   124            iPointerEvent.iType == TPointerEvent::EButtonRepeat;
       
   125     }
       
   126 
       
   127 
       
   128 EXPORT_C void THuiEvent::SetVisual(CHuiVisual* aVisual)
       
   129     {
       
   130     iVisual = aVisual;
       
   131     }
       
   132    
       
   133     
       
   134 EXPORT_C CHuiVisual* THuiEvent::Visual() const
       
   135     {
       
   136     return iVisual;
       
   137     }