//====START_GENERATED_PROLOG======================================
//
//
//   COMPONENT_NAME: odother
//
//   CLASSES: none
//
//   ORIGINS: 27
//
//
//   (C) COPYRIGHT International Business Machines Corp. 1995,1996
//   All Rights Reserved
//   Licensed Materials - Property of IBM
//   US Government Users Restricted Rights - Use, duplication or
//   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
//
//   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
//   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
//   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
//   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
//   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
//   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
//   OR PERFORMANCE OF THIS SOFTWARE.
//
//====END_GENERATED_PROLOG========================================
//
// @(#) 1.2 nt/src/samples/JavaPart/jempower.h, odjavapart, od96nt, odnt9714c 3/19/97 04:01:25 [ 4/2/97 17:55:05 ]

/******************************************************************************
 *  IBM JEmpower                                                              *
 *                                                                            *
 *  (C) Copyright IBM Corp. 1996-1997                                         *
 *  All Rights Reserved.                                                      *
 *                                                                            *
 ******************************************************************************
 *                                                                            *
 *  Module Name: JEmpower.h - JEmpower functions                              *
 *                                                                            *
 *****************************************************************************/

#ifndef _JEMPOWER_H_
#define _JEMPOWER_H_

#include <jni.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifdef __OS2__
#define JELINKAGE _System
#ifdef  JEMPOWER_DYNAMIC
#define JE_HAS_ORDINALS
#endif
#elif defined(_WIN32) || defined(WIN32)
#define JELINKAGE __cdecl
#ifdef  JEMPOWER_DYNAMIC
#define JE_HAS_ORDINALS
#endif
#else
#define JELINKAGE
#endif

/* Function and callback declarations
 * Use JE_CLI_FN  when declaring a function, as in
 *    static JE_CLI_FN(JERESULT) MyShowStatus(...arglist...) { }
 * Use JE_CLI_FNP when typedefing a function pointer, as in
 *    typedef JE_CLI_FNP(JERESULT, MyShowStatusType)(...arglist...);
 */
#define JE_CLI_FN(rettype) rettype JELINKAGE
#ifdef __OS2__
#define JE_CLI_FNP(rettype, fnTypeName) rettype (* JELINKAGE fnTypeName)
#else
#define JE_CLI_FNP(rettype, fnTypeName) rettype (JELINKAGE * fnTypeName)
#endif

typedef unsigned long JEAPPLETHND;
typedef unsigned long JECONTEXTID;
typedef int           JERESULT;

/* JENATIVEWND is the type used for windows in the native operating system.
 * For example, it is an HWND on WIN32 and OS2, an X Widget under UNIX, etc.
 * To avoid having to load os2.h, windows.h, etc in this header file,
 * we do the minimal definition here.
 * We simply define JENATIVEWND to be the type used on the platform.
 * If for some reason this is problematic for your includes, #define
 * JENATIVEWND before loading this file to the appropriate type.
 * If you do this, make sure that the sizeof(JENATIVEWND) is correct
 */
#if !defined(JENATIVEWND)
#if defined(__OS2__) || defined(_WIN32) || defined(WIN32)
#define JENATIVEWND HWND
#else
#define JENATIVEWND Widget
#endif
#endif /* !defined(JENATIVEWND) */

/*******************************************************************/

/*
 * This API can be used statically or dynamically.
 *
 * For statically, simply link with the JEmpower library and call functions
 * such as jeInitJavaRuntime or jeAppletInit.
 *
 * For dynamically, load each of the functions using operating system
 * functions such as GetProcAddress (for windows) and assign variables
 * of the correct type to the results for later use.  For example,
 *    JE_FP_jeAppletInit jeAppletInit;
 *    jeAppletInit = (JE_FP_jeAppletInit)GetProcAddress(lib, "jeAppletInit");
 *    ...
 *    jeAppletInit(usual arguments);
 * To use this library dynamically,
 * #define JEMPOWER_DYNAMIC before loading jempower.h
 * Notice that the call site of jeAppletInit looks identical regardless
 * of whether JEMPOWER is used statically or dynamically
 */
#ifndef JEMPOWER_DYNAMIC
#define JE_FN_DECL(rettype, fnName, fnTypeName) \
   JE_CLI_FN(rettype) fnName
#else
#define JE_FN_DECL(rettype, fnName, fnTypeName) \
   typedef JE_CLI_FNP(rettype, fnTypeName)
#endif

JE_FN_DECL(void, jeVersion, JE_FP_jeVersion)
   (int *majorVersion, int *minorVersion);

JE_FN_DECL(JERESULT, jeInitJavaRuntime, JE_FP_jeInitJavaRuntime)
   (void);

JE_FN_DECL(JERESULT, jeInitAppletRuntime, JE_FP_jeInitAppletRuntime)
   (void);

