1 /* |
|
2 * Copyright (c) 2006 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: This class is used to send direct content repaint event. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <logger.h> |
|
21 |
|
22 #include "cmmadcrepaintevent.h" |
|
23 |
|
24 CMMADCRepaintEvent::CMMADCRepaintEvent(jobject aGUIObject): |
|
25 CMMAEvent(EReusableEvent) |
|
26 { |
|
27 iListenerObject = aGUIObject; |
|
28 iEventData = KErrNone; |
|
29 } |
|
30 |
|
31 TBool CMMADCRepaintEvent::IsActive() |
|
32 { |
|
33 return iEventData != KErrNone; |
|
34 } |
|
35 |
|
36 void CMMADCRepaintEvent::SetActive() |
|
37 { |
|
38 iEventData = KErrInUse; |
|
39 } |
|
40 |
|
41 // from CJavaEvent |
|
42 void CMMADCRepaintEvent::Dispatch(JNIEnv& aJni) |
|
43 { |
|
44 // create method id if not allready created |
|
45 if (!iHandleEventMethod) |
|
46 { |
|
47 iHandleEventMethod = aJni.GetMethodID(aJni.GetObjectClass(iListenerObject), |
|
48 "repaint", |
|
49 "()V"); |
|
50 } |
|
51 |
|
52 // There is internal error if method cannot be found |
|
53 __ASSERT_DEBUG(iHandleEventMethod, User::Invariant()); |
|
54 |
|
55 // IsSameObject method will return true if iListenerObject has disappeared |
|
56 if (iHandleEventMethod && |
|
57 aJni.IsSameObject(iListenerObject, 0) == JNI_FALSE) |
|
58 { |
|
59 aJni.CallVoidMethod(iListenerObject, |
|
60 iHandleEventMethod); |
|
61 } |
|
62 |
|
63 // IsActive will return EFalse after this |
|
64 iEventData = KErrNone; |
|
65 } |
|
66 |
|
67 // END OF FILE |
|