javauis/javalegacyutils/src/eventserver/PostEvent.cpp
changeset 76 4ad59aaee882
parent 69 773449708c84
child 79 2f468c1958d0
equal deleted inserted replaced
69:773449708c84 76:4ad59aaee882
     1 /*
       
     2 * Copyright (c) 1999-2001 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "CJavaEventServer.h"
       
    20 
       
    21 // class CJavaEventServer
       
    22 
       
    23 void CJavaEventServer::PostEvent(CJavaEventBase* aEvent, TInt aPriority)
       
    24 //
       
    25 // Post the event object to the event dispatcher.
       
    26 //
       
    27 // If the dispatcher is ready, then send it directly, otherwise
       
    28 // add it to the event queue
       
    29 //
       
    30 {
       
    31     ASSERT(aEvent!=0);
       
    32     ASSERT(aPriority >= 0 && aPriority <= CJavaEventBase::ELastPriority);
       
    33 
       
    34     NotifyJavaCall(reinterpret_cast<TInt>(aEvent), aPriority);
       
    35 
       
    36 }
       
    37 
       
    38 // class CJavaEventSourceBase
       
    39 
       
    40 EXPORT_C TBool CJavaEventSourceBase::DoPostEvent(CJavaEventBase* aEvent, TInt aPriority)
       
    41 //
       
    42 // Post the event to the event dispatcher queue
       
    43 //
       
    44 // Can accept a NULL pointer, which assumes OOM has occurred
       
    45 //
       
    46 // If this event source has been disposed, the event is discarded
       
    47 // and EFalse is returned to indicate that events should no longer
       
    48 // be generated for this event source.
       
    49 //
       
    50 // Otherwise the event is passed to the event queue and ETrue is
       
    51 // returned to indicate success.
       
    52 //
       
    53 {
       
    54     if (!aEvent)
       
    55         return ETrue;
       
    56     if (CheckEvent(aEvent) && Open())
       
    57     {
       
    58         aEvent->iObject=this;
       
    59         iServer->PostEvent(aEvent, aPriority);
       
    60         return ETrue;
       
    61     }
       
    62     if (aEvent->IsDisposable())
       
    63     {
       
    64         delete aEvent;
       
    65     }
       
    66     return EFalse;
       
    67 }
       
    68 
       
    69 EXPORT_C TBool CJavaEventSourceBase::CheckEvent(CJavaEventBase* /*aEvent*/)
       
    70 {
       
    71     return ETrue;
       
    72 }