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 package com.nokia.mj.impl.rt.legacy; |
|
20 |
|
21 import java.util.Hashtable; |
|
22 |
|
23 public abstract class ToolkitInvoker |
|
24 { |
|
25 private static ToolkitInvoker sInvoker; |
|
26 |
|
27 protected static synchronized void setInvoker(ToolkitInvoker aInvoker) |
|
28 { |
|
29 if (null != sInvoker) |
|
30 { |
|
31 throw new RuntimeException("Toolkit invoker already exists"); |
|
32 } |
|
33 sInvoker = aInvoker; |
|
34 } |
|
35 |
|
36 public static synchronized ToolkitInvoker getToolkitInvoker() |
|
37 { |
|
38 if (sInvoker == null) |
|
39 { |
|
40 try |
|
41 { |
|
42 // It's a static initializer of this class that installs |
|
43 // the concrete invoker object by calling setInvoker() |
|
44 Class.forName("javax.microedition.lcdui.ToolkitInvoker"); |
|
45 } |
|
46 catch (ClassNotFoundException x) |
|
47 { |
|
48 throw new Error("Failed to load the toolkit class: " + x); |
|
49 } |
|
50 } |
|
51 return sInvoker; |
|
52 } |
|
53 |
|
54 public abstract void createToolkit(Hashtable args, boolean startInBackGround); |
|
55 |
|
56 /** |
|
57 * MIDP 2.0 Game support |
|
58 */ |
|
59 |
|
60 // |
|
61 // Toolkit access |
|
62 // |
|
63 public abstract Object getToolkit(); |
|
64 |
|
65 /** |
|
66 * unsafe |
|
67 */ |
|
68 public abstract int toolkitGetHandle(Object aToolkit); |
|
69 |
|
70 public abstract void toolkitDisposeObject(Object aToolkit,int aHandle); |
|
71 |
|
72 public abstract void toolkitSync(Object aToolkit); |
|
73 |
|
74 /** |
|
75 * NGA specific change. |
|
76 * New variant for synchronization initiated from M3G |
|
77 * @param aToolkit - |
|
78 * @param aObject - |
|
79 * @since S60 9.2 |
|
80 */ |
|
81 public abstract void toolkitSync(Object aToolkit, Object aObject); |
|
82 |
|
83 /** |
|
84 * NGA specific change. |
|
85 * Checks if the NGA flag is set |
|
86 * @return true if the NGA flag is set |
|
87 * @since S60 9.2 |
|
88 */ |
|
89 public abstract boolean isNgaEnabled(); |
|
90 |
|
91 // |
|
92 // Image access |
|
93 // |
|
94 public abstract int imageGetHandle(Object aImage); |
|
95 public abstract boolean imageIsMutable(Object aImage); |
|
96 public abstract boolean imageHasTransparency(Object aImage); |
|
97 |
|
98 /** |
|
99 Detect pixel level collision between two Images. |
|
100 @param aImage1 sprite1 raw frame image |
|
101 @param aS1X1,aS1Y1,aS1X2,aS1Y2 sprite1 collision rect (clipped to frame rect) in sprite1 raw frame image co-ordinates |
|
102 @param aTransform1 sprite1 transform |
|
103 @param aD1X1, aD1Y1 position of sprite1 transformed collision rect (clipped to frame rect) in painter's co-ordinates |
|
104 @param aImage2 sprite2\image\tiledlayer image |
|
105 @param aS2X1,aS2Y1,aS2X2,aS2Y2 sprite2\image\tiledlayer collision rect in image co-ordinates |
|
106 @param aTransform2 sprite2 transform. 0 if image\tiledlayer |
|
107 @param aD2X1, aD2Y1 position of collision rect in painter's coordinates |
|
108 */ |
|
109 public abstract boolean imageCollision(Object aImage1, |
|
110 int aS1X1,int aS1Y1,int aS1X2,int aS1Y2, |
|
111 int aTransform1, |
|
112 int aD1X1, int aD1Y1, |
|
113 Object aImage2, |
|
114 int aS2X1,int aS2Y1,int aS2X2,int aS2Y2, |
|
115 int aTransform2, |
|
116 int aD2X1, int aD2Y1 |
|
117 ); |
|
118 |
|
119 // |
|
120 // Game Canvas support |
|
121 // |
|
122 public abstract Object canvasInitGameCanvas(Object aCanvas, boolean aSuppressKeys); |
|
123 public abstract Object canvasGetBufferGraphics(Object aCanvas); |
|
124 public abstract int canvasGetKeyStates(Object aCanvas); |
|
125 public abstract int canvasGetHandle(Object aCanvas); |
|
126 public abstract void canvasRenderGraphics(Object aCanvas, Object aGraphics); |
|
127 public abstract void canvasFlushGraphics(Object aCanvas, int aX, int aY, int aW, int aH); |
|
128 |
|
129 // Graphics |
|
130 /** |
|
131 * @return the MMIDGraphics handle for a graphics instance. |
|
132 * |
|
133 * WARNING: Unsupported. The validity of the return handle cannot be guaranteed. It should not be |
|
134 * dereferenced on anythread other than the UI thread on which the native graphics peer was instantiated. |
|
135 * |
|
136 */ |
|
137 public abstract int graphicsGetHandle(Object aGraphics); |
|
138 |
|
139 /** |
|
140 * @return the MMIDImage handle for a mutable image that is the target surface of |
|
141 * a graphics instance. |
|
142 * |
|
143 * WARNING: Unsupported. The validity of the return handle cannot be guaranteed. It should not be |
|
144 * dereferenced on anythread other than the UI thread on which the native graphics peer was instantiated. |
|
145 * |
|
146 */ |
|
147 public abstract int graphicsGetMutableImageHandle(Object aGraphics); |
|
148 |
|
149 /** |
|
150 * JSR 135 support |
|
151 */ |
|
152 public abstract int getUIEventServerHandle(); |
|
153 public abstract int itemGetHandle(Object aItem); |
|
154 public abstract void addObserver(Object aToolkit,ToolkitObserver aObserver); |
|
155 public abstract void removeObserver(Object aToolkit,ToolkitObserver aObserver); |
|
156 |
|
157 /** S60 AddOn for JSR135 |
|
158 * Getter for Displayable's native handle. |
|
159 * Object parameter is used because runtime package |
|
160 * don't know Displayable class. |
|
161 * @param aDisplayable Displayable which handle is returned. |
|
162 * @return Native handle for displayable. |
|
163 */ |
|
164 public abstract int getDisplayableHandle(Object aDisplayable); |
|
165 |
|
166 /** |
|
167 * Getter for Item's native handle. |
|
168 * Object parameter is used because runtime package |
|
169 * don't know Item class. |
|
170 * @param aItem Item which handle is returned. |
|
171 * @return Native handle for item. |
|
172 */ |
|
173 public abstract int getItemHandle(Object aItem); |
|
174 |
|
175 } |
|