/* Codebase argument may be null.  If not specified, make sure it
 * is null, not the empty string
 */
JE_FN_DECL(JERESULT, jeAppletInit, JE_FP_jeAppletInit)
   (JEAPPLETHND *pAppResult,
    JECONTEXTID contextID,
    JENATIVEWND parent,
    const char *documentURL,
    const char *code,
    const char *object,
    const char *codebase,
    long width,
    long height,
    int parmCount,
    const char **parms);

JE_FN_DECL(JERESULT, jeAppletStart, JE_FP_jeAppletStart)
   (JEAPPLETHND applet);
JE_FN_DECL(JERESULT, jeAppletStop, JE_FP_jeAppletStop)
   (JEAPPLETHND applet);
JE_FN_DECL(JERESULT, jeAppletDestroy, JE_FP_jeAppletDestroy)
   (JEAPPLETHND applet);

#define JE_APPLET_STATUS_DISPOSED	0
#define JE_APPLET_STATUS_LOADING		1
#define JE_APPLET_STATUS_INITED		2
#define JE_APPLET_STATUS_STARTED		3
#define JE_APPLET_STATUS_STOPPED		4
#define JE_APPLET_STATUS_DESTROYED	5
#define JE_APPLET_STATUS_ERROR		7

JE_FN_DECL(JERESULT, jeAppletGetStatus, JE_FP_jeAppletGetStatus)
   (JEAPPLETHND applet, int *status);

JE_FN_DECL(JERESULT, jeAppletResize, JE_FP_jeAppletResize)
   (JEAPPLETHND applet, long width, long height);
JE_FN_DECL(JERESULT, jeAppletMove, JE_FP_jeAppletMove)
   (JEAPPLETHND applet, long x, long y, long width, long height, int bRepaint);
JE_FN_DECL(JERESULT, jeAppletShow, JE_FP_jeAppletShow)
   (JEAPPLETHND applet, int bShow);

JE_FN_DECL(JENATIVEWND, jeHWNDFromApplet, JE_FP_jeHWNDFromApplet)
   (JEAPPLETHND applet);

JE_FN_DECL(JERESULT, jeAppletsIconify, JE_FP_jeAppletsIconify)
   (JECONTEXTID contextID);
JE_FN_DECL(JERESULT, jeAppletsUniconify, JE_FP_jeAppletsUniconify)
   (JECONTEXTID contextID);
JE_FN_DECL(JERESULT, jeAppletsDestroy, JE_FP_jeAppletsDestroy)
   (JECONTEXTID contextID);

JE_FN_DECL(JERESULT, jeConsoleSetVisible, JE_FP_jeConsoleSetVisible)
   (int show);
JE_FN_DECL(JERESULT, jeConsoleIsVisible, JE_FP_jeConsoleIsVisible)
   (int *visible);

JE_FN_DECL(JERESULT, jeGetProperty, JE_FP_jeGetProperty)
   (const char *key, char *value,
    int valueLength, int *trueLength);
JE_FN_DECL(JERESULT, jeSetProperty, JE_FP_jeSetProperty)
   (const char *key, const char *value);

typedef JE_CLI_FNP(void, jeShowDocumentFnPtr)(JECONTEXTID contextID,
                                              const char *url,
                                              const char *target);
JE_FN_DECL(JERESULT, jeRegisterShowDocument, JE_FP_jeRegisterShowDocument)
   (jeShowDocumentFnPtr fnPtr);

typedef JE_CLI_FNP(int, jeShowStatusFnPtr)(JECONTEXTID contextID,
                                           const char *status);
JE_FN_DECL(JERESULT, jeRegisterShowStatus, JE_FP_jeRegisterShowStatus)
   (jeShowStatusFnPtr fnPtr);

typedef JE_CLI_FNP(int, jeShowConsoleFnPtr)(const char *string);
JE_FN_DECL(JERESULT, jeRegisterShowConsole, JE_FP_jeRegisterShowConsole)
   (jeShowConsoleFnPtr fnPtr);

/*******************************************************************/

JE_FN_DECL(JERESULT, jeBeanInstantiate, JE_FP_jeBeanInstantiate)
   (jobject *bean, const char *beanName);
JE_FN_DECL(JERESULT, jeBeanEmbed, JE_FP_jeBeanEmbed)
   (JENATIVEWND *parent, jobject bean);
JE_FN_DECL(JERESULT, jeBeanDispose, JE_FP_jeBeanDispose)
   (jobject bean);

typedef JE_CLI_FNP(void, jeBeanEventFnPtr)(jobject targetbean, 
															 const char *method,
															 jobject event);
JE_FN_DECL(JERESULT, jeBeanAddListener, JE_FP_jeBeanAddListener)
   (jobject bean, jeBeanEventFnPtr fnPtr);

