tactilefeedback/tactilefeedbackclient/src/touchfeedbackadaptation.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 19 Mar 2010 09:35:13 +0200
changeset 14 603911b3f166
parent 0 d54f32e146dd
permissions -rw-r--r--
Revision: 201007 Kit: 201011
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:  This class is an adaptation class that is instantiated
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*                by the application framework, and that instantiates the
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*                actual Tactile Feedback Client implementation.
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
* Part of:      Tactile Feedback.
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
*
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
*/
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include <e32std.h>
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#include <eikenv.h>
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#include <coecntrl.h>
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
#include <tactilefeedbacktrace.h>
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
#include <touchfeedbackadaptation.h>
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
#include "touchfeedbackclient.h"
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
#include "touchfeedbackimpl.h"
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
// ======== MEMBER FUNCTIONS ========
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
// Constructor.
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
//
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
CTouchFeedbackAdaptation::CTouchFeedbackAdaptation()
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
    {
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
    }
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
// 2nd phase constructor.
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
//
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
void CTouchFeedbackAdaptation::ConstructL()
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
    {
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
    TRACE("CTouchFeedbackAdaptation::ConstructL - Begin");
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
    iTouchFeedback = CTouchFeedbackImpl::New();    
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
    TRACE("CTouchFeedbackAdaptation::ConstructL - End");
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
    }
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
// We store ourselves to the thread local storage here. The instance is 
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
// accessible to clients via Instance -function.
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
//
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
EXPORT_C CTouchFeedbackAdaptation* CTouchFeedbackAdaptation::NewL()
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
    {
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    62
    CTouchFeedbackAdaptation* self = new( ELeave ) CTouchFeedbackAdaptation;
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
    CleanupStack::PushL( self );
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    64
    self->ConstructL();
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
    // Store ourselves to thread local storage
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
    User::LeaveIfError( Dll::SetTls( self ) );        
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
    CleanupStack::Pop( self );    
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
    return self;
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
    }
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
// Destructor.
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
//
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
CTouchFeedbackAdaptation::~CTouchFeedbackAdaptation()
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
    {
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
    delete iTouchFeedback;
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
    Dll::SetTls( NULL );
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
    }
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
// Retrieve instance from thread local storage
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
//
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
MTouchFeedback* CTouchFeedbackAdaptation::GetInstance()
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
    {
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
    TAny* selfPtr = Dll::Tls();
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
    CTouchFeedbackAdaptation* self = 
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
        static_cast<CTouchFeedbackAdaptation*>( selfPtr );
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
    
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
    if ( self )
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
        {
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
        return self->iTouchFeedback;
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
        }
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
    else
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
        {
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
        return NULL;
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
        }
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
    }
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
// Create new instance and return it to caller
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
//
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
// We must have check for the case where client calls this even though
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
// instance exists already (in this case we only return the existing 
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
// instance).
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
//
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
MTouchFeedback* CTouchFeedbackAdaptation::CreateInstanceL()
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
    {   
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
    // Use current instance if it exists
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
    MTouchFeedback* feedback = GetInstance();
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
    // If current instance does not exist, then create a new one
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
    if ( !feedback )
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
        {
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
        CTouchFeedbackAdaptation* tmp = NewL();
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
        
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
        feedback = tmp->GetInstance();
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
        }
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
        
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
    return feedback;
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
    }
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   129
// Destroy ourselves if we are found at thread local storage (tls)
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   130
//
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   131
// Notice that tls content does not need to be zeroed because that is already
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   132
// done in the destructor.
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   133
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   134
//
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   135
void CTouchFeedbackAdaptation::DestroyInstance()
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   136
    {
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   137
    TAny* selfPtr = Dll::Tls();
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   138
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
    CTouchFeedbackAdaptation* self = 
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
        static_cast<CTouchFeedbackAdaptation*>( selfPtr );
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
    
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
    if ( self )
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   143
        {
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
        delete self;
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
        }        
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   146
    }    
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   147
    
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   148
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
// Empty implementation, as this function is no longer in use.
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
// (Control visibility changes now handled in HandleControlStateChange)
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
//
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
EXPORT_C void CTouchFeedbackAdaptation::ControlVisibilityChanged( 
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
    const CCoeControl* /*aControl*/ )
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   155
    {
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
    }
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
// Nothing to do here, just pass the information to implementation.
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   160
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   161
//
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   162
EXPORT_C void CTouchFeedbackAdaptation::LayoutChanged( )
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
    {
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
    if ( iTouchFeedback )
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
        {
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   166
        iTouchFeedback->LayoutChanged();
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   167
        }
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   168
    }
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   169
    
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   170
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   171
// From class MObjectProvider.
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   172
// We have to implement this because it is pure virtual in base class.
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   173
// Return Null as we are not actually part of object provider hierarchy.
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   174
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   175
TTypeUid::Ptr CTouchFeedbackAdaptation::MopSupplyObject( TTypeUid /*aId*/ )
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   176
    {
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   177
    return TTypeUid::Null();
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   178
    }
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   179
        
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   180
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
// From class MCoeControlStateObserver.
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   182
// Here we just pass the information about control state change ahead to
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   183
// actual feedback implementation.
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   184
// ---------------------------------------------------------------------------
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
TInt CTouchFeedbackAdaptation::HandleControlStateChange( 
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
    CCoeControl* aControl,
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   187
    TCoeState /*aState*/ )
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
    {
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
    if ( iTouchFeedback )
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   190
        {
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   191
        iTouchFeedback->ControlVisibilityChanged( aControl );
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   192
        }
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
        
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
    return KErrNone;
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   195
    }
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   196
    
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   197
d54f32e146dd Revision: 200947
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   198