javauis/nokiasound_akn/inc/CMIDSoundEvent.h
branchRCL_3
changeset 83 26b2b12093af
parent 19 04becd199f91
equal deleted inserted replaced
77:7cee158cb8cd 83:26b2b12093af
       
     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:  Class for sound related events.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMIDSOUNDEVENT_H
       
    20 #define CMIDSOUNDEVENT_H
       
    21 
       
    22 #include <jni.h>
       
    23 
       
    24 //  CLASS DEFINITION
       
    25 
       
    26 /**
       
    27  * Class for sound related events.
       
    28  */
       
    29 NONSHARABLE_CLASS(CMIDSoundEvent)
       
    30 {
       
    31 public: // constructor
       
    32     CMIDSoundEvent(TInt aEvent);
       
    33 
       
    34 public: // new methods
       
    35     /**
       
    36      * Setter for listener
       
    37      * @param aListener this event will be sent to this listener
       
    38      */
       
    39     void SetListener(jobject aListener);
       
    40 
       
    41     /**
       
    42      * Setter for method ID
       
    43      * @param aMethodID this event will be sent by calling this method
       
    44      */
       
    45     void SetMethodID(jmethodID aMethodID);
       
    46 
       
    47     /**
       
    48      * Adds a global reference to peer object, this reference is
       
    49      * removed when the event is dispatched. This prevents peer
       
    50      * object from being deleted by garbage collector before the
       
    51      * event has been dispatched.
       
    52      */
       
    53     void AddGlobalRef(JavaVM* javaVM);
       
    54 
       
    55 
       
    56 private:
       
    57     void Dispatch(JNIEnv& aJni);
       
    58 
       
    59 private:
       
    60     jobject iListener;
       
    61     jmethodID iMethodID;
       
    62     TInt iEvent;
       
    63     jobject iGlobalRef;
       
    64     // Number of times the global reference has been added.
       
    65     // The actual global reference is removed when the counter reaches zero.
       
    66     TInt iRefCount;
       
    67 
       
    68 };
       
    69 
       
    70 
       
    71 #endif // CMIDSOUNDEVENT_H