< prev index next >

src/java.desktop/share/native/include/jawt.h

Print this page


   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      * creates with matching platform information.
 291      */
 292     jobject (JNICALL *CreateEmbeddedFrame) (JNIEnv *env, void* platformInfo);
 293 
 294     /**
 295      * Since 9
 296      * Moves and resize 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      * setLocation() and setBounds() for EmbeddedFrame really don't move it
 304      * within the native parent. These methods always put embedded frame to
 305      * (0, 0) for backward compatibility. To allow moving embedded frames
 306      * this method was introduced, and it work just the same way as
 307      * setLocation() and setBounds() for usual, non-embedded components.
 308      *
 309      * Using usual get/setLocation() and get/setBounds() together with this new
 310      * method is not recommended.
 311      */
 312     void (JNICALL *SetBounds) (JNIEnv *env, jobject embeddedFrame,
 313             jint x, jint y, jint w, jint h);
 314     /**
 315      * Since 9
 316      * Synthesize native message to activate or deactivate EmbeddedFrame window
 317      * depending on the value of parameter doActivate, if "true" activates the
 318      * window; otherwise, deactivates the window.
 319      *
 320      * The embedded frame should be created by CreateEmbeddedFrame() method, or
 321      * this function will not have any effect.
 322      */
 323     void (JNICALL *SynthesizeWindowActivation) (JNIEnv *env,
 324             jobject embeddedFrame, jboolean doActivate);
 325 } JAWT;
 326 
 327 /*
 328  * Get the AWT native structure.  This function returns JNI_FALSE if
 329  * an error occurs.
 330  */
 331 _JNI_IMPORT_OR_EXPORT_
 332 jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt);
 333 
 334 #define JAWT_VERSION_1_3 0x00010003
 335 #define JAWT_VERSION_1_4 0x00010004
 336 #define JAWT_VERSION_1_7 0x00010007
 337 #define JAWT_VERSION_9 0x00010009
 338 
 339 #ifdef __cplusplus
 340 } /* extern "C" */
 341 #endif
 342 
 343 #endif /* !_JAVASOFT_JAWT_H_ */
< prev index next >