javauis/lcdui_akn/javalcdui/src.nokialcdui/TactileFeedbackImpl.cpp
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2006-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:  Layer to transfer calls from MTactileFeedbackInterface to native tactile feedback API.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifdef RD_TACTILE_FEEDBACK
       
    21 
       
    22 #include "CMIDToolkit.h"
       
    23 #include <touchfeedback.h>
       
    24 #include "CMIDCustomItem.h"
       
    25 
       
    26 // eSWT implementation methods. Direct calls to native feedback engine.
       
    27 void _CreateMTouchFeedback(MTouchFeedback**  aHandle)
       
    28 {
       
    29     *aHandle = MTouchFeedback::Instance();
       
    30 };
       
    31 
       
    32 void _DoDirectFeedback(MTouchFeedback *aHandle, TTouchLogicalFeedback aStyle)
       
    33 {
       
    34     aHandle->InstantFeedback(aStyle);
       
    35 };
       
    36 
       
    37 void _RegisterFeedbackArea(MTouchFeedback *aHandle, CCoeControl* aControl, TInt aAreaIndex, TRect aFeedbackRect, TTouchLogicalFeedback aStyle)
       
    38 {
       
    39     aHandle->SetFeedbackArea(aControl, aAreaIndex, aFeedbackRect, aStyle, ETouchEventStylusDown);
       
    40 };
       
    41 
       
    42 
       
    43 void _UnregisterFeedbackArea(MTouchFeedback *aHandle, CCoeControl* aControl, TInt aAreaIndex)
       
    44 {
       
    45     aHandle->RemoveFeedbackArea(aControl, aAreaIndex);
       
    46 }
       
    47 
       
    48 void _UnregisterFeedbackForControl(MTouchFeedback *aHandle, CCoeControl* aControl)
       
    49 {
       
    50     aHandle->RemoveFeedbackForControl(aControl);
       
    51 }
       
    52 
       
    53 void _MoveAreaToFirstPriority(MTouchFeedback *aHandle, CCoeControl* aControl, TInt aAreaIndex)
       
    54 {
       
    55     aHandle->MoveFeedbackAreaToFirstPriority(aControl, aAreaIndex);
       
    56 }
       
    57 
       
    58 
       
    59 
       
    60 
       
    61 // LCDUI implementation method. In LCDUI a component is responsible for storing/moving/updating a feedback areas.
       
    62 
       
    63 void _RegisterFeedbackAreaForComponent(MMIDTactileFeedbackComponent* aComponent, TInt aAreaIndex, TRect aFeedbackRect, TTouchLogicalFeedback aStyle)
       
    64 {
       
    65     //MMIDCustomItem* control = JavaUnhand<MMIDCustomItem>( (TInt)aControl );
       
    66     aComponent->RegisterFeedbackArea(aAreaIndex, aFeedbackRect, aStyle);
       
    67 }
       
    68 
       
    69 void _UnregisterFeedbackAreaForComponent(MMIDTactileFeedbackComponent* aComponent, TInt aAreaIndex)
       
    70 {
       
    71     aComponent->UnregisterFeedbackArea(aAreaIndex);
       
    72 }
       
    73 
       
    74 void _UnregisterFeedbackForControlForComponent(MMIDTactileFeedbackComponent* aComponent)
       
    75 {
       
    76     aComponent->UnregisterFeedbackForControl();
       
    77 }
       
    78 
       
    79 void _MoveAreaToFirstPriorityForComponent(MMIDTactileFeedbackComponent* aComponent, TInt aAreaIndex)
       
    80 {
       
    81     aComponent->MoveAreaToFirstPriority(aAreaIndex);
       
    82 }
       
    83 
       
    84 TBool _IsTouchFeedbackSupported(MTouchFeedback *aHandle)
       
    85 {
       
    86     return aHandle->TouchFeedbackSupported();
       
    87 }
       
    88 #endif