1 /* 2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 #ifndef _JAVASOFT_JAWT_H_ 27 #define _JAVASOFT_JAWT_H_ 28 29 #include "jni.h" 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 /* 36 * AWT native interface (new in JDK 1.3) 37 * 38 * The AWT native interface allows a native C or C++ application a means 39 * by which to access native structures in AWT. This is to facilitate moving 40 * legacy C and C++ applications to Java and to target the needs of the 41 * community who, at present, wish to do their own native rendering to canvases 42 * for performance reasons. Standard extensions such as Java3D also require a 43 * means to access the underlying native data structures of AWT. 44 * 45 * There may be future extensions to this API depending on demand. 46 * 47 * A VM does not have to implement this API in order to pass the JCK. 48 * It is recommended, however, that this API is implemented on VMs that support 49 * standard extensions, such as Java3D. 50 * 51 * Since this is a native API, any program which uses it cannot be considered 52 * 100% pure java. 53 */ 54 55 /* 56 * AWT Native Drawing Surface (JAWT_DrawingSurface). 262 */ 263 void (JNICALL *Lock)(JNIEnv* env); 264 /* 265 * Since 1.4 266 * Unlocks the entire AWT for synchronization purposes 267 */ 268 void (JNICALL *Unlock)(JNIEnv* env); 269 /* 270 * Since 1.4 271 * Returns a reference to a java.awt.Component from a native 272 * platform handle. On Windows, this corresponds to an HWND; 273 * on Solaris and Linux, this is a Drawable. For other platforms, 274 * see the appropriate machine-dependent header file for a description. 275 * The reference returned by this function is a local 276 * reference that is only valid in this environment. 277 * This function returns a NULL reference if no component could be 278 * found with matching platform information. 279 */ 280 jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo); 281 282 } JAWT; 283 284 /* 285 * Get the AWT native structure. This function returns JNI_FALSE if 286 * an error occurs. 287 */ 288 _JNI_IMPORT_OR_EXPORT_ 289 jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt); 290 291 #define JAWT_VERSION_1_3 0x00010003 292 #define JAWT_VERSION_1_4 0x00010004 293 #define JAWT_VERSION_1_7 0x00010007 294 295 #ifdef __cplusplus 296 } /* extern "C" */ 297 #endif 298 299 #endif /* !_JAVASOFT_JAWT_H_ */ | 1 /* 2 * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 #ifndef _JAVASOFT_JAWT_H_ 27 #define _JAVASOFT_JAWT_H_ 28 29 #include "jni.h" 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 /* 36 * AWT native interface. 37 * 38 * The AWT native interface allows a native C or C++ application a means 39 * by which to access native structures in AWT. This is to facilitate moving 40 * legacy C and C++ applications to Java and to target the needs of the 41 * community who, at present, wish to do their own native rendering to canvases 42 * for performance reasons. Standard extensions such as Java3D also require a 43 * means to access the underlying native data structures of AWT. 44 * 45 * There may be future extensions to this API depending on demand. 46 * 47 * A VM does not have to implement this API in order to pass the JCK. 48 * It is recommended, however, that this API is implemented on VMs that support 49 * standard extensions, such as Java3D. 50 * 51 * Since this is a native API, any program which uses it cannot be considered 52 * 100% pure java. 53 */ 54 55 /* 56 * AWT Native Drawing Surface (JAWT_DrawingSurface). 262 */ 263 void (JNICALL *Lock)(JNIEnv* env); 264 /* 265 * Since 1.4 266 * Unlocks the entire AWT for synchronization purposes 267 */ 268 void (JNICALL *Unlock)(JNIEnv* env); 269 /* 270 * Since 1.4 271 * Returns a reference to a java.awt.Component from a native 272 * platform handle. On Windows, this corresponds to an HWND; 273 * on Solaris and Linux, this is a Drawable. For other platforms, 274 * see the appropriate machine-dependent header file for a description. 275 * The reference returned by this function is a local 276 * reference that is only valid in this environment. 277 * This function returns a NULL reference if no component could be 278 * found with matching platform information. 279 */ 280 jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo); 281 282 /** 283 * Since 9 284 * Creates a java.awt.Frame placed in a native container. Container is 285 * referenced by the native platform handle. For example on Windows this 286 * corresponds to an HWND. For other platforms, see the appropriate 287 * machine-dependent header file for a description. The reference returned 288 * by this function is a local reference that is only valid in this 289 * environment. This function returns a NULL reference if no frame could be 290 * created with matching platform information. 291 */ 292 jobject (JNICALL *CreateEmbeddedFrame) (JNIEnv *env, void* platformInfo); 293 294 /** 295 * Since 9 296 * Moves and resizes the embedded frame. The new location of the top-left 297 * corner is specified by x and y parameters relative to the native parent 298 * component. The new size is specified by width and height. 299 * 300 * The embedded frame should be created by CreateEmbeddedFrame() method, or 301 * this function will not have any effect. 302 * 303 * java.awt.Component.setLocation() and java.awt.Component.setBounds() for 304 * EmbeddedFrame really don't move it within the native parent. These 305 * methods always locate the embedded frame at (0, 0) for backward 306 * compatibility. To allow moving embedded frames this method was 307 * introduced, and it works just the same way as setLocation() and 308 * setBounds() for usual, non-embedded components. 309 * 310 * Using usual get/setLocation() and get/setBounds() together with this new 311 * method is not recommended. 312 */ 313 void (JNICALL *SetBounds) (JNIEnv *env, jobject embeddedFrame, 314 jint x, jint y, jint w, jint h); 315 /** 316 * Since 9 317 * Synthesize a native message to activate or deactivate an EmbeddedFrame 318 * window depending on the value of parameter doActivate, if "true" 319 * activates the window; otherwise, deactivates the window. 320 * 321 * The embedded frame should be created by CreateEmbeddedFrame() method, or 322 * this function will not have any effect. 323 */ 324 void (JNICALL *SynthesizeWindowActivation) (JNIEnv *env, 325 jobject embeddedFrame, jboolean doActivate); 326 } JAWT; 327 328 /* 329 * Get the AWT native structure. This function returns JNI_FALSE if 330 * an error occurs. 331 */ 332 _JNI_IMPORT_OR_EXPORT_ 333 jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt); 334 335 #define JAWT_VERSION_1_3 0x00010003 336 #define JAWT_VERSION_1_4 0x00010004 337 #define JAWT_VERSION_1_7 0x00010007 338 #define JAWT_VERSION_9 0x00090000 339 340 #ifdef __cplusplus 341 } /* extern "C" */ 342 #endif 343 344 #endif /* !_JAVASOFT_JAWT_H_ */ |