|
1 /* |
|
2 * Copyright (c) 2002 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 "CMIDToolkit.h" |
|
20 #include "MIDUtils.h" |
|
21 #include "javax_microedition_lcdui_Ticker.h" |
|
22 |
|
23 |
|
24 LOCAL_C void CreateL(CMIDToolkit* aToolkit,TInt* aHandle,const TDesC* aText) |
|
25 { |
|
26 MMIDTicker* ticker = aToolkit->ComponentFactory()->CreateTickerL(*aText); |
|
27 CleanupDisposePushL(ticker); |
|
28 *aHandle = aToolkit->RegisterComponentL(ticker, NULL); |
|
29 CleanupPopComponent(ticker); |
|
30 } |
|
31 JNIEXPORT jint JNICALL Java_javax_microedition_lcdui_Ticker__1create(JNIEnv* aJni,jobject,jint aToolkit,jstring aText) |
|
32 { |
|
33 CMIDToolkit* toolkit =JavaUnhand<CMIDToolkit>(aToolkit); |
|
34 RJString text(*aJni,aText); |
|
35 TInt h=0; |
|
36 TInt err = toolkit->ExecuteTrap(&CreateL,toolkit,&h,(const TDesC*)&text); |
|
37 return err == KErrNone ? h : err; |
|
38 } |
|
39 |
|
40 LOCAL_C void SetTextL(MMIDTicker* aTicker,const TDesC* aText) |
|
41 { |
|
42 aTicker->SetTextL(*aText); |
|
43 } |
|
44 JNIEXPORT jint JNICALL Java_javax_microedition_lcdui_Ticker__1setText |
|
45 (JNIEnv* aEnv,jobject,jint aHandle,jint aToolkit,jstring aString) |
|
46 { |
|
47 MMIDTicker* ticker = MIDUnhandObject<MMIDTicker>(aHandle); |
|
48 RJString string(*aEnv,aString); |
|
49 return JavaUnhand<CMIDToolkit>(aToolkit)->ExecuteTrap(&SetTextL,ticker,(const TDesC*)&string); |
|
50 } |