JE_FN_DECL(JERESULT, jeBeanSerialize, JE_FP_jeBeanSerialize)
   (jobject bean, const char *filename);
JE_FN_DECL(JERESULT, jeBeanDeserialize, JE_FP_jeBeanDeserialize)
   (jobject *bean, const char *filename);

JE_FN_DECL(JENATIVEWND, jeHWNDFromBean, JE_FP_jeHWNDFromBean)
   (jobject bean);

/*******************************************************************/

#ifdef  JEMPOWER_DYNAMIC
/* To make dynamic loading easier.  The names and ordinals for the API */
#define JE_NAM_jeVersion               "jeVersion"
#define JE_NAM_jeInitJavaRuntime       "jeInitJavaRuntime"
#define JE_NAM_jeInitAppletRuntime		"jeInitAppletRuntime"
#define JE_NAM_jeAppletInit            "jeAppletInit"
#define JE_NAM_jeAppletStart           "jeAppletStart"
#define JE_NAM_jeAppletStop            "jeAppletStop"
#define JE_NAM_jeAppletDestroy         "jeAppletDestroy"
#define JE_NAM_jeAppletGetStatus       "jeAppletGetStatus"
#define JE_NAM_jeAppletResize          "jeAppletResize"
#define JE_NAM_jeAppletMove            "jeAppletMove"
#define JE_NAM_jeAppletShow            "jeAppletShow"
#define JE_NAM_jeHWNDFromApplet			"jeHWNDFromApplet"
#define JE_NAM_jeAppletsIconify        "jeAppletsIconify"
#define JE_NAM_jeAppletsUniconify      "jeAppletsUniconify"
#define JE_NAM_jeAppletsDestroy        "jeAppletsDestroy"
#define JE_NAM_jeConsoleSetVisible     "jeConsoleSetVisible"
#define JE_NAM_jeConsoleIsVisible		"jeConsoleIsVisible"
#define JE_NAM_jeGetProperty           "jeGetProperty"
#define JE_NAM_jeSetProperty           "jeSetProperty"
#define JE_NAM_jeRegisterShowDocument  "jeRegisterShowDocument"
#define JE_NAM_jeRegisterShowStatus    "jeRegisterShowStatus"
#define JE_NAM_jeRegisterShowConsole   "jeRegisterShowConsole"

#define JE_NAM_jeBeanInstantiate			"jeBeanInstantiate"
#define JE_NAM_jeBeanEmbed					"jeBeanEmbed"
#define JE_NAM_jeBeanDispose				"jeBeanDispose"
#define JE_NAM_jeBeanAddListener			"jeBeanAddListener"
#define JE_NAM_jeBeanSerialize			"jeBeanSerialize"
#define JE_NAM_jeBeanDeserialize			"jeBeanDeserialize"
#define JE_NAM_jeHWNDFromApplet			"jeHWNDFromApplet"

#ifdef  JE_HAS_ORDINALS
#define JE_ORD_jeVersion               1000
#define JE_ORD_jeInitJavaRuntime       1001

#define JE_ORD_jeInitAppletRuntime		1049
#define JE_ORD_jeAppletInit            1050
#define JE_ORD_jeAppletStart           1051
#define JE_ORD_jeAppletStop            1052
#define JE_ORD_jeAppletDestroy         1053
#define JE_ORD_jeAppletGetStatus			1055
#define JE_ORD_jeAppletResize          1056
#define JE_ORD_jeAppletMove            1057
#define JE_ORD_jeAppletShow            1058

#define JE_ORD_jeHWNDFromApplet			1300

#define JE_ORD_jeAppletsIconify        1100
#define JE_ORD_jeAppletsUniconify      1101
#define JE_ORD_jeAppletsDestroy        1102

#define JE_ORD_jeConsoleSetVisible     1150
#define JE_ORD_jeConsoleIsVisible      1151


#define JE_ORD_jeRegisterShowConsole   1160
#define JE_ORD_jeRegisterShowDocument  1161
#define JE_ORD_jeRegisterShowStatus    1162

#define JE_ORD_jeGetProperty           1200
#define JE_ORD_jeSetProperty           1201

#define JE_ORD_jeBeanInstantiate			2000
#define JE_ORD_jeBeanEmbed					2001
#define JE_ORD_jeBeanDispose				2002
#define JE_ORD_jeBeanAddListener			2003
#define JE_ORD_jeBeanSerialize			2004
#define JE_ORD_jeBeanDeserialize			2005
#define JE_ORD_jeHWNDFromBean				2006

#endif  /* JE_HAS_ORDINALS */

#endif  /* JEMPOWER_DYNAMIC */

#ifdef __cplusplus
}
#endif

#endif
