changeset 35 | 85266cc22c7f |
parent 21 | 2a9601315dfc |
child 87 | 1627c337e51e |
26:dc7c549001d5 | 35:85266cc22c7f |
---|---|
19 |
19 |
20 #include "QItemSelection" |
20 #include "QItemSelection" |
21 #include "QListWidgetItem" |
21 #include "QListWidgetItem" |
22 |
22 |
23 #include "slotcallback.h" |
23 #include "slotcallback.h" |
24 #include "swt.h" |
|
25 #include "jniutils.h" |
24 #include "jniutils.h" |
26 #include "swtapplication.h" |
25 #include "swtapplication.h" |
26 #include "swtlog.h" |
|
27 |
27 |
28 using namespace Java::eSWT; |
28 using namespace Java::eSWT; |
29 |
29 |
30 SlotCallback::SlotCallback(JNIEnv* aJniEnv, jobject aPeer, QObject* aParent, const int& aSignalId) |
30 SlotCallback::SlotCallback(JNIEnv* aJniEnv, jobject aPeer, QObject* aParent, const int& aSignalId) |
31 : QObject(aParent), |
31 : QObject(aParent), |
36 { |
36 { |
37 SWT_LOG_FUNC_CALL(); |
37 SWT_LOG_FUNC_CALL(); |
38 |
38 |
39 // If Java peer is not Display then jobject ref and methodID are needed. |
39 // If Java peer is not Display then jobject ref and methodID are needed. |
40 // Otherwise they are managed by JniUtils. |
40 // Otherwise they are managed by JniUtils. |
41 if (!swtApp->jniUtils().isDisplay(aPeer)) |
41 if (aPeer != NULL) |
42 { |
42 { |
43 mPeer = aJniEnv->NewGlobalRef(aPeer); |
43 mPeer = aJniEnv->NewGlobalRef(aPeer); |
44 if(!mPeer) |
44 if(!mPeer) |
45 { |
45 { |
46 throw std::bad_alloc(); |
46 throw std::bad_alloc(); |
68 { |
68 { |
69 JniUtils& jniUtils = swtApp->jniUtils(); |
69 JniUtils& jniUtils = swtApp->jniUtils(); |
70 if (mPeer) |
70 if (mPeer) |
71 { |
71 { |
72 // Call non-Display peer using our own jobject ref and jmethodID |
72 // Call non-Display peer using our own jobject ref and jmethodID |
73 jniUtils.eventProcess(mPeer, mJmethod, reinterpret_cast<int>(parent()), mSignalId, a1, a2, a3, a4, a5, aString); |
73 jniUtils.eventProcess(mPeer, mJmethod, parent(), mSignalId, a1, a2, a3, a4, a5, aString); |
74 } |
74 } |
75 else |
75 else |
76 { |
76 { |
77 // Call Display peer, JniUtils manages the jobject ref and jmethodID |
77 // Call Display peer, JniUtils manages the jobject ref and jmethodID |
78 jniUtils.eventProcess(parent(), mSignalId, a1, a2, a3, a4, a5, aString); |
78 jniUtils.eventProcess(parent(), mSignalId, a1, a2, a3, a4, a5, aString); |