Created
July 5, 2020 19:48
-
-
Save uyjulian/5d169ba317011107cdcf8ab691a7863a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
TVP2 ( T Visual Presenter 2 ) A script authoring tool | |
Copyright (C) 2000-2009 W.Dee <dee@kikyou.info> and contributors | |
See details of license at "license.txt" | |
*/ | |
/* This file is always generated by makestub.pl . */ | |
/* Modification by hand will be lost. */ | |
#ifndef __TP_STUB_H__ | |
#define __TP_STUB_H__ | |
#ifndef __cplusplus | |
#error Sorry, currently tp_stub.h can only be used in C++ mode. | |
#endif | |
#include <string> | |
#include <stdarg.h> | |
#ifndef _WIN32 | |
#error Sorry, currently tp_stub.h can only be used in Win32 VC++ or Borland compilers. | |
#endif | |
typedef __int8 tjs_int8; | |
typedef unsigned __int8 tjs_uint8; | |
typedef __int16 tjs_int16; | |
typedef unsigned __int16 tjs_uint16; | |
typedef __int32 tjs_int32; | |
typedef unsigned __int32 tjs_uint32; | |
typedef __int64 tjs_int64; | |
typedef unsigned __int64 tjs_uint64; | |
typedef int tjs_int; /* at least 32bits */ | |
typedef unsigned int tjs_uint; /* at least 32bits */ | |
#ifdef __cplusplus | |
typedef wchar_t tjs_char; | |
#else | |
typedef unsigned short tjs_char; | |
#endif | |
typedef char tjs_nchar; | |
typedef double tjs_real; | |
#define TJS_HOST_IS_BIG_ENDIAN 0 | |
#define TJS_HOST_IS_LITTLE_ENDIAN 1 | |
#ifndef TJS_INTF_METHOD | |
#define TJS_INTF_METHOD __cdecl | |
/* TJS_INTF_METHOD is "cdecl" (by default) | |
since TJS2 2.4.14 (kirikir2 2.25 beta 1) */ | |
#endif | |
#define TJS_USERENTRY __cdecl | |
#define TJS_I64_VAL(x) ((tjs_int64)(x##i64)) | |
#define TJS_UI64_VAL(x) ((tjs_uint64)(x##i64)) | |
#ifdef _M_X64 | |
#define TJS_64BIT_OS /* 64bit windows */ | |
#endif | |
typedef intptr_t tjs_intptr_t; | |
typedef uintptr_t tjs_uintptr_t; | |
#define TJS_W(X) L##X | |
#define TJS_N(X) X | |
typedef tjs_int32 tjs_error; | |
typedef tjs_int64 tTVInteger; | |
typedef tjs_real tTVReal; | |
typedef size_t tjs_size; | |
typedef ptrdiff_t tjs_offset; | |
/* IEEE double manipulation support | |
(TJS requires IEEE double(64-bit float) native support on machine or C++ compiler) */ | |
/* | |
63 62 52 51 0 | |
+-+-----------+---------------------------+ | |
|s| exp | significand | | |
+-+-----------+---------------------------+ | |
s = sign, negative if this is 1, otherwise positive. | |
*/ | |
/* double related constants */ | |
#define TJS_IEEE_D_EXP_MAX 1023 | |
#define TJS_IEEE_D_EXP_MIN -1022 | |
#define TJS_IEEE_D_SIGNIFICAND_BITS 52 | |
#define TJS_IEEE_D_EXP_BIAS 1023 | |
/* component extraction */ | |
#define TJS_IEEE_D_SIGN_MASK (TJS_UI64_VAL(0x8000000000000000)) | |
#define TJS_IEEE_D_EXP_MASK (TJS_UI64_VAL(0x7ff0000000000000)) | |
#define TJS_IEEE_D_SIGNIFICAND_MASK (TJS_UI64_VAL(0x000fffffffffffff)) | |
#define TJS_IEEE_D_SIGNIFICAND_MSB_MASK (TJS_UI64_VAL(0x0008000000000000)) | |
#define TJS_IEEE_D_GET_SIGN(x) (0!=(x & TJS_IEEE_D_SIGN_MASK)) | |
#define TJS_IEEE_D_GET_EXP(x) ((tjs_int)(((x & TJS_IEEE_D_EXP_MASK) >> \ | |
TJS_IEEE_D_SIGNIFICAND_BITS) - TJS_IEEE_D_EXP_BIAS)) | |
#define TJS_IEEE_D_GET_SIGNIFICAND(x) (x & TJS_IEEE_D_SIGNIFICAND_MASK) | |
/* component composition */ | |
#define TJS_IEEE_D_MAKE_SIGN(x) ((x)?TJS_UI64_VAL(0x8000000000000000):TJS_UI64_VAL(0)) | |
#define TJS_IEEE_D_MAKE_EXP(x) ((tjs_uint64)(x + TJS_IEEE_D_EXP_BIAS) << 52) | |
#define TJS_IEEE_D_MAKE_SIGNIFICAND(x) ((tjs_uint64)(x)) | |
/* special expression */ | |
/* (quiet) NaN */ | |
#define TJS_IEEE_D_P_NaN (tjs_uint64)(TJS_IEEE_D_EXP_MASK|TJS_IEEE_D_SIGNIFICAND_MSB_MASK) | |
#define TJS_IEEE_D_N_NaN (tjs_uint64)(TJS_IEEE_D_SIGN_MASK|TJS_IEEE_D_P_NaN) | |
/* infinite */ | |
#define TJS_IEEE_D_P_INF (tjs_uint64)(TJS_IEEE_D_EXP_MASK) | |
#define TJS_IEEE_D_N_INF (tjs_uint64)(TJS_IEEE_D_SIGN_MASK|TJS_IEEE_D_P_INF) | |
/* special expression check */ | |
#define TJS_IEEE_D_IS_NaN(x) ((TJS_IEEE_D_EXP_MASK & (x)) == TJS_IEEE_D_EXP_MASK) && \ | |
(((x) & TJS_IEEE_D_SIGNIFICAND_MSB_MASK) || \ | |
(!((x) & TJS_IEEE_D_SIGNIFICAND_MSB_MASK) && \ | |
((x) & (TJS_IEEE_D_SIGNIFICAND_MASK ^ TJS_IEEE_D_SIGNIFICAND_MSB_MASK)))) | |
#define TJS_IEEE_D_IS_INF(x) (((TJS_IEEE_D_EXP_MASK & (x)) == TJS_IEEE_D_EXP_MASK) && \ | |
(!((x) & TJS_IEEE_D_SIGNIFICAND_MASK))) | |
#define TJS_strcmp wcscmp | |
#define TJS_strncmp wcsncmp | |
#define TJS_strncpy wcsncpy | |
#define TJS_strcat wcscat | |
#define TJS_strstr wcsstr | |
#define TJS_strchr wcschr | |
#define TJS_malloc malloc | |
#define TJS_free free | |
#define TJS_realloc realloc | |
#define TJS_nsprintf sprintf | |
#define TJS_nstrcpy strcpy | |
#define TJS_nstrcat strcat | |
#define TJS_nstrlen strlen | |
#define TJS_nstrstr strstr | |
#define TJS_strftime wcsftime | |
#define TJS_vfprintf vfwprintf | |
#define TJS_octetcpy memcpy | |
#define TJS_octetcmp memcmp | |
#define TJS_strtod wcstod | |
//--------------------------------------------------------------------------- | |
// tTJSVariantString stuff | |
//--------------------------------------------------------------------------- | |
#define TJS_VS_SHORT_LEN 21 | |
//--------------------------------------------------------------------------- | |
// tTJSVariantString | |
//--------------------------------------------------------------------------- | |
#pragma pack(push, 4) | |
struct tTJSVariantString_S | |
{ | |
tjs_int RefCount; // reference count - 1 | |
tjs_char *LongString; | |
tjs_char ShortString[TJS_VS_SHORT_LEN +1]; | |
tjs_int Length; // string length | |
tjs_uint32 HeapFlag; | |
tjs_uint32 Hint; | |
}; | |
#pragma pack(pop) | |
//--------------------------------------------------------------------------- | |
// tTJSRefHolder : a object holder for classes that has AddRef and Release methods | |
//--------------------------------------------------------------------------- | |
template <typename T> | |
class tTJSRefHolder | |
{ | |
private: | |
T *Object; | |
public: | |
tTJSRefHolder(T * ref) { Object = ref; Object->AddRef(); } | |
tTJSRefHolder(const tTJSRefHolder<T> &ref) | |
{ | |
Object = ref.Object; | |
Object->AddRef(); | |
} | |
~tTJSRefHolder() { Object->Release(); } | |
T* GetObject() { Object->AddRef(); return Object; } | |
T* GetObjectNoAddRef() { return Object; } | |
const tTJSRefHolder & operator = (const tTJSRefHolder & rhs) | |
{ | |
if(rhs.Object != Object) | |
{ | |
Object->Release(); | |
Object = rhs.Object; | |
Object->AddRef(); | |
} | |
return *this; | |
} | |
}; | |
//--------------------------------------------------------------------------- | |
// floating-point class checker | |
//--------------------------------------------------------------------------- | |
// constants used in TJSGetFPClass | |
#define TJS_FC_CLASS_MASK 7 | |
#define TJS_FC_SIGN_MASK 8 | |
#define TJS_FC_CLASS_NORMAL 0 | |
#define TJS_FC_CLASS_NAN 1 | |
#define TJS_FC_CLASS_INF 2 | |
#define TJS_FC_IS_NORMAL(x) (((x)&TJS_FC_CLASS_MASK) == TJS_FC_CLASS_NORMAL) | |
#define TJS_FC_IS_NAN(x) (((x)&TJS_FC_CLASS_MASK) == TJS_FC_CLASS_NAN) | |
#define TJS_FC_IS_INF(x) (((x)&TJS_FC_CLASS_MASK) == TJS_FC_CLASS_INF) | |
#define TJS_FC_IS_NEGATIVE(x) (0!=((x) & TJS_FC_SIGN_MASK)) | |
#define TJS_FC_IS_POSITIVE(x) (!TJS_FC_IS_NEGATIVE(x)) | |
//--------------------------------------------------------------------------- | |
// tTJSStringBufferLength | |
//--------------------------------------------------------------------------- | |
#pragma pack(push, 4) | |
class tTJSStringBufferLength | |
{ | |
public: | |
tjs_int n; | |
tTJSStringBufferLength(tjs_int n) {this->n = n;} | |
}; | |
#pragma pack(pop) | |
//--------------------------------------------------------------------------- | |
// tTJSString | |
//--------------------------------------------------------------------------- | |
#pragma pack(push, 4) | |
class tTJSVariantString; | |
struct tTJSString_S | |
{ | |
tTJSVariantString *Ptr; | |
}; | |
#pragma pack(pop) | |
class tTJSString; | |
typedef tTJSString ttstr; | |
//--------------------------------------------------------------------------- | |
// call flag type | |
//--------------------------------------------------------------------------- | |
#define TJS_MEMBERENSURE 0x00000200 // create a member if not exists | |
#define TJS_MEMBERMUSTEXIST 0x00000400 // member *must* exist ( for Dictionary/Array ) | |
#define TJS_IGNOREPROP 0x00000800 // ignore property invoking | |
#define TJS_HIDDENMEMBER 0x00001000 // member is hidden | |
#define TJS_STATICMEMBER 0x00010000 // member is not registered to the | |
// object (internal use) | |
#define TJS_ENUM_NO_VALUE 0x00100000 // values are not retrieved | |
// (for EnumMembers) | |
#define TJS_NIS_REGISTER 0x00000001 // set native pointer | |
#define TJS_NIS_GETINSTANCE 0x00000002 // get native pointer | |
#define TJS_CII_ADD 0x00000001 // register name | |
// 'num' argument passed to CII is to be igonored. | |
#define TJS_CII_GET 0x00000000 // retrieve name | |
#define TJS_CII_SET_FINALIZE 0x00000002 // register "finalize" method name | |
// (set empty string not to call the method) | |
// 'num' argument passed to CII is to be igonored. | |
#define TJS_CII_SET_MISSING 0x00000003 // register "missing" method name. | |
// the method is called when the member is not present. | |
// (set empty string not to call the method) | |
// 'num' argument passed to CII is to be igonored. | |
// the method is to be called with three arguments; | |
// get_or_set : false for get, true for set | |
// name : member name | |
// value : value property; you must | |
// : dereference using unary '*' operator. | |
// the method must return true for found, false for not-found. | |
#define TJS_CII_SET_SUPRECLASS 0x00000004 // register super class instance | |
#define TJS_CII_GET_SUPRECLASS 0x00000005 // retrieve super class instance | |
#define TJS_OL_LOCK 0x00000001 // Lock the object | |
#define TJS_OL_UNLOCK 0x00000002 // Unlock the object | |
//--------------------------------------------------------------------------- | |
// Operation flag | |
//--------------------------------------------------------------------------- | |
#define TJS_OP_BAND 0x0001 | |
#define TJS_OP_BOR 0x0002 | |
#define TJS_OP_BXOR 0x0003 | |
#define TJS_OP_SUB 0x0004 | |
#define TJS_OP_ADD 0x0005 | |
#define TJS_OP_MOD 0x0006 | |
#define TJS_OP_DIV 0x0007 | |
#define TJS_OP_IDIV 0x0008 | |
#define TJS_OP_MUL 0x0009 | |
#define TJS_OP_LOR 0x000a | |
#define TJS_OP_LAND 0x000b | |
#define TJS_OP_SAR 0x000c | |
#define TJS_OP_SAL 0x000d | |
#define TJS_OP_SR 0x000e | |
#define TJS_OP_INC 0x000f | |
#define TJS_OP_DEC 0x0010 | |
#define TJS_OP_MASK 0x001f | |
#define TJS_OP_MIN TJS_OP_BAND | |
#define TJS_OP_MAX TJS_OP_DEC | |
/* SAR = Shift Arithmetic Right, SR = Shift (bitwise) Right */ | |
//--------------------------------------------------------------------------- | |
// iTJSDispatch | |
//--------------------------------------------------------------------------- | |
/* | |
iTJSDispatch interface | |
*/ | |
class tTJSVariant; | |
class tTJSVariantClosure; | |
class tTJSVariantString; | |
class iTJSNativeInstance; | |
class iTJSDispatch2 | |
{ | |
/* | |
methods, that have "ByNum" at the end of the name, have | |
"num" parameter that enables the function to call a member with number directly. | |
following two have the same effect: | |
FuncCall(NULL, L"123", NULL, 0, NULL, NULL); | |
FuncCallByNum(NULL, 123, NULL, 0, NULL, NULL); | |
*/ | |
public: | |
virtual tjs_uint TJS_INTF_METHOD AddRef(void) = 0; | |
virtual tjs_uint TJS_INTF_METHOD Release(void) = 0; | |
public: | |
virtual tjs_error TJS_INTF_METHOD | |
FuncCall( // function invocation | |
tjs_uint32 flag, // calling flag | |
const tjs_char * membername,// member name ( NULL for a default member ) | |
tjs_uint32 *hint, // hint for the member name (in/out) | |
tTJSVariant *result, // result | |
tjs_int numparams, // number of parameters | |
tTJSVariant **param, // parameters | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
FuncCallByNum( // function invocation by index number | |
tjs_uint32 flag, // calling flag | |
tjs_int num, // index number | |
tTJSVariant *result, // result | |
tjs_int numparams, // number of parameters | |
tTJSVariant **param, // parameters | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
PropGet( // property get | |
tjs_uint32 flag, // calling flag | |
const tjs_char * membername,// member name ( NULL for a default member ) | |
tjs_uint32 *hint, // hint for the member name (in/out) | |
tTJSVariant *result, // result | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
PropGetByNum( // property get by index number | |
tjs_uint32 flag, // calling flag | |
tjs_int num, // index number | |
tTJSVariant *result, // result | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
PropSet( // property set | |
tjs_uint32 flag, // calling flag | |
const tjs_char *membername, // member name ( NULL for a default member ) | |
tjs_uint32 *hint, // hint for the member name (in/out) | |
const tTJSVariant *param, // parameters | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
PropSetByNum( // property set by index number | |
tjs_uint32 flag, // calling flag | |
tjs_int num, // index number | |
const tTJSVariant *param, // parameters | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
GetCount( // get member count | |
tjs_int *result, // variable that receives the result | |
const tjs_char *membername, // member name ( NULL for a default member ) | |
tjs_uint32 *hint, // hint for the member name (in/out) | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
GetCountByNum( // get member count by index number | |
tjs_int *result, // variable that receives the result | |
tjs_int num, // by index number | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
PropSetByVS( // property set by tTJSVariantString, for internal use | |
tjs_uint32 flag, // calling flag | |
tTJSVariantString *membername, // member name ( NULL for a default member ) | |
const tTJSVariant *param, // parameters | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
EnumMembers( // enumerate members | |
tjs_uint32 flag, // enumeration flag | |
tTJSVariantClosure *callback, // callback function interface ( called on each member ) | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
DeleteMember( // delete member | |
tjs_uint32 flag, // calling flag | |
const tjs_char *membername, // member name ( NULL for a default member ) | |
tjs_uint32 *hint, // hint for the member name (in/out) | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
DeleteMemberByNum( // delete member by index number | |
tjs_uint32 flag, // calling flag | |
tjs_int num, // index number | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
Invalidate( // invalidation | |
tjs_uint32 flag, // calling flag | |
const tjs_char *membername, // member name ( NULL for a default member ) | |
tjs_uint32 *hint, // hint for the member name (in/out) | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
InvalidateByNum( // invalidation by index number | |
tjs_uint32 flag, // calling flag | |
tjs_int num, // index number | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
IsValid( // get validation, returns TJS_S_TRUE (valid) or TJS_S_FALSE (invalid) | |
tjs_uint32 flag, // calling flag | |
const tjs_char *membername, // member name ( NULL for a default member ) | |
tjs_uint32 *hint, // hint for the member name (in/out) | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
IsValidByNum( // get validation by index number, returns TJS_S_TRUE (valid) or TJS_S_FALSE (invalid) | |
tjs_uint32 flag, // calling flag | |
tjs_int num, // index number | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
CreateNew( // create new object | |
tjs_uint32 flag, // calling flag | |
const tjs_char * membername,// member name ( NULL for a default member ) | |
tjs_uint32 *hint, // hint for the member name (in/out) | |
iTJSDispatch2 **result, // result | |
tjs_int numparams, // number of parameters | |
tTJSVariant **param, // parameters | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
CreateNewByNum( // create new object by index number | |
tjs_uint32 flag, // calling flag | |
tjs_int num, // index number | |
iTJSDispatch2 **result, // result | |
tjs_int numparams, // number of parameters | |
tTJSVariant **param, // parameters | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
Reserved1( | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
IsInstanceOf( // class instance matching returns TJS_S_FALSE or TJS_S_TRUE | |
tjs_uint32 flag, // calling flag | |
const tjs_char *membername, // member name ( NULL for a default member ) | |
tjs_uint32 *hint, // hint for the member name (in/out) | |
const tjs_char *classname, // class name to inquire | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
IsInstanceOfByNum( // class instance matching by index number | |
tjs_uint32 flag, // calling flag | |
tjs_int num, // index number | |
const tjs_char *classname, // class name to inquire | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
Operation( // operation with member | |
tjs_uint32 flag, // calling flag | |
const tjs_char *membername, // member name ( NULL for a default member ) | |
tjs_uint32 *hint, // hint for the member name (in/out) | |
tTJSVariant *result, // result ( can be NULL ) | |
const tTJSVariant *param, // parameters | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
OperationByNum( // operation with member by index number | |
tjs_uint32 flag, // calling flag | |
tjs_int num, // index number | |
tTJSVariant *result, // result ( can be NULL ) | |
const tTJSVariant *param, // parameters | |
iTJSDispatch2 *objthis // object as "this" | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
NativeInstanceSupport( // support for native instance | |
tjs_uint32 flag, // calling flag | |
tjs_int32 classid, // native class ID | |
iTJSNativeInstance **pointer// object pointer | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
ClassInstanceInfo( // support for class instance information | |
tjs_uint32 flag, // calling flag | |
tjs_uint num, // index number | |
tTJSVariant *value // the name | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
Reserved2( | |
) = 0; | |
virtual tjs_error TJS_INTF_METHOD | |
Reserved3( | |
) = 0; | |
}; | |
//--------------------------------------------------------------------------- | |
class iTJSNativeInstance | |
{ | |
public: | |
virtual tjs_error TJS_INTF_METHOD Construct(tjs_int numparams, | |
tTJSVariant **param, iTJSDispatch2 *tjs_obj) = 0; | |
// TJS constructor | |
virtual void TJS_INTF_METHOD Invalidate() = 0; | |
// called before destruction | |
virtual void TJS_INTF_METHOD Destruct() = 0; | |
// must destruct itself | |
}; | |
//--------------------------------------------------------------------------- | |
// return values as tjs_error | |
//--------------------------------------------------------------------------- | |
#define TJS_E_MEMBERNOTFOUND (-1001) | |
#define TJS_E_NOTIMPL (-1002) | |
#define TJS_E_INVALIDPARAM (-1003) | |
#define TJS_E_BADPARAMCOUNT (-1004) | |
#define TJS_E_INVALIDTYPE (-1005) | |
#define TJS_E_INVALIDOBJECT (-1006) | |
#define TJS_E_ACCESSDENYED (-1007) | |
#define TJS_E_NATIVECLASSCRASH (-1008) | |
#define TJS_S_TRUE (1) | |
#define TJS_S_FALSE (2) | |
#define TJS_S_OK (0) | |
#define TJS_E_FAIL (-1) | |
#define TJS_S_MAX (2) | |
// maximum possible number of success status. | |
// numbers over this may be regarded as a failure in | |
// strict-checking mode. | |
#ifdef TJS_STRICT_ERROR_CODE_CHECK | |
static inline bool TJS_FAILED(tjs_error hr) | |
{ | |
if(hr < 0) return true; | |
if(hr > TJS_S_MAX) return true; | |
return false; | |
} | |
#else | |
#define TJS_FAILED(x) ((x)<0) | |
#endif | |
#define TJS_SUCCEEDED(x) (!TJS_FAILED(x)) | |
static inline bool TJSIsObjectValid(tjs_error hr) | |
{ | |
// checks object validity by returning value of iTJSDispatch2::IsValid | |
if(hr == TJS_S_TRUE) return true; // mostly expected value for valid object | |
if(hr == TJS_E_NOTIMPL) return true; // also valid for object which does not implement IsValid | |
return false; // otherwise the object is not valid | |
} | |
//--------------------------------------------------------------------------- | |
// tTJSNativeInstanceType | |
//--------------------------------------------------------------------------- | |
enum tTJSNativeInstanceType | |
{ | |
nitClass, | |
nitMethod, | |
nitProperty | |
}; | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// tTJSNativeInstance | |
//--------------------------------------------------------------------------- | |
class tTJSNativeInstance : public iTJSNativeInstance | |
{ | |
public: | |
virtual tjs_error TJS_INTF_METHOD Construct(tjs_int numparams, | |
tTJSVariant **param, iTJSDispatch2 *tjs_obj) {return TJS_S_OK;} | |
virtual void TJS_INTF_METHOD Invalidate() {;} | |
virtual void TJS_INTF_METHOD Destruct() { delete this; } | |
virtual ~tTJSNativeInstance() {;}; | |
}; | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// tTJSNativeClassMethod | |
//--------------------------------------------------------------------------- | |
typedef tjs_error (TJS_INTF_METHOD *tTJSNativeClassMethodCallback) | |
(tTJSVariant *result,tjs_int numparams, tTJSVariant **param, | |
iTJSDispatch2 *objthis); | |
class tTJSNativeClassMethod : public iTJSDispatch2 { }; | |
//--------------------------------------------------------------------------- | |
// tTJSNativeClassProperty | |
//--------------------------------------------------------------------------- | |
typedef tjs_error (TJS_INTF_METHOD *tTJSNativeClassPropertyGetCallback) | |
(tTJSVariant *result, iTJSDispatch2 *objthis); | |
typedef tjs_error (TJS_INTF_METHOD *tTJSNativeClassPropertySetCallback) | |
(const tTJSVariant *param, iTJSDispatch2 *objthis); | |
class tTJSNativeClassProperty : public iTJSDispatch2 { }; | |
//--------------------------------------------------------------------------- | |
// tTJSNativeClassForPlugin : service class for plugins | |
//--------------------------------------------------------------------------- | |
typedef iTJSNativeInstance * (TJS_INTF_METHOD *tTJSCreateNativeInstance)(); | |
class tTJSNativeClass : public iTJSDispatch2 { }; | |
class tTJSNativeClassForPlugin : public tTJSNativeClass { }; | |
//--------------------------------------------------------------------------- | |
// following macros are to be written in the constructor of child class | |
// to define native methods/properties. | |
#define TJS_NCM_REG_THIS classobj | |
#define TJS_NATIVE_SET_ClassID TJS_NATIVE_CLASSID_NAME = TJS_NCM_CLASSID; | |
#define TJS_GET_NATIVE_INSTANCE(varname, typename) \ | |
if(!objthis) return TJS_E_NATIVECLASSCRASH; \ | |
typename *varname; \ | |
{ \ | |
tjs_error hr; \ | |
hr = objthis->NativeInstanceSupport(TJS_NIS_GETINSTANCE, \ | |
TJS_NATIVE_CLASSID_NAME, (iTJSNativeInstance**)&varname); \ | |
if(TJS_FAILED(hr)) return TJS_E_NATIVECLASSCRASH; \ | |
} | |
#define TJS_GET_NATIVE_INSTANCE_OUTER(classname, varname, typename) \ | |
if(!objthis) return TJS_E_NATIVECLASSCRASH; \ | |
typename *varname; \ | |
{ \ | |
tjs_error hr; \ | |
hr = objthis->NativeInstanceSupport(TJS_NIS_GETINSTANCE, \ | |
classname::ClassID, (iTJSNativeInstance**)&varname); \ | |
if(TJS_FAILED(hr)) return TJS_E_NATIVECLASSCRASH; \ | |
} | |
#define TJS_BEGIN_NATIVE_MEMBERS(classname) \ | |
{ \ | |
static const tjs_char *__classname = TJS_W(#classname); \ | |
static tjs_int32 TJS_NCM_CLASSID = \ | |
TJSRegisterNativeClass(__classname); \ | |
TJSNativeClassSetClassID(TJS_NCM_REG_THIS, TJS_NCM_CLASSID); \ | |
TJS_NATIVE_SET_ClassID | |
#define TJS_BEGIN_NATIVE_METHOD_DECL(name) \ | |
struct NCM_##name { \ | |
static tjs_error TJS_INTF_METHOD \ | |
Process( tTJSVariant *result, \ | |
tjs_int numparams, tTJSVariant **param, iTJSDispatch2 *objthis) { | |
#define TJS_END_NATIVE_METHOD_DECL_INT \ | |
} \ | |
}; | |
#define TJS_END_NATIVE_METHOD_DECL(name) \ | |
TJS_END_NATIVE_METHOD_DECL_INT \ | |
TJSNativeClassRegisterNCM(TJS_NCM_REG_THIS, TJS_W(#name), \ | |
TJSCreateNativeClassMethod(NCM_##name::Process), __classname, nitMethod); | |
#define TJS_END_NATIVE_HIDDEN_METHOD_DECL(name) \ | |
TJS_END_NATIVE_METHOD_DECL_INT \ | |
TJSNativeClassRegisterNCM(TJS_NCM_REG_THIS, TJS_W(#name), \ | |
TJSCreateNativeClassMethod(NCM_##name::Process), __classname, nitMethod, \ | |
TJS_HIDDENMEMBER); | |
#define TJS_END_NATIVE_STATIC_METHOD_DECL(name) \ | |
TJS_END_NATIVE_METHOD_DECL_INT \ | |
TJSNativeClassRegisterNCM(TJS_NCM_REG_THIS, TJS_W(#name), \ | |
TJSCreateNativeClassMethod(NCM_##name::Process), __classname, nitMethod, \ | |
TJS_STATICMEMBER); | |
#define TJS_END_NATIVE_METHOD_DECL_OUTER(object, name) \ | |
TJS_END_NATIVE_METHOD_DECL_INT \ | |
TJSNativeClassRegisterNCM((object), TJS_W(#name), \ | |
TJSCreateNativeClassMethod(NCM_##name::Process), \ | |
(object)->GetClassName().c_str(), nitMethod); | |
#define TJS_END_NATIVE_STATIC_METHOD_DECL_OUTER(object, name) \ | |
TJS_END_NATIVE_METHOD_DECL_INT \ | |
TJSNativeClassRegisterNCM((object), TJS_W(#name), \ | |
TJSCreateNativeClassMethod(NCM_##name::Process), \ | |
(object)->GetClassName().c_str(), nitMethod, TJS_STATICMEMBER); | |
#define TJS_DECL_EMPTY_FINALIZE_METHOD \ | |
TJS_BEGIN_NATIVE_METHOD_DECL(finalize) \ | |
{ return TJS_S_OK; } \ | |
TJS_END_NATIVE_METHOD_DECL(finalize) | |
#define TJS_NATIVE_CONSTRUCTOR_CALL_NATIVE_CONSTRUCTOR(varname, typename) \ | |
typename *varname; \ | |
{ \ | |
tjs_error hr; \ | |
hr = objthis->NativeInstanceSupport(TJS_NIS_GETINSTANCE, \ | |
TJS_NATIVE_CLASSID_NAME, \ | |
(iTJSNativeInstance**)&varname); \ | |
if(TJS_FAILED(hr)) return TJS_E_NATIVECLASSCRASH; \ | |
if(!varname) return TJS_E_NATIVECLASSCRASH; \ | |
hr = varname->Construct(numparams, param, objthis); \ | |
if(TJS_FAILED(hr)) return hr; \ | |
} | |
#define TJS_BEGIN_NATIVE_CONSTRUCTOR_DECL_NO_INSTANCE(classname) \ | |
struct NCM_##classname { \ | |
static tjs_error TJS_INTF_METHOD \ | |
Process(tTJSVariant *result, \ | |
tjs_int numparams, tTJSVariant **param, iTJSDispatch2 *objthis) { | |
#define TJS_BEGIN_NATIVE_CONSTRUCTOR_DECL(varname, typename, classname) \ | |
TJS_BEGIN_NATIVE_CONSTRUCTOR_DECL_NO_INSTANCE(classname) \ | |
TJS_NATIVE_CONSTRUCTOR_CALL_NATIVE_CONSTRUCTOR(varname, typename) | |
#define TJS_END_NATIVE_CONSTRUCTOR_DECL(name) \ | |
TJS_END_NATIVE_METHOD_DECL_INT \ | |
TJSNativeClassRegisterNCM(TJS_NCM_REG_THIS, TJS_W(#name), \ | |
TJSCreateNativeClassConstructor(NCM_##name::Process), __classname, \ | |
nitMethod); | |
#define TJS_END_NATIVE_STATIC_CONSTRUCTOR_DECL(name) \ | |
TJS_END_NATIVE_METHOD_DECL_INT \ | |
TJSNativeClassRegisterNCM(TJS_NCM_REG_THIS, TJS_W(#name), \ | |
TJSCreateNativeClassConstructor(NCM_##name::Process), __classname, \ | |
nitMethod, TJS_STATICMEMBER); | |
#define TJS_BEGIN_NATIVE_PROP_DECL(name) \ | |
struct NCM_##name | |
#define TJS_END_NATIVE_PROP_DECL(name) \ | |
;TJSNativeClassRegisterNCM(TJS_NCM_REG_THIS, TJS_W(#name), \ | |
TJSCreateNativeClassProperty(NCM_##name::Get, NCM_##name::Set), \ | |
__classname, nitProperty); | |
#define TJS_END_NATIVE_PROP_DECL_OUTER(object, name) \ | |
;TJSNativeClassRegisterNCM((object), TJS_W(#name), \ | |
TJSCreateNativeClassProperty(NCM_##name::Get, NCM_##name::Set), \ | |
(object)->GetClassName().c_str(), nitProperty); | |
#define TJS_END_NATIVE_STATIC_PROP_DECL(name) \ | |
;TJSNativeClassRegisterNCM(TJS_NCM_REG_THIS, TJS_W(#name), \ | |
TJSCreateNativeClassProperty(NCM_##name::Get, NCM_##name::Set), \ | |
__classname, nitProperty, TJS_STATICMEMBER); | |
#define TJS_END_NATIVE_STATIC_PROP_DECL_OUTER(object, name) \ | |
;TJSNativeClassRegisterNCM((object), TJS_W(#name), \ | |
TJSCreateNativeClassProperty(NCM_##name::Get, NCM_##name::Set), \ | |
(object)->GetClassName().c_str(), nitProperty, TJS_STATICMEMBER); | |
#define TJS_BEGIN_NATIVE_PROP_GETTER \ | |
static tjs_error TJS_INTF_METHOD Get(tTJSVariant *result, \ | |
iTJSDispatch2 *objthis) { \ | |
#define TJS_END_NATIVE_PROP_GETTER \ | |
} | |
#define TJS_DENY_NATIVE_PROP_GETTER \ | |
static tjs_error TJS_INTF_METHOD Get(tTJSVariant *result, \ | |
iTJSDispatch2 *objthis) \ | |
{ return TJS_E_ACCESSDENYED; } | |
#define TJS_BEGIN_NATIVE_PROP_SETTER \ | |
static tjs_error TJS_INTF_METHOD Set(const tTJSVariant *param, \ | |
iTJSDispatch2 *objthis) { \ | |
#define TJS_END_NATIVE_PROP_SETTER \ | |
} | |
#define TJS_DENY_NATIVE_PROP_SETTER \ | |
static tjs_error TJS_INTF_METHOD Set(const tTJSVariant *param, \ | |
iTJSDispatch2 *objthis) \ | |
{ return TJS_E_ACCESSDENYED; } | |
#define TJS_END_NATIVE_MEMBERS \ | |
} | |
#define TJS_PARAM_EXIST(num) (numparams>(num) ? param[num]->Type()!=tvtVoid : false) | |
//--------------------------------------------------------------------------- | |
// tTJSVariantOctet | |
//--------------------------------------------------------------------------- | |
#pragma pack(push, 4) | |
struct tTJSVariantOctet_S | |
{ | |
tjs_uint Length; | |
tjs_int RefCount; | |
tjs_uint8 *Data; | |
}; | |
#pragma pack(pop) | |
//--------------------------------------------------------------------------- | |
// tTJSVariant_S | |
//--------------------------------------------------------------------------- | |
#ifdef __BORLANDC__ | |
#pragma option push -b | |
#endif | |
enum tTJSVariantType | |
{ | |
tvtVoid, // empty | |
tvtObject, | |
tvtString, | |
tvtOctet, // octet binary data | |
tvtInteger, | |
tvtReal | |
}; | |
#ifdef __BORLANDC__ | |
#pragma option pop | |
#endif | |
#pragma pack(push, 4) | |
class iTJSDispatch2; | |
struct tTJSVariantClosure_S | |
{ | |
iTJSDispatch2 *Object; | |
iTJSDispatch2 *ObjThis; | |
}; | |
class tTJSVariantClosure; | |
class tTJSVariantString; | |
class tTJSVariantOctet; | |
struct tTJSVariant_S | |
{ | |
//---- data members ----------------------------------------------------- | |
#define tTJSVariant_BITCOPY(a,b) \ | |
{\ | |
*(tTJSVariant_S*)&(a) = *(tTJSVariant_S*)&(b); \ | |
} | |
union | |
{ | |
tTJSVariantClosure_S Object; | |
tTVInteger Integer; | |
tTVReal Real; | |
tTJSVariantString *String; | |
tTJSVariantOctet *Octet; | |
}; | |
tTJSVariantType vt; | |
}; | |
#pragma pack(pop) | |
//--------------------------------------------------------------------------- | |
// tTJSVariantClosure | |
//--------------------------------------------------------------------------- | |
void TJSThrowNullAccess(); | |
class tTJSVariantClosure : public tTJSVariantClosure_S | |
{ | |
// tTJSVariantClosure does not provide any function of object lifetime | |
// namagement. ( AddRef and Release are provided but tTJSVariantClosure | |
// has no responsibility for them ) | |
public: | |
tTJSVariantClosure() {;} // note that default constructor does nothing | |
tTJSVariantClosure(iTJSDispatch2 *obj, iTJSDispatch2 *objthis = NULL) | |
{ Object = obj, ObjThis = objthis; } | |
iTJSDispatch2 * SelectObjectNoAddRef() | |
{ return ObjThis ? ObjThis : Object; } | |
public: | |
bool operator == (const tTJSVariantClosure &rhs) | |
{ | |
return Object == rhs.Object && ObjThis == rhs.ObjThis; | |
} | |
bool operator != (const tTJSVariantClosure &rhs) | |
{ | |
return ! this->operator ==(rhs); | |
} | |
void AddRef() | |
{ | |
if(Object) Object->AddRef(); | |
if(ObjThis) ObjThis->AddRef(); | |
} | |
void Release() | |
{ | |
if(Object) Object->Release(); | |
if(ObjThis) ObjThis->Release(); | |
} | |
tjs_error | |
FuncCall(tjs_uint32 flag, const tjs_char * membername, tjs_uint32 *hint, | |
tTJSVariant *result, | |
tjs_int numparams, tTJSVariant **param, iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->FuncCall(flag, membername, hint, result, numparams, param, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
tjs_error | |
FuncCallByNum(tjs_uint32 flag, tjs_int num, tTJSVariant *result, | |
tjs_int numparams, tTJSVariant **param, iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->FuncCallByNum(flag, num, result, numparams, param, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
tjs_error | |
PropGet(tjs_uint32 flag, const tjs_char * membername, tjs_uint32 *hint, | |
tTJSVariant *result, | |
iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->PropGet(flag, membername, hint, result, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
tjs_error | |
PropGetByNum(tjs_uint32 flag, tjs_int num, tTJSVariant *result, | |
iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->PropGetByNum(flag, num, result, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
tjs_error | |
PropSet(tjs_uint32 flag, const tjs_char *membername, tjs_uint32 *hint, | |
const tTJSVariant *param, | |
iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->PropSet(flag, membername, hint, param, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
tjs_error | |
PropSetByNum(tjs_uint32 flag, tjs_int num, const tTJSVariant *param, | |
iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->PropSetByNum(flag, num, param, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
tjs_error | |
GetCount(tjs_int *result, const tjs_char *membername, tjs_uint32 *hint, | |
iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->GetCount(result, membername, hint, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
tjs_error | |
GetCountByNum(tjs_int *result, tjs_int num, iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->GetCountByNum(result, num, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
tjs_error | |
PropSetByVS(tjs_uint32 flag, tTJSVariantString *membername, | |
const tTJSVariant *param, iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->PropSetByVS(flag, membername, param, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
tjs_error | |
EnumMembers(tjs_uint32 flag, tTJSVariantClosure *callback, | |
iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->EnumMembers(flag, callback, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
tjs_error | |
DeleteMember(tjs_uint32 flag, const tjs_char *membername, tjs_uint32 *hint, | |
iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->DeleteMember(flag, membername, hint, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
tjs_error | |
DeleteMemberByNum(tjs_uint32 flag, tjs_int num, iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->DeleteMemberByNum(flag, num, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
tjs_error | |
Invalidate(tjs_uint32 flag, const tjs_char *membername, tjs_uint32 *hint, | |
iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->Invalidate(flag, membername, hint, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
tjs_error | |
InvalidateByNum(tjs_uint32 flag, tjs_int num, iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->InvalidateByNum(flag, num, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
tjs_error | |
IsValid(tjs_uint32 flag, const tjs_char *membername, tjs_uint32 *hint, | |
iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->IsValid(flag, membername, hint, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
tjs_error | |
IsValidByNum(tjs_uint32 flag, tjs_int num, iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->IsValidByNum(flag, num, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
tjs_error | |
CreateNew(tjs_uint32 flag, const tjs_char * membername, tjs_uint32 *hint, | |
iTJSDispatch2 **result, | |
tjs_int numparams, tTJSVariant **param, iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->CreateNew(flag, membername, hint, result, numparams, | |
param, ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
tjs_error | |
CreateNewByNum(tjs_uint32 flag, tjs_int num, iTJSDispatch2 **result, | |
tjs_int numparams, tTJSVariant **param, iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->CreateNewByNum(flag, num, result, numparams, param, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
/* | |
tjs_error | |
Reserved1() { } | |
*/ | |
tjs_error | |
IsInstanceOf(tjs_uint32 flag, const tjs_char *membername, tjs_uint32 *hint, | |
const tjs_char *classname, iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->IsInstanceOf(flag, membername, hint, classname, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
tjs_error | |
IsInstanceOf(tjs_uint32 flag, tjs_int num, tjs_char *classname, | |
iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->IsInstanceOfByNum(flag, num, classname, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
tjs_error | |
Operation(tjs_uint32 flag, const tjs_char *membername, tjs_uint32 *hint, | |
tTJSVariant *result, const tTJSVariant *param, iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->Operation(flag, membername, hint, result, param, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
tjs_error | |
OperationByNum(tjs_uint32 flag, tjs_int num, tTJSVariant *result, | |
const tTJSVariant *param, iTJSDispatch2 *objthis) const | |
{ | |
if(!Object) TJSThrowNullAccess(); | |
return Object->OperationByNum(flag, num, result, param, | |
ObjThis?ObjThis:(objthis?objthis:Object)); | |
} | |
/* | |
tjs_error | |
Reserved2() { } | |
*/ | |
/* | |
tjs_error | |
Reserved3() { } | |
*/ | |
}; | |
//--------------------------------------------------------------------------- | |
// iTJSTextStream - used by Array.save/load Dictionaty.save/load | |
//--------------------------------------------------------------------------- | |
class tTJSString; | |
class iTJSTextReadStream | |
{ | |
public: | |
virtual tjs_uint TJS_INTF_METHOD Read(tTJSString & targ, tjs_uint size) = 0; | |
virtual void TJS_INTF_METHOD Destruct() = 0; // must delete itself | |
}; | |
//--------------------------------------------------------------------------- | |
class iTJSTextWriteStream | |
{ | |
public: | |
virtual void TJS_INTF_METHOD Write(const tTJSString & targ) = 0; | |
virtual void TJS_INTF_METHOD Destruct() = 0; // must delete itself | |
}; | |
//--------------------------------------------------------------------------- | |
extern iTJSTextReadStream * (*TJSCreateTextStreamForRead)(const tTJSString &name, | |
const tTJSString &modestr); | |
extern iTJSTextWriteStream * (*TJSCreateTextStreamForWrite)(const tTJSString &name, | |
const tTJSString &modestr); | |
extern class tTJSBinaryStream * (*TJSCreateBinaryStreamForRead)(const tTJSString &name, | |
const tTJSString &modestr); | |
extern class tTJSBinaryStream * (*TJSCreateBinaryStreamForWrite)(const tTJSString &name, | |
const tTJSString &modestr); | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// tTJSBinaryStream constants | |
//--------------------------------------------------------------------------- | |
#define TJS_BS_READ 0 | |
#define TJS_BS_WRITE 1 | |
#define TJS_BS_APPEND 2 | |
#define TJS_BS_UPDATE 3 | |
#define TJS_BS_ACCESS_MASK 0x0f | |
#define TJS_BS_SEEK_SET 0 | |
#define TJS_BS_SEEK_CUR 1 | |
#define TJS_BS_SEEK_END 2 | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// tTJSDispatch | |
//--------------------------------------------------------------------------- | |
/* | |
tTJSDispatch is a base class that implements iTJSDispatch2, and every methods. | |
most methods are maked as simply returning "TJS_E_NOTIMPL"; | |
methods, those access the object by index, call another methods that access | |
the object by string. | |
*/ | |
/* | |
#define TJS_SELECT_OBJTHIS(__closure__, __override__) \ | |
((__closure__).ObjThis?((__override__)?(__override__):(__closure__).ObjThis):(__override__)) | |
*/ | |
#define TJS_SELECT_OBJTHIS(__closure__, __override__) \ | |
((__closure__).ObjThis?(__closure__).ObjThis:(__override__)) | |
class tTJSDispatch : public iTJSDispatch2 | |
{ | |
virtual void BeforeDestruction(void) {;} | |
bool BeforeDestructionCalled; | |
// BeforeDestruction will be certainly called before object destruction | |
private: | |
tjs_uint RefCount; | |
public: | |
tTJSDispatch(); | |
virtual ~tTJSDispatch(); | |
// bool DestructionTrace; | |
public: | |
tjs_uint TJS_INTF_METHOD AddRef(void); | |
tjs_uint TJS_INTF_METHOD Release(void); | |
protected: | |
tjs_uint GetRefCount() { return RefCount; } | |
public: | |
tjs_error TJS_INTF_METHOD | |
FuncCall( | |
tjs_uint32 flag, | |
const tjs_char * membername, | |
tjs_uint32 *hint, | |
tTJSVariant *result, | |
tjs_int numparams, | |
tTJSVariant **param, | |
iTJSDispatch2 *objthis | |
) | |
{ | |
return membername?TJS_E_MEMBERNOTFOUND:TJS_E_NOTIMPL; | |
} | |
tjs_error TJS_INTF_METHOD | |
FuncCallByNum( | |
tjs_uint32 flag, | |
tjs_int num, | |
tTJSVariant *result, | |
tjs_int numparams, | |
tTJSVariant **param, | |
iTJSDispatch2 *objthis | |
); | |
tjs_error TJS_INTF_METHOD | |
PropGet( | |
tjs_uint32 flag, | |
const tjs_char * membername, | |
tjs_uint32 *hint, | |
tTJSVariant *result, | |
iTJSDispatch2 *objthis | |
) | |
{ | |
return membername?TJS_E_MEMBERNOTFOUND:TJS_E_NOTIMPL; | |
} | |
tjs_error TJS_INTF_METHOD | |
PropGetByNum( | |
tjs_uint32 flag, | |
tjs_int num, | |
tTJSVariant *result, | |
iTJSDispatch2 *objthis | |
); | |
tjs_error TJS_INTF_METHOD | |
PropSet( | |
tjs_uint32 flag, | |
const tjs_char *membername, | |
tjs_uint32 *hint, | |
const tTJSVariant *param, | |
iTJSDispatch2 *objthis | |
) | |
{ | |
return membername?TJS_E_MEMBERNOTFOUND:TJS_E_NOTIMPL; | |
} | |
tjs_error TJS_INTF_METHOD | |
PropSetByNum( | |
tjs_uint32 flag, | |
tjs_int num, | |
const tTJSVariant *param, | |
iTJSDispatch2 *objthis | |
); | |
tjs_error TJS_INTF_METHOD | |
GetCount( | |
tjs_int *result, | |
const tjs_char *membername, | |
tjs_uint32 *hint, | |
iTJSDispatch2 *objthis | |
) | |
{ | |
return TJS_E_NOTIMPL; | |
} | |
tjs_error TJS_INTF_METHOD | |
GetCountByNum( | |
tjs_int *result, | |
tjs_int num, | |
iTJSDispatch2 *objthis | |
); | |
tjs_error TJS_INTF_METHOD | |
PropSetByVS(tjs_uint32 flag, tTJSVariantString *membername, | |
const tTJSVariant *param, iTJSDispatch2 *objthis) | |
{ | |
return TJS_E_NOTIMPL; | |
} | |
tjs_error TJS_INTF_METHOD | |
EnumMembers(tjs_uint32 flag, tTJSVariantClosure *callback, iTJSDispatch2 *objthis) | |
{ | |
return TJS_E_NOTIMPL; | |
} | |
tjs_error TJS_INTF_METHOD | |
DeleteMember( | |
tjs_uint32 flag, | |
const tjs_char *membername, | |
tjs_uint32 *hint, | |
iTJSDispatch2 *objthis | |
) | |
{ | |
return membername?TJS_E_MEMBERNOTFOUND:TJS_E_NOTIMPL; | |
} | |
tjs_error TJS_INTF_METHOD | |
DeleteMemberByNum( | |
tjs_uint32 flag, | |
tjs_int num, | |
iTJSDispatch2 *objthis | |
); | |
tjs_error TJS_INTF_METHOD | |
Invalidate( | |
tjs_uint32 flag, | |
const tjs_char *membername, | |
tjs_uint32 *hint, | |
iTJSDispatch2 *objthis | |
) | |
{ | |
return membername?TJS_E_MEMBERNOTFOUND:TJS_E_NOTIMPL; | |
} | |
tjs_error TJS_INTF_METHOD | |
InvalidateByNum( | |
tjs_uint32 flag, | |
tjs_int num, | |
iTJSDispatch2 *objthis | |
); | |
tjs_error TJS_INTF_METHOD | |
IsValid( | |
tjs_uint32 flag, | |
const tjs_char *membername, | |
tjs_uint32 *hint, | |
iTJSDispatch2 *objthis | |
) | |
{ | |
return membername?TJS_E_MEMBERNOTFOUND:TJS_E_NOTIMPL; | |
} | |
tjs_error TJS_INTF_METHOD | |
IsValidByNum( | |
tjs_uint32 flag, | |
tjs_int num, | |
iTJSDispatch2 *objthis | |
); | |
tjs_error TJS_INTF_METHOD | |
CreateNew( | |
tjs_uint32 flag, | |
const tjs_char * membername, | |
tjs_uint32 *hint, | |
iTJSDispatch2 **result, | |
tjs_int numparams, | |
tTJSVariant **param, | |
iTJSDispatch2 *objthis | |
) | |
{ | |
return membername?TJS_E_MEMBERNOTFOUND:TJS_E_NOTIMPL; | |
} | |
tjs_error TJS_INTF_METHOD | |
CreateNewByNum( | |
tjs_uint32 flag, | |
tjs_int num, | |
iTJSDispatch2 **result, | |
tjs_int numparams, | |
tTJSVariant **param, | |
iTJSDispatch2 *objthis | |
); | |
tjs_error TJS_INTF_METHOD | |
Reserved1( | |
) | |
{ | |
return TJS_E_NOTIMPL; | |
} | |
tjs_error TJS_INTF_METHOD | |
IsInstanceOf( | |
tjs_uint32 flag, | |
const tjs_char *membername, | |
tjs_uint32 *hint, | |
const tjs_char *classname, | |
iTJSDispatch2 *objthis | |
) | |
{ | |
return membername?TJS_E_MEMBERNOTFOUND:TJS_E_NOTIMPL; | |
} | |
tjs_error TJS_INTF_METHOD | |
IsInstanceOfByNum( | |
tjs_uint32 flag, | |
tjs_int num, | |
const tjs_char *classname, | |
iTJSDispatch2 *objthis | |
); | |
tjs_error TJS_INTF_METHOD | |
Operation( | |
tjs_uint32 flag, | |
const tjs_char *membername, | |
tjs_uint32 *hint, | |
tTJSVariant *result, | |
const tTJSVariant *param, | |
iTJSDispatch2 *objthis | |
); | |
tjs_error TJS_INTF_METHOD | |
OperationByNum( | |
tjs_uint32 flag, | |
tjs_int num, | |
tTJSVariant *result, | |
const tTJSVariant *param, | |
iTJSDispatch2 *objthis | |
); | |
tjs_error TJS_INTF_METHOD | |
NativeInstanceSupport( | |
tjs_uint32 flag, | |
tjs_int32 classid, | |
iTJSNativeInstance **pointer | |
) | |
{ | |
return TJS_E_NOTIMPL; | |
} | |
tjs_error TJS_INTF_METHOD | |
ClassInstanceInfo( | |
tjs_uint32 flag, | |
tjs_uint num, | |
tTJSVariant *value | |
) | |
{ | |
return TJS_E_NOTIMPL; | |
} | |
tjs_error TJS_INTF_METHOD | |
Reserved2( | |
) | |
{ | |
return TJS_E_NOTIMPL; | |
} | |
tjs_error TJS_INTF_METHOD | |
Reserved3( | |
) | |
{ | |
return TJS_E_NOTIMPL; | |
} | |
}; | |
//--------------------------------------------------------------------------- | |
#ifdef __BORLANDC__ | |
#pragma warn -8027 | |
#endif | |
//--------------------------------------------------------------------------- | |
// function import pointers | |
//--------------------------------------------------------------------------- | |
extern void * TVPGetImportFuncPtr(const char *name); | |
//--------------------------------------------------------------------------- | |
// tTJSVariantString | |
//--------------------------------------------------------------------------- | |
class tTJSVariantString : protected tTJSVariantString_S | |
{ | |
// do not create an instance of this class directly. | |
public: | |
}; | |
//--------------------------------------------------------------------------- | |
// tTJSVariantOctet | |
//--------------------------------------------------------------------------- | |
class tTJSVariantOctet : protected tTJSVariantOctet_S | |
{ | |
// do not create an instance of this class directly. | |
public: | |
}; | |
//--------------------------------------------------------------------------- | |
// tTJSVariant | |
//--------------------------------------------------------------------------- | |
class tTJSVariant : protected tTJSVariant_S | |
{ | |
public: | |
}; | |
//--------------------------------------------------------------------------- | |
// tTJSString | |
//--------------------------------------------------------------------------- | |
class tTJSString : protected tTJSString_S | |
{ | |
public: | |
friend tTJSString operator + (const tjs_char *lhs, const tTJSString &rhs); | |
}; | |
//--------------------------------------------------------------------------- | |
// stubs (misc) | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// iTVPStorageMedia | |
//--------------------------------------------------------------------------- | |
/* | |
abstract class for managing media ( like file: http: etc.) | |
*/ | |
// for plug-in | |
class tTJSBinaryStream; | |
//--------------------------------------------------------------------------- | |
class iTVPStorageLister // callback class for GetListAt | |
{ | |
public: | |
virtual void TJS_INTF_METHOD Add(const ttstr &file) = 0; | |
}; | |
//--------------------------------------------------------------------------- | |
class iTVPStorageMedia | |
{ | |
public: | |
virtual void TJS_INTF_METHOD AddRef() = 0; | |
virtual void TJS_INTF_METHOD Release() = 0; | |
virtual void TJS_INTF_METHOD GetName(ttstr &name) = 0; | |
// returns media name like "file", "http" etc. | |
// virtual bool TJS_INTF_METHOD IsCaseSensitive() = 0; | |
// returns whether this media is case sensitive or not | |
virtual void TJS_INTF_METHOD NormalizeDomainName(ttstr &name) = 0; | |
// normalize domain name according with the media's rule | |
virtual void TJS_INTF_METHOD NormalizePathName(ttstr &name) = 0; | |
// normalize path name according with the media's rule | |
// "name" below is normalized but does not contain media, eg. | |
// not "media://domain/path" but "domain/path" | |
virtual bool TJS_INTF_METHOD CheckExistentStorage(const ttstr &name) = 0; | |
// check file existence | |
virtual tTJSBinaryStream * TJS_INTF_METHOD Open(const ttstr & name, tjs_uint32 flags) = 0; | |
// open a storage and return a tTJSBinaryStream instance. | |
// name does not contain in-archive storage name but | |
// is normalized. | |
virtual void TJS_INTF_METHOD GetListAt(const ttstr &name, iTVPStorageLister * lister) = 0; | |
// list files at given place | |
virtual void TJS_INTF_METHOD GetLocallyAccessibleName(ttstr &name) = 0; | |
// basically the same as above, | |
// check wether given name is easily accessible from local OS filesystem. | |
// if true, returns local OS native name. otherwise returns an empty string. | |
}; | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// Extraction filter related | |
//--------------------------------------------------------------------------- | |
#pragma pack(push, 4) | |
struct tTVPXP3ExtractionFilterInfo | |
{ | |
const tjs_uint SizeOfSelf; // structure size of tTVPXP3ExtractionFilterInfo itself | |
const tjs_uint64 Offset; // offset of the buffer data in uncompressed stream position | |
void * Buffer; // target data buffer | |
const tjs_uint BufferSize; // buffer size in bytes pointed by "Buffer" | |
const tjs_uint32 FileHash; // hash value of the file (since inteface v2) | |
tTVPXP3ExtractionFilterInfo(tjs_uint64 offset, void *buffer, | |
tjs_uint buffersize, tjs_uint32 filehash) : | |
Offset(offset), Buffer(buffer), BufferSize(buffersize), | |
FileHash(filehash), | |
SizeOfSelf(sizeof(tTVPXP3ExtractionFilterInfo)) {;} | |
}; | |
#pragma pack(pop) | |
#ifndef TVP_tTVPXP3ArchiveExtractionFilter_CONVENTION | |
#ifdef _WIN32 | |
#define TVP_tTVPXP3ArchiveExtractionFilter_CONVENTION _stdcall | |
#else | |
#define TVP_tTVPXP3ArchiveExtractionFilter_CONVENTION | |
#endif | |
#endif | |
// TVP_tTVPXP3ArchiveExtractionFilter_CONV is _stdcall on win32 platforms, | |
// for backward application compatibility. | |
typedef void (TVP_tTVPXP3ArchiveExtractionFilter_CONVENTION * | |
tTVPXP3ArchiveExtractionFilter)(tTVPXP3ExtractionFilterInfo *info); | |
//--------------------------------------------------------------------------- | |
// Script Event Related | |
//--------------------------------------------------------------------------- | |
#define TVP_EPT_POST 0x00 // normal post, simply add to queue | |
#define TVP_EPT_REMOVE_POST 0x01 | |
// remove event in pending queue that has same target, source, tag and | |
// name before post | |
// (for input events, only the source and the tag are to be checked) | |
#define TVP_EPT_IMMEDIATE 0x02 | |
// the event will be delivered immediately | |
#define TVP_EPT_DISCARDABLE 0x10 | |
// the event can be discarded when event system is disabled | |
#define TVP_EPT_NORMAL 0x00 | |
// (with TVP_EPT_POST only) | |
// the event will have normal priority. | |
#define TVP_EPT_EXCLUSIVE 0x20 | |
// (with TVP_EPT_POST only) | |
// the event is given priority and other posted events are not processed | |
// until the exclusive event is processed. | |
#define TVP_EPT_IDLE 0x40 | |
// (with TVP_EPT_POST only) | |
// the event is only delivered after the system processes all other events. | |
// this will have a priority roughly identical to "continuous" events. | |
#define TVP_EPT_PRIO_MASK 0xe0 | |
#define TVP_EPT_METHOD_MASK 0x0f | |
class tTVPContinuousEventCallbackIntf // callback class for continuous event delivering | |
{ | |
public: | |
virtual void TJS_INTF_METHOD OnContinuousCallback(tjs_uint64 tick) = 0; | |
}; | |
//--------------------------------------------------------------------------- | |
// System "Compact" Event related | |
//--------------------------------------------------------------------------- | |
#define TVP_COMPACT_LEVEL_IDLE 5 // the application is in idle state | |
#define TVP_COMPACT_LEVEL_DEACTIVATE 10 // the application had been deactivated | |
#define TVP_COMPACT_LEVEL_MINIMIZE 15 // the application had been minimized | |
#define TVP_COMPACT_LEVEL_MAX 100 // strongest level, should clear all caches | |
//--------------------------------------------------------------------------- | |
class tTVPCompactEventCallbackIntf // callback class for compact event delivering | |
{ | |
public: | |
virtual void TJS_INTF_METHOD OnCompact(tjs_int level) = 0; | |
}; | |
//--------------------------------------------------------------------------- | |
// AsyncTrigger related | |
//--------------------------------------------------------------------------- | |
enum tTVPAsyncTriggerMode | |
{ | |
atmNormal, atmExclusive, atmAtIdle | |
}; | |
//--------------------------------------------------------------------------- | |
// iTVPFunctionExporter, exporting main module's functions | |
//--------------------------------------------------------------------------- | |
struct iTVPFunctionExporter | |
{ | |
virtual bool TJS_INTF_METHOD QueryFunctions(const tjs_char **name, void **function, | |
tjs_uint count) = 0; | |
virtual bool TJS_INTF_METHOD QueryFunctionsByNarrowString(const char **name, | |
void **function, tjs_uint count) = 0; | |
}; | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// this stub includes exported function from Independent implementation of | |
// MD5 (RFC 1321) by Aladdin Enterprises. | |
//--------------------------------------------------------------------------- | |
// TVP_md5_init, TVP_md5_append, TVP_md5_finish are exported | |
typedef struct TVP_md5_state_s { tjs_uint8 buffer[4*2+8+4*4+8+64]; } TVP_md5_state_t; // md5_state_t | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// data types for TVPDoTryBlock | |
//--------------------------------------------------------------------------- | |
// TVPDoTryBlock executes specified 'tryblock' in try block. | |
// If any exception occured, | |
// 'catchblock' is to be executed. 'data' is applicatoin defined data | |
// block passed to 'tryblock' and 'catchblock' and 'finallyblock'. | |
// if the 'catchblock' returns true, the exception is to be rethrown. | |
// if false then the exception is to be vanished. | |
// 'finallyblock' can be null, is to be executed whatever the exception | |
// is generated or not. | |
struct tTVPExceptionDesc | |
{ | |
ttstr type; // the exception type, currently 'eTJS' or 'unknown' | |
ttstr message; // the exception message (if exists. otherwise empty). | |
}; | |
typedef void (TJS_USERENTRY *tTVPTryBlockFunction)(void * data); | |
typedef bool (TJS_USERENTRY *tTVPCatchBlockFunction)(void * data, const tTVPExceptionDesc & desc); | |
typedef void (TJS_USERENTRY *tTVPFinallyBlockFunction)(void *data); | |
//--------------------------------------------------------------------------- | |
const tjs_int TVPMaxThreadNum = 8; | |
typedef void (TJS_USERENTRY *TVP_THREAD_TASK_FUNC)(void *); | |
typedef void * TVP_THREAD_PARAM; | |
//--------------------------------------------------------------------------- | |
// tTVPClipboardFormat | |
//--------------------------------------------------------------------------- | |
enum tTVPClipboardFormat | |
{ | |
cbfText = 1 | |
}; | |
//--------------------------------------------------------------------------- | |
// Sound Global Focus Mode | |
//--------------------------------------------------------------------------- | |
enum tTVPSoundGlobalFocusMode | |
{ | |
/*0*/ sgfmNeverMute, // never mutes | |
/*1*/ sgfmMuteOnMinimize, // will mute on the application minimize | |
/*2*/ sgfmMuteOnDeactivate // will mute on the application deactivation | |
}; | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// PCM data format (internal use) | |
//--------------------------------------------------------------------------- | |
struct tTVPWaveFormat | |
{ | |
tjs_uint SamplesPerSec; // sample granule per sec | |
tjs_uint Channels; | |
tjs_uint BitsPerSample; // per one sample | |
tjs_uint BytesPerSample; // per one sample | |
tjs_uint64 TotalSamples; // in sample granule; unknown for zero | |
tjs_uint64 TotalTime; // in ms; unknown for zero | |
tjs_uint32 SpeakerConfig; // bitwise OR of SPEAKER_* constants | |
bool IsFloat; // true if the data is IEEE floating point | |
bool Seekable; | |
}; | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// IDirectSound former declaration | |
//--------------------------------------------------------------------------- | |
#ifndef __DSOUND_INCLUDED__ | |
struct IDirectSound; | |
#endif | |
//--------------------------------------------------------------------------- | |
// Graphic Loading Handler Type | |
//--------------------------------------------------------------------------- | |
typedef void (*tTVPGraphicSizeCallback) | |
(void *callbackdata, tjs_uint w, tjs_uint h); | |
/* | |
callback type to inform the image's size. | |
call this once before TVPGraphicScanLineCallback. | |
*/ | |
typedef void * (*tTVPGraphicScanLineCallback) | |
(void *callbackdata, tjs_int y); | |
/* | |
callback type to ask the scanline buffer for the decoded image, per a line. | |
returning null can stop the processing. | |
passing of y=-1 notifies the scan line image had been written to the buffer that | |
was given by previous calling of TVPGraphicScanLineCallback. in this time, | |
this callback function must return NULL. | |
*/ | |
typedef const void * (*tTVPGraphicSaveScanLineCallback) | |
(void *callbackdata, tjs_int y); | |
typedef void (*tTVPMetaInfoPushCallback) | |
(void *callbackdata, const ttstr & name, const ttstr & value); | |
/* | |
callback type to push meta-information of the image. | |
this can be null. | |
*/ | |
enum tTVPGraphicLoadMode | |
{ | |
glmNormal, // normal, ie. 32bit ARGB graphic | |
glmPalettized, // palettized 8bit mode | |
glmGrayscale // grayscale 8bit mode | |
}; | |
typedef bool (*tTVPGraphicAcceptSaveHandler)(void* formatdata, const ttstr & type, class iTJSDispatch2** dic ); | |
/* For grahpic load and save */ | |
typedef void (*tTVPGraphicLoadingHandlerForPlugin)(void* formatdata, | |
void *callbackdata, | |
tTVPGraphicSizeCallback sizecallback, | |
tTVPGraphicScanLineCallback scanlinecallback, | |
tTVPMetaInfoPushCallback metainfopushcallback, | |
struct IStream *src, | |
tjs_int32 keyidx, | |
tTVPGraphicLoadMode mode); | |
typedef void (*tTVPGraphicHeaderLoadingHandlerForPlugin)(void* formatdata, struct IStream* src, class iTJSDispatch2** dic ); | |
typedef void (*tTVPGraphicSaveHandlerForPlugin)(void* formatdata, void* callbackdata, struct IStream* dst, const ttstr & mode, | |
tjs_uint width, tjs_uint height, | |
tTVPGraphicSaveScanLineCallback scanlinecallback, | |
class iTJSDispatch2* meta ); | |
//--------------------------------------------------------------------------- | |
// font ralated constants | |
//--------------------------------------------------------------------------- | |
#define TVP_TF_ITALIC 0x0100 | |
#define TVP_TF_BOLD 0x0200 | |
#define TVP_TF_UNDERLINE 0x0400 | |
#define TVP_TF_STRIKEOUT 0x0800 | |
#define TVP_TF_FONTFILE 0x1000 | |
//--------------------------------------------------------------------------- | |
#define TVP_FSF_FIXEDPITCH 0x01 // fsfFixedPitch | |
#define TVP_FSF_SAMECHARSET 0x02 // fsfSameCharSet | |
#define TVP_FSF_NOVERTICAL 0x04 // fsfNoVertical | |
#define TVP_FSF_TRUETYPEONLY 0x08 // fsfTrueTypeOnly | |
#define TVP_FSF_IGNORESYMBOL 0x10 // fsfIgnoreSymbol | |
#define TVP_FSF_USEFONTFACE 0x100 // fsfUseFontFace | |
//--------------------------------------------------------------------------- | |
// mouse button | |
//--------------------------------------------------------------------------- | |
enum tTVPMouseButton | |
{ | |
mbLeft, | |
mbRight, | |
mbMiddle, | |
mbX1, | |
mbX2 | |
}; | |
//--------------------------------------------------------------------------- | |
// IME modes : comes from VCL's TImeMode | |
//--------------------------------------------------------------------------- | |
enum tTVPImeMode | |
{ | |
imDisable, | |
imClose, | |
imOpen, | |
imDontCare, | |
imSAlpha, | |
imAlpha, | |
imHira, | |
imSKata, | |
imKata, | |
imChinese, | |
imSHanguel, | |
imHanguel | |
}; | |
//--------------------------------------------------------------------------- | |
// shift state | |
//--------------------------------------------------------------------------- | |
#define TVP_SS_SHIFT 0x01 | |
#define TVP_SS_ALT 0x02 | |
#define TVP_SS_CTRL 0x04 | |
#define TVP_SS_LEFT 0x08 | |
#define TVP_SS_RIGHT 0x10 | |
#define TVP_SS_MIDDLE 0x20 | |
#define TVP_SS_DOUBLE 0x40 | |
#define TVP_SS_REPEAT 0x80 | |
inline bool TVPIsAnyMouseButtonPressedInShiftStateFlags(tjs_uint32 state) | |
{ return (state & | |
(TVP_SS_LEFT | TVP_SS_RIGHT | TVP_SS_MIDDLE | TVP_SS_DOUBLE)) != 0; } | |
//--------------------------------------------------------------------------- | |
// JoyPad virtual key codes | |
//--------------------------------------------------------------------------- | |
// These VKs are KIRIKIRI specific. Not widely used. | |
#define VK_PAD_FIRST 0x1B0 // first PAD related key code | |
#define VK_PADLEFT 0x1B5 | |
#define VK_PADUP 0x1B6 | |
#define VK_PADRIGHT 0x1B7 | |
#define VK_PADDOWN 0x1B8 | |
#define VK_PAD1 0x1C0 | |
#define VK_PAD2 0x1C1 | |
#define VK_PAD3 0x1C2 | |
#define VK_PAD4 0x1C3 | |
#define VK_PAD5 0x1C4 | |
#define VK_PAD6 0x1C5 | |
#define VK_PAD7 0x1C6 | |
#define VK_PAD8 0x1C7 | |
#define VK_PAD9 0x1C8 | |
#define VK_PAD10 0x1C9 | |
#define VK_PADANY 0x1DF // returns whether any one of pad buttons are pressed, | |
// in System.getKeyState | |
#define VK_PAD_LAST 0x1DF // last PAD related key code | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// tTVPBBBltMethod and tTVPBBStretchType | |
//--------------------------------------------------------------------------- | |
enum tTVPBBBltMethod | |
{ | |
bmCopy, | |
bmCopyOnAlpha, | |
bmAlpha, | |
bmAlphaOnAlpha, | |
bmAdd, | |
bmSub, | |
bmMul, | |
bmDodge, | |
bmDarken, | |
bmLighten, | |
bmScreen, | |
bmAddAlpha, | |
bmAddAlphaOnAddAlpha, | |
bmAddAlphaOnAlpha, | |
bmAlphaOnAddAlpha, | |
bmCopyOnAddAlpha, | |
bmPsNormal, | |
bmPsAdditive, | |
bmPsSubtractive, | |
bmPsMultiplicative, | |
bmPsScreen, | |
bmPsOverlay, | |
bmPsHardLight, | |
bmPsSoftLight, | |
bmPsColorDodge, | |
bmPsColorDodge5, | |
bmPsColorBurn, | |
bmPsLighten, | |
bmPsDarken, | |
bmPsDifference, | |
bmPsDifference5, | |
bmPsExclusion | |
}; | |
enum tTVPBBStretchType | |
{ | |
stNearest = 0, // primal method; nearest neighbor method | |
stFastLinear = 1, // fast linear interpolation (does not have so much precision) | |
stLinear = 2, // (strict) linear interpolation | |
stCubic = 3, // cubic interpolation | |
stSemiFastLinear = 4, | |
stFastCubic = 5, | |
stLanczos2 = 6, // Lanczos 2 interpolation | |
stFastLanczos2 = 7, | |
stLanczos3 = 8, // Lanczos 3 interpolation | |
stFastLanczos3 = 9, | |
stSpline16 = 10, // Spline16 interpolation | |
stFastSpline16 = 11, | |
stSpline36 = 12, // Spline36 interpolation | |
stFastSpline36 = 13, | |
stAreaAvg = 14, // Area average interpolation | |
stFastAreaAvg = 15, | |
stGaussian = 16, | |
stFastGaussian = 17, | |
stBlackmanSinc = 18, | |
stFastBlackmanSinc = 19, | |
stTypeMask = 0x0000ffff, // stretch type mask | |
stFlagMask = 0xffff0000, // flag mask | |
stRefNoClip = 0x10000 // referencing source is not limited by the given rectangle | |
// (may allow to see the border pixel to interpolate) | |
}; | |
//--------------------------------------------------------------------------- | |
// layer / blending types | |
//--------------------------------------------------------------------------- | |
enum tTVPLayerType | |
{ | |
ltBinder = 0, | |
ltCoverRect = 1, | |
ltOpaque = 1, // the same as ltCoverRect | |
ltTransparent = 2, // alpha blend | |
ltAlpha = 2, // the same as ltTransparent | |
ltAdditive = 3, | |
ltSubtractive = 4, | |
ltMultiplicative = 5, | |
ltEffect = 6, | |
ltFilter = 7, | |
ltDodge = 8, | |
ltDarken = 9, | |
ltLighten = 10, | |
ltScreen = 11, | |
ltAddAlpha = 12, // additive alpha blend | |
ltPsNormal = 13, | |
ltPsAdditive = 14, | |
ltPsSubtractive = 15, | |
ltPsMultiplicative = 16, | |
ltPsScreen = 17, | |
ltPsOverlay = 18, | |
ltPsHardLight = 19, | |
ltPsSoftLight = 20, | |
ltPsColorDodge = 21, | |
ltPsColorDodge5 = 22, | |
ltPsColorBurn = 23, | |
ltPsLighten = 24, | |
ltPsDarken = 25, | |
ltPsDifference = 26, | |
ltPsDifference5 = 27, | |
ltPsExclusion = 28 | |
}; | |
//--------------------------------------------------------------------------- | |
static bool inline TVPIsTypeUsingAlpha(tTVPLayerType type) | |
{ | |
return | |
type == ltAlpha || | |
type == ltPsNormal || | |
type == ltPsAdditive || | |
type == ltPsSubtractive || | |
type == ltPsMultiplicative || | |
type == ltPsScreen || | |
type == ltPsOverlay || | |
type == ltPsHardLight || | |
type == ltPsSoftLight || | |
type == ltPsColorDodge || | |
type == ltPsColorDodge5 || | |
type == ltPsColorBurn || | |
type == ltPsLighten || | |
type == ltPsDarken || | |
type == ltPsDifference || | |
type == ltPsDifference5 || | |
type == ltPsExclusion ; | |
} | |
static bool inline TVPIsTypeUsingAddAlpha(tTVPLayerType type) | |
{ | |
return type == ltAddAlpha; | |
} | |
static bool inline TVPIsTypeUsingAlphaChannel(tTVPLayerType type) | |
{ | |
return | |
TVPIsTypeUsingAddAlpha(type) || | |
TVPIsTypeUsingAlpha(type); | |
} | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// tTVPRect - simple rectangle structure | |
//--------------------------------------------------------------------------- | |
#pragma pack(push, 4) | |
struct tTVPPoint | |
{ | |
tjs_int x; | |
tjs_int y; | |
}; | |
#pragma pack(pop) | |
//--------------------------------------------------------------------------- | |
struct tTVPPointD | |
{ | |
double x; | |
double y; | |
}; | |
//--------------------------------------------------------------------------- | |
struct tTVPRect | |
{ | |
tTVPRect(tjs_int l, tjs_int t, tjs_int r, tjs_int b) | |
{ left = l, top = t, right = r, bottom =b; } | |
tTVPRect() {}; | |
union | |
{ | |
struct | |
{ | |
tjs_int left; | |
tjs_int top; | |
tjs_int right; | |
tjs_int bottom; | |
}; | |
struct | |
{ | |
// capital style | |
tjs_int Left; | |
tjs_int Top; | |
tjs_int Right; | |
tjs_int Bottom; | |
}; | |
struct | |
{ | |
tTVPPoint upper_left; | |
tTVPPoint bottom_right; | |
}; | |
tjs_int array[4]; | |
}; | |
tjs_int get_width() const { return right - left; } | |
tjs_int get_height() const { return bottom - top; } | |
void set_width(tjs_int w) { right = left + w; } | |
void set_height(tjs_int h) { bottom = top + h; } | |
void add_offsets(tjs_int x, tjs_int y) | |
{ | |
left += x; right += x; | |
top += y; bottom += y; | |
} | |
void set_offsets(tjs_int x, tjs_int y) | |
{ | |
tjs_int w = get_width(); | |
tjs_int h = get_height(); | |
left = x; | |
top = y; | |
right = x + w; | |
bottom = y + h; | |
} | |
void set_size(tjs_int w, tjs_int h) | |
{ | |
right = left + w; | |
bottom = top + h; | |
} | |
void clear() | |
{ | |
left = top = right = bottom = 0; | |
} | |
bool is_empty() const | |
{ | |
return left >= right || top >= bottom; | |
} | |
bool do_union(const tTVPRect & ref) | |
{ | |
if(ref.is_empty()) return false; | |
if(left > ref.left) left = ref.left; | |
if(top > ref.top) top = ref.top; | |
if(right < ref.right) right = ref.right; | |
if(bottom < ref.bottom) bottom = ref.bottom; | |
return true; | |
} | |
#ifndef __TP_STUB_H__ | |
bool clip(const tTVPRect &ref) | |
{ | |
// Clip (take the intersection of) the rectangle with rectangle. | |
// returns whether the rectangle remains. | |
return TVPIntersectRect(this, *this, ref); | |
} | |
#endif | |
bool intersects_with_no_empty_check(const tTVPRect & ref) const | |
{ | |
// returns wether this has intersection with "ref" | |
return !( | |
left >= ref.right || | |
top >= ref.bottom || | |
right <= ref.left || | |
bottom <= ref.top ); | |
} | |
bool intersects_with(const tTVPRect & ref) const | |
{ | |
// returns wether this has intersection with "ref" | |
if(ref.is_empty() || is_empty()) return false; | |
return intersects_with_no_empty_check(ref); | |
} | |
bool included_in_no_empty_check(const tTVPRect & ref) const | |
{ | |
// returns wether this is included in "ref" | |
return | |
ref.left <= left && | |
ref.top <= top && | |
ref.right >= right && | |
ref.bottom >= bottom; | |
} | |
bool included_in(const tTVPRect & ref) const | |
{ | |
// returns wether this is included in "ref" | |
if(ref.is_empty() || is_empty()) return false; | |
return included_in_no_empty_check(ref); | |
} | |
public: // comparison operators for sorting | |
bool operator < (const tTVPRect & rhs) const | |
{ return top < rhs.top || (top == rhs.top && left < rhs.left); } | |
bool operator > (const tTVPRect & rhs) const | |
{ return top > rhs.top || (top == rhs.top && left > rhs.left); } | |
// comparison methods | |
bool operator == (const tTVPRect & rhs) const | |
{ return top == rhs.top && left == rhs.left && right == rhs.right && bottom == rhs.bottom; } | |
bool operator != (const tTVPRect & rhs) const { return !this->operator ==(rhs); } | |
}; | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// drawn face types | |
//--------------------------------------------------------------------------- | |
enum tTVPDrawFace | |
{ | |
dfBoth = 0, | |
dfAlpha = 0, | |
dfAddAlpha = 4, | |
dfMain = 1, | |
dfOpaque = 1, | |
dfMask = 2, | |
dfProvince = 3, | |
dfAuto = 128 // face is chosen automatically from the layer type | |
}; | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// alias to blending types | |
//--------------------------------------------------------------------------- | |
enum tTVPBlendOperationMode | |
{ | |
omPsNormal = ltPsNormal, | |
omPsAdditive = ltPsAdditive, | |
omPsSubtractive = ltPsSubtractive, | |
omPsMultiplicative = ltPsMultiplicative, | |
omPsScreen = ltPsScreen, | |
omPsOverlay = ltPsOverlay, | |
omPsHardLight = ltPsHardLight, | |
omPsSoftLight = ltPsSoftLight, | |
omPsColorDodge = ltPsColorDodge, | |
omPsColorDodge5 = ltPsColorDodge5, | |
omPsColorBurn = ltPsColorBurn, | |
omPsLighten = ltPsLighten, | |
omPsDarken = ltPsDarken, | |
omPsDifference = ltPsDifference, | |
omPsDifference5 = ltPsDifference5, | |
omPsExclusion = ltPsExclusion, | |
omAdditive = ltAdditive, | |
omSubtractive = ltSubtractive, | |
omMultiplicative = ltMultiplicative, | |
omDodge = ltDodge, | |
omDarken = ltDarken, | |
omLighten = ltLighten, | |
omScreen = ltScreen, | |
omAlpha = ltTransparent, | |
omAddAlpha = ltAddAlpha, | |
omOpaque = ltCoverRect, | |
omAuto = 128 // operation mode is guessed from the source layer type | |
}; | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// layer hit test type | |
//--------------------------------------------------------------------------- | |
enum tTVPHitType {htMask, htProvince}; | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// color key types | |
//--------------------------------------------------------------------------- | |
#define TVP_clAdapt ((tjs_uint32)(0x01ffffff)) | |
#define TVP_clNone ((tjs_uint32)(0x1fffffff)) | |
#define TVP_clPalIdx ((tjs_uint32)(0x03000000)) | |
#define TVP_clAlphaMat ((tjs_uint32)(0x04000000)) | |
#define TVP_Is_clPalIdx(n) ((tjs_uint32)(((n)&0xff000000) == TVP_clPalIdx)) | |
#define TVP_get_clPalIdx(n) ((tjs_uint32)((n)&0xff)) | |
#define TVP_Is_clAlphaMat(n) ((tjs_uint32)(((n)&0xff000000) == TVP_clAlphaMat)) | |
#define TVP_get_clAlphaMat(n) ((tjs_uint32)((n)&0xffffff)) | |
//--------------------------------------------------------------------------- | |
class tTJSNI_BaseLayer; | |
//--------------------------------------------------------------------------- | |
// abstract class of Layer Manager | |
//--------------------------------------------------------------------------- | |
class iTVPLayerManager | |
{ | |
public: | |
//-- object lifetime management | |
//! @brief 参照カウンタをインクリメントする | |
virtual void TJS_INTF_METHOD AddRef() = 0; | |
//! @brief 参照カウンタをデクリメントする | |
virtual void TJS_INTF_METHOD Release() = 0; | |
//-- draw device specific information | |
//! @brief 描画デバイス固有の情報を設定する | |
//! @param data 描画デバイス固有の情報 | |
//! @note 描画デバイス固有の情報をレイヤマネージャに設定する。 | |
//! レイヤマネージャではこの情報の中身については関知しない。 | |
//! 描画デバイス側で目印に使ったり、特定の情報と結びつけて管理する。 | |
virtual void TJS_INTF_METHOD SetDrawDeviceData(void * data) = 0; | |
//! @brief 描画デバイス固有の情報を取得する | |
//! @return 描画デバイス固有の情報 | |
virtual void * TJS_INTF_METHOD GetDrawDeviceData() const = 0; | |
//-- layer metrics | |
//! @brief プライマリレイヤのサイズを取得する | |
//! @param w レイヤの横幅(ピクセル単位) | |
//! @param h レイヤの縦幅(ピクセル単位) | |
//! @return 取得に成功すれば真、失敗すれば偽 | |
virtual bool TJS_INTF_METHOD GetPrimaryLayerSize(tjs_int &w, tjs_int &h) const = 0; | |
//-- layer structure information | |
//! @brief プライマリレイヤの取得 | |
//! @return プライマリレイヤ | |
virtual tTJSNI_BaseLayer * TJS_INTF_METHOD GetPrimaryLayer() const = 0; | |
//! @brief フォーカスのあるレイヤの取得 | |
//! @return フォーカスのあるレイヤ | |
virtual tTJSNI_BaseLayer * TJS_INTF_METHOD GetFocusedLayer() const = 0; | |
//! @brief フォーカスのあるレイヤの設定 | |
//! @param layer フォーカスのあるレイヤ | |
virtual void TJS_INTF_METHOD SetFocusedLayer(tTJSNI_BaseLayer * layer) = 0; | |
//-- HID releted | |
//! @brief クリックされた | |
//! @param x プライマリレイヤ座標上における x 位置 | |
//! @param y プライマリレイヤ座標上における y 位置 | |
virtual void TJS_INTF_METHOD NotifyClick(tjs_int x, tjs_int y) = 0; | |
//! @brief ダブルクリックされた | |
//! @param x プライマリレイヤ座標上における x 位置 | |
//! @param y プライマリレイヤ座標上における y 位置 | |
virtual void TJS_INTF_METHOD NotifyDoubleClick(tjs_int x, tjs_int y) = 0; | |
//! @brief マウスボタンが押下された | |
//! @param x プライマリレイヤ座標上における x 位置 | |
//! @param y プライマリレイヤ座標上における y 位置 | |
//! @param mb どのマウスボタンか | |
//! @param flags フラグ(TVP_SS_*定数の組み合わせ) | |
virtual void TJS_INTF_METHOD NotifyMouseDown(tjs_int x, tjs_int y, tTVPMouseButton mb, tjs_uint32 flags) = 0; | |
//! @brief マウスボタンが離された | |
//! @param x プライマリレイヤ座標上における x 位置 | |
//! @param y プライマリレイヤ座標上における y 位置 | |
//! @param mb どのマウスボタンか | |
//! @param flags フラグ(TVP_SS_*定数の組み合わせ) | |
virtual void TJS_INTF_METHOD NotifyMouseUp(tjs_int x, tjs_int y, tTVPMouseButton mb, tjs_uint32 flags) = 0; | |
//! @brief マウスが移動した | |
//! @param x プライマリレイヤ座標上における x 位置 | |
//! @param y プライマリレイヤ座標上における y 位置 | |
//! @param flags フラグ(TVP_SS_*定数の組み合わせ) | |
virtual void TJS_INTF_METHOD NotifyMouseMove(tjs_int x, tjs_int y, tjs_uint32 flags) = 0; | |
//! @brief マウスキャプチャを解放する | |
//! @note マウスキャプチャを解放すべき場合にウィンドウから呼ばれる。 | |
virtual void TJS_INTF_METHOD ReleaseCapture() = 0; | |
//! @brief マウスがプライマリレイヤ外に移動した | |
virtual void TJS_INTF_METHOD NotifyMouseOutOfWindow() = 0; | |
//! @brief キーが押された | |
//! @param key 仮想キーコード | |
//! @param shift シフトキーの状態 | |
virtual void TJS_INTF_METHOD NotifyKeyDown(tjs_uint key, tjs_uint32 shift) = 0; | |
//! @brief キーが離された | |
//! @param key 仮想キーコード | |
//! @param shift シフトキーの状態 | |
virtual void TJS_INTF_METHOD NotifyKeyUp(tjs_uint key, tjs_uint32 shift) = 0; | |
//! @brief キーによる入力 | |
//! @param key 文字コード | |
virtual void TJS_INTF_METHOD NotifyKeyPress(tjs_char key) = 0; | |
//! @brief マウスホイールが回転した | |
//! @param shift シフトキーの状態 | |
//! @param delta 回転角 | |
//! @param x プライマリレイヤ座標上における x 位置 | |
//! @param y プライマリレイヤ座標上における y 位置 | |
virtual void TJS_INTF_METHOD NotifyMouseWheel(tjs_uint32 shift, tjs_int delta, tjs_int x, tjs_int y) = 0; | |
//! @brief 画面がタッチされた | |
//! @param x 描画矩形内における x 位置(描画矩形の左上が原点) | |
//! @param y 描画矩形内における y 位置(描画矩形の左上が原点) | |
//! @param cx 触れている幅 | |
//! @param cy 触れている高さ | |
//! @param id タッチ識別用ID | |
virtual void TJS_INTF_METHOD NotifyTouchDown( tjs_real x, tjs_real y, tjs_real cx, tjs_real cy, tjs_uint32 id ) = 0; | |
//! @brief タッチが離された | |
//! @param x 描画矩形内における x 位置(描画矩形の左上が原点) | |
//! @param y 描画矩形内における y 位置(描画矩形の左上が原点) | |
//! @param cx 触れている幅 | |
//! @param cy 触れている高さ | |
//! @param id タッチ識別用ID | |
virtual void TJS_INTF_METHOD NotifyTouchUp( tjs_real x, tjs_real y, tjs_real cx, tjs_real cy, tjs_uint32 id ) = 0; | |
//! @brief タッチが移動した | |
//! @param x 描画矩形内における x 位置(描画矩形の左上が原点) | |
//! @param y 描画矩形内における y 位置(描画矩形の左上が原点) | |
//! @param cx 触れている幅 | |
//! @param cy 触れている高さ | |
//! @param id タッチ識別用ID | |
virtual void TJS_INTF_METHOD NotifyTouchMove( tjs_real x, tjs_real y, tjs_real cx, tjs_real cy, tjs_uint32 id ) = 0; | |
//! @brief 拡大タッチ操作が行われた | |
//! @param startdist 開始時の2点間の幅 | |
//! @param curdist 現在の2点間の幅 | |
//! @param cx 触れている幅 | |
//! @param cy 触れている高さ | |
//! @param flag タッチ状態フラグ | |
virtual void TJS_INTF_METHOD NotifyTouchScaling( tjs_real startdist, tjs_real curdist, tjs_real cx, tjs_real cy, tjs_int flag ) = 0; | |
//! @brief 回転タッチ操作が行われた | |
//! @param startangle 開始時の角度 | |
//! @param curangle 現在の角度 | |
//! @param dist 現在の2点間の幅 | |
//! @param cx 触れている幅 | |
//! @param cy 触れている高さ | |
//! @param flag タッチ状態フラグ | |
virtual void TJS_INTF_METHOD NotifyTouchRotate( tjs_real startangle, tjs_real curangle, tjs_real dist, tjs_real cx, tjs_real cy, tjs_int flag ) = 0; | |
//! @brief マルチタッチ状態が更新された | |
virtual void TJS_INTF_METHOD NotifyMultiTouch() = 0; | |
//! @brief 入力状態のチェック | |
//! @note ウィンドウから約1秒おきに、レイヤマネージャがユーザからの入力の状態を | |
//! 再チェックするために呼ばれる。レイヤ状態の変化がユーザの入力とは | |
//! 非同期に行われた場合、たとえばマウスカーソルの下にレイヤが出現した | |
//! のにもかかわらず、マウスカーソルがそのレイヤの指定する形状に変更されない | |
//! といった状況が発生しうる。このような状況に対処するため、ウィンドウから | |
//! このメソッドが約1秒おきに呼ばれる。 | |
virtual void TJS_INTF_METHOD RecheckInputState() = 0; | |
//-- invalidation/update | |
//! @brief 描画デバイスが望むレイヤの出力形式を設定する | |
//! @param type レイヤ形式 | |
//! @note デフォルトは ltOpaque 。描画デバイスが他の形式の画像を出力として | |
//! 望むならばその形式を指定する。ただし、プライマリレイヤの type | |
//! プロパティも同様に変更すること。 | |
virtual void TJS_INTF_METHOD SetDesiredLayerType(tTVPLayerType type) = 0; | |
//! @brief 特定の矩形の再描画を要求する | |
//! @param r プライマリレイヤ座標上における矩形 | |
//! @note 特定の矩形の再描画をレイヤマネージャに対して要求する。 | |
//! 要求は記録されるだけでこのメソッドはすぐに戻る。実際にそれが | |
//! 演算されるのは UpdateToDrawDevice() を呼んだときである。 | |
virtual void TJS_INTF_METHOD RequestInvalidation(const tTVPRect &r) = 0; // draw device -> layer | |
//! @brief 内容の再描画を行う | |
//! @note 内容の再描画を行う際に呼ぶ。このメソッド内では、レイヤマネージャは | |
//! iTVPDrawDevice::StartBitmapCompletion() | |
//! iTVPDrawDevice::NotifyBitmapCompleted() | |
//! iTVPDrawDevice::EndBitmapCompletion() の各メソッドを用い、 | |
//! いままでに変更が行われた領域などを順次描画デバイスに送る。 | |
virtual void TJS_INTF_METHOD UpdateToDrawDevice() = 0; | |
//-- debug assist | |
//! @brief (Window->DrawDevice) レイヤ構造をコンソールにダンプする | |
virtual void TJS_INTF_METHOD DumpLayerStructure() = 0; | |
}; | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// Window related constants | |
//--------------------------------------------------------------------------- | |
enum tTVPUpdateType | |
{ | |
utNormal, // only needed region | |
utEntire // entire of window | |
}; | |
//--------------------------------------------------------------------------- | |
enum tTVPBorderStyle | |
{ | |
bsNone=0, bsSingle=1, bsSizeable=2, bsDialog=3, bsToolWindow=4, | |
bsSizeToolWin =5 | |
}; | |
//--------------------------------------------------------------------------- | |
enum tTVPMouseCursorState | |
{ | |
mcsVisible, // the mouse cursor is visible | |
mcsTempHidden, // the mouse cursor is temporarily hidden | |
mcsHidden // the mouse cursor is invisible | |
}; | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
//! @brief Window basic interface | |
//--------------------------------------------------------------------------- | |
class iTVPWindow | |
{ | |
public: | |
//! @brief 元画像のサイズが変更された | |
//! @note 描画デバイスが、元画像のサイズが変更されたことを通知するために呼ぶ。 | |
//! ウィンドウは iTVPDrawDevice::GetSrcSize() を呼び出して元画像の | |
//! サイズを取得した後、ズームなどの計算を行ってから | |
//! iTVPDrawDevice::SetTargetWindow() を呼び出す。 | |
virtual void TJS_INTF_METHOD NotifySrcResize() = 0; | |
//! @brief マウスカーソルの形状をデフォルトに戻す | |
//! @note マウスカーソルの形状をデフォルトの物に戻したい場合に呼ぶ | |
virtual void TJS_INTF_METHOD SetDefaultMouseCursor() = 0; // set window mouse cursor to default | |
//! @brief マウスカーソルの形状を設定する | |
//! @param cursor マウスカーソル形状番号 | |
virtual void TJS_INTF_METHOD SetMouseCursor(tjs_int cursor) = 0; // set window mouse cursor | |
//! @brief マウスカーソルの位置を取得する | |
//! @param x 描画矩形内の座標におけるマウスカーソルのx位置 | |
//! @param y 描画矩形内の座標におけるマウスカーソルのy位置 | |
virtual void TJS_INTF_METHOD GetCursorPos(tjs_int &x, tjs_int &y) = 0; | |
// get mouse cursor position in primary layer's coordinates | |
//! @brief マウスカーソルの位置を設定する | |
//! @param x 描画矩形内の座標におけるマウスカーソルのx位置 | |
//! @param y 描画矩形内の座標におけるマウスカーソルのy位置 | |
virtual void TJS_INTF_METHOD SetCursorPos(tjs_int x, tjs_int y) = 0; | |
//! @brief ウィンドウのマウスキャプチャを解放する | |
//! @note ウィンドウのマウスキャプチャを解放すべき場合に呼ぶ。 | |
//! @note このメソッドでは基本的には ::ReleaseCapture() などで | |
//! マウスのキャプチャを開放すること。 | |
virtual void TJS_INTF_METHOD WindowReleaseCapture() = 0; | |
//! @brief ツールチップヒントを設定する | |
//! @param text ヒントテキスト(空文字列の場合はヒントの表示をキャンセルする) | |
virtual void TJS_INTF_METHOD SetHintText(iTJSDispatch2* sender, const ttstr & text) = 0; | |
//! @brief 注視ポイントの設定 | |
//! @param layer フォント情報の含まれるレイヤ | |
//! @param x 描画矩形内の座標における注視ポイントのx位置 | |
//! @param y 描画矩形内の座標における注視ポイントのy位置 | |
virtual void TJS_INTF_METHOD SetAttentionPoint(tTJSNI_BaseLayer *layer, | |
tjs_int l, tjs_int t) = 0; | |
//! @brief 注視ポイントの解除 | |
virtual void TJS_INTF_METHOD DisableAttentionPoint() = 0; | |
//! @brief IMEモードの設定 | |
//! @param mode IMEモード | |
virtual void TJS_INTF_METHOD SetImeMode(tTVPImeMode mode) = 0; | |
//! @brief IMEモードのリセット | |
virtual void TJS_INTF_METHOD ResetImeMode() = 0; | |
//! @brief iTVPWindow::Update() の呼び出しを要求する | |
//! @note ウィンドウに対して iTVPWindow::Update() を次の適当なタイミングで | |
//! 呼び出すことを要求する。 | |
//! iTVPWindow::Update() が呼び出されるまでは何回 RequestUpdate() を | |
//! 呼んでも効果は同じである。また、一度 iTVPWindow::Update() が | |
//! 呼び出されると、再び RequestUpdate() を呼ばない限りは | |
//! iTVPWindow::Update() は呼ばれない。 | |
virtual void TJS_INTF_METHOD RequestUpdate() = 0; | |
//! @brief WindowのiTJSDispatch2インターフェースを取得する | |
virtual iTJSDispatch2 * GetWindowDispatch() = 0; | |
}; | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// window message receivers | |
//--------------------------------------------------------------------------- | |
enum tTVPWMRRegMode { wrmRegister=0, wrmUnregister=1 }; | |
#pragma pack(push, 4) | |
struct tTVPWindowMessage | |
{ | |
unsigned int Msg; // window message | |
WPARAM WParam; // WPARAM | |
LPARAM LParam; // LPARAM | |
LRESULT Result; // result | |
}; | |
#pragma pack(pop) | |
typedef bool (__stdcall * tTVPWindowMessageReceiver) | |
(void *userdata, tTVPWindowMessage *Message); | |
#define TVP_WM_DETACH (WM_USER+106) // before re-generating the window | |
#define TVP_WM_ATTACH (WM_USER+107) // after re-generating the window | |
#define TVP_WM_FULLSCREEN_CHANGING (WM_USER+108) // before full-screen or window changing | |
#define TVP_WM_FULLSCREEN_CHANGED (WM_USER+109) // after full-screen or window changing | |
//--------------------------------------------------------------------------- | |
// Direct3D former declaration | |
//--------------------------------------------------------------------------- | |
#ifndef DIRECT3D_VERSION | |
struct IDirect3D9; | |
#endif | |
//--------------------------------------------------------------------------- | |
//! @brief 描画デバイスインターフェース | |
//--------------------------------------------------------------------------- | |
class iTVPDrawDevice | |
{ | |
public: | |
//---- オブジェクト生存期間制御 | |
//! @brief (Window→DrawDevice) 描画デバイスを破棄する | |
//! @note ウィンドウが破棄されるとき、あるいはほかの描画デバイスが | |
//! 設定されたためにこの描画デバイスが必要なくなった際に呼ばれる。 | |
//! 通常、ここでは delete this を実行し、描画デバイスを破棄するが、その前に | |
//! AddLayerManager() でこの描画デバイスの管理下に入っている | |
//! レイヤマネージャをすべて Release する。 | |
//! レイヤマネージャの Release 中に RemoveLayerManager() が呼ばれる | |
//! 可能性があることに注意すること。 | |
virtual void TJS_INTF_METHOD Destruct() = 0; | |
//---- window interface 関連 | |
//! @brief (Window→DrawDevice) ウィンドウインターフェースを設定する | |
//! @param window ウィンドウインターフェース | |
//! @note (TJSから) Window.drawDevice プロパティを設定した直後に呼ばれる。 | |
virtual void TJS_INTF_METHOD SetWindowInterface(iTVPWindow * window) = 0; | |
//---- LayerManager の管理関連 | |
//! @brief (Window→DrawDevice) レイヤマネージャを追加する | |
//! @note プライマリレイヤがウィンドウに追加されると、自動的にレイヤマネージャが | |
//! 作成され、それが描画デバイスにもこのメソッドの呼び出しにて通知される。 | |
//! 描画デバイスでは iTVPLayerManager::AddRef() を呼び出して、追加された | |
//! レイヤマネージャをロックすること。 | |
virtual void TJS_INTF_METHOD AddLayerManager(iTVPLayerManager * manager) = 0; | |
//! @brief (Window→DrawDevice) レイヤマネージャを削除する | |
//! @note プライマリレイヤが invalidate される際に呼び出される。 | |
//TODO: プライマリレイヤ無効化、あるいはウィンドウ破棄時の終了処理が正しいか? | |
virtual void TJS_INTF_METHOD RemoveLayerManager(iTVPLayerManager * manager) = 0; | |
//---- 描画位置・サイズ関連 | |
//! @brief (Window→DrawDevice) 描画先ウィンドウの設定 | |
//! @param wnd ウィンドウハンドル | |
//! @param is_main メインウィンドウの場合に真 | |
//! @note ウィンドウから描画先となるウィンドウハンドルを指定するために呼ばれる。 | |
//! しばしば、Window.borderStyle プロパティが変更されたり、フルスクリーンに | |
//! 移行するときやフルスクリーンから戻る時など、ウィンドウが再作成される | |
//! ことがあるが、そのような場合には、ウィンドウがいったん破棄される直前に | |
//! wnd = NULL の状態でこのメソッドが呼ばれることに注意。ウィンドウが作成 | |
//! されたあと、再び有効なウィンドウハンドルを伴ってこのメソッドが呼ばれる。 | |
//! このメソッドは、ウィンドウが作成された直後に呼ばれる保証はない。 | |
//! たいてい、一番最初にウィンドウが表示された直後に呼ばれる。 | |
virtual void TJS_INTF_METHOD SetTargetWindow(HWND wnd, bool is_main) = 0; | |
//! @brief (Window->DrawDevice) 描画矩形の設定 | |
//! @note ウィンドウから、描画先となる矩形を設定するために呼ばれる。 | |
//! 描画デバイスは、SetTargetWindow() で指定されたウィンドウのクライアント領域の、 | |
//! このメソッドで指定された矩形に表示を行う必要がある。 | |
//! この矩形は、GetSrcSize で返した値に対し、Window.zoomNumer や Window.zoomDenum | |
//! プロパティによる拡大率や、Window.layerLeft や Window.layerTop が加味された | |
//! 矩形である。 | |
//! このメソッドによって描画矩形が変わったとしても、このタイミングで | |
//! 描画デバイス側で再描画を行う必要はない(必要があれば別メソッドにより | |
//! 再描画の必要性が通知されるため)。 | |
virtual void TJS_INTF_METHOD SetDestRectangle(const tTVPRect & rect) = 0; | |
//! @brief (Window->DrawDevice) クリッピング矩形の設定 | |
//! @note ウィンドウから、描画先をクリッピングするための矩形を設定するために呼ばれる。 | |
//! 描画デバイスは、SetDestRectangleで指定された領域を、このメソッドで指定された矩形 | |
//! でクリッピングを行い表示を行う必要がある。 | |
//! このメソッドによって描画領域が変わったとしても、このタイミングで | |
//! 描画デバイス側で再描画を行う必要はない(必要があれば別メソッドにより | |
//! 再描画の必要性が通知されるため)。 | |
virtual void TJS_INTF_METHOD SetClipRectangle(const tTVPRect & rect) = 0; | |
//! @brief (Window->DrawDevice) 元画像のサイズを得る | |
//! @note ウィンドウから、描画矩形のサイズを決定するために元画像のサイズが | |
//! 必要になった際に呼ばれる。ウィンドウはこれをもとに SetDestRectangle() | |
//! メソッドで描画矩形を通知してくるだけなので、 | |
//! なんらかの意味のあるサイズである必要は必ずしもない。 | |
virtual void TJS_INTF_METHOD GetSrcSize(tjs_int &w, tjs_int &h) = 0; | |
//! @brief (LayerManager→DrawDevice) レイヤサイズ変更の通知 | |
//! @param manager レイヤマネージャ | |
//! @note レイヤマネージャにアタッチされているプライマリレイヤのサイズが変わった | |
//! 際に呼び出される | |
virtual void TJS_INTF_METHOD NotifyLayerResize(iTVPLayerManager * manager) = 0; | |
//! @brief (LayerManager→DrawDevice) レイヤの画像の変更の通知 | |
//! @param manager レイヤマネージャ | |
//! @note レイヤの画像に変化があった際に呼び出される。 | |
//! この通知を受け取った後に iTVPLayerManager::UpdateToDrawDevice() | |
//! を呼び出せば、該当部分を描画デバイスに対して描画させることができる。 | |
//! この通知を受け取っても無視することは可能。その場合は、 | |
//! 次に iTVPLayerManager::UpdateToDrawDevice() を呼んだ際に、 | |
//! それまでの変更分がすべて描画される。 | |
virtual void TJS_INTF_METHOD NotifyLayerImageChange(iTVPLayerManager * manager) = 0; | |
//---- ユーザーインターフェース関連 | |
//! @brief (Window→DrawDevice) クリックされた | |
//! @param x 描画矩形内における x 位置(描画矩形の左上が原点) | |
//! @param y 描画矩形内における y 位置(描画矩形の左上が原点) | |
virtual void TJS_INTF_METHOD OnClick(tjs_int x, tjs_int y) = 0; | |
//! @brief (Window→DrawDevice) ダブルクリックされた | |
//! @param x 描画矩形内における x 位置(描画矩形の左上が原点) | |
//! @param y 描画矩形内における y 位置(描画矩形の左上が原点) | |
virtual void TJS_INTF_METHOD OnDoubleClick(tjs_int x, tjs_int y) = 0; | |
//! @brief (Window→DrawDevice) マウスボタンが押下された | |
//! @param x 描画矩形内における x 位置(描画矩形の左上が原点) | |
//! @param y 描画矩形内における y 位置(描画矩形の左上が原点) | |
//! @param mb どのマウスボタンか | |
//! @param flags フラグ(TVP_SS_*定数の組み合わせ) | |
virtual void TJS_INTF_METHOD OnMouseDown(tjs_int x, tjs_int y, tTVPMouseButton mb, tjs_uint32 flags) = 0; | |
//! @brief (Window→DrawDevice) マウスボタンが離された | |
//! @param x 描画矩形内における x 位置(描画矩形の左上が原点) | |
//! @param y 描画矩形内における y 位置(描画矩形の左上が原点) | |
//! @param mb どのマウスボタンか | |
//! @param flags フラグ(TVP_SS_*定数の組み合わせ) | |
virtual void TJS_INTF_METHOD OnMouseUp(tjs_int x, tjs_int y, tTVPMouseButton mb, tjs_uint32 flags) = 0; | |
//! @brief (Window→DrawDevice) マウスが移動した | |
//! @param x 描画矩形内における x 位置(描画矩形の左上が原点) | |
//! @param y 描画矩形内における y 位置(描画矩形の左上が原点) | |
//! @param flags フラグ(TVP_SS_*定数の組み合わせ) | |
virtual void TJS_INTF_METHOD OnMouseMove(tjs_int x, tjs_int y, tjs_uint32 flags) = 0; | |
//! @brief (Window→DrawDevice) レイヤのマウスキャプチャを解放する | |
//! @note レイヤのマウスキャプチャを解放すべき場合にウィンドウから呼ばれる。 | |
//! @note WindowReleaseCapture() と混同しないこと。 | |
virtual void TJS_INTF_METHOD OnReleaseCapture() = 0; | |
//! @brief (Window→DrawDevice) マウスが描画矩形外に移動した | |
virtual void TJS_INTF_METHOD OnMouseOutOfWindow() = 0; | |
//! @brief (Window→DrawDevice) キーが押された | |
//! @param key 仮想キーコード | |
//! @param shift シフトキーの状態 | |
virtual void TJS_INTF_METHOD OnKeyDown(tjs_uint key, tjs_uint32 shift) = 0; | |
//! @brief (Window→DrawDevice) キーが離された | |
//! @param key 仮想キーコード | |
//! @param shift シフトキーの状態 | |
virtual void TJS_INTF_METHOD OnKeyUp(tjs_uint key, tjs_uint32 shift) = 0; | |
//! @brief (Window→DrawDevice) キーによる入力 | |
//! @param key 文字コード | |
virtual void TJS_INTF_METHOD OnKeyPress(tjs_char key) = 0; | |
//! @brief (Window→DrawDevice) マウスホイールが回転した | |
//! @param shift シフトキーの状態 | |
//! @param delta 回転角 | |
//! @param x 描画矩形内における x 位置(描画矩形の左上が原点) | |
//! @param y 描画矩形内における y 位置(描画矩形の左上が原点) | |
virtual void TJS_INTF_METHOD OnMouseWheel(tjs_uint32 shift, tjs_int delta, tjs_int x, tjs_int y) = 0; | |
//! @brief (Window→DrawDevice) 画面がタッチされた | |
//! @param x 描画矩形内における x 位置(描画矩形の左上が原点) | |
//! @param y 描画矩形内における y 位置(描画矩形の左上が原点) | |
//! @param cx 触れている幅 | |
//! @param cy 触れている高さ | |
//! @param id タッチ識別用ID | |
virtual void TJS_INTF_METHOD OnTouchDown( tjs_real x, tjs_real y, tjs_real cx, tjs_real cy, tjs_uint32 id ) = 0; | |
//! @brief (Window→DrawDevice) タッチが離された | |
//! @param x 描画矩形内における x 位置(描画矩形の左上が原点) | |
//! @param y 描画矩形内における y 位置(描画矩形の左上が原点) | |
//! @param cx 触れている幅 | |
//! @param cy 触れている高さ | |
//! @param id タッチ識別用ID | |
virtual void TJS_INTF_METHOD OnTouchUp( tjs_real x, tjs_real y, tjs_real cx, tjs_real cy, tjs_uint32 id ) = 0; | |
//! @brief (Window→DrawDevice) タッチが移動した | |
//! @param x 描画矩形内における x 位置(描画矩形の左上が原点) | |
//! @param y 描画矩形内における y 位置(描画矩形の左上が原点) | |
//! @param cx 触れている幅 | |
//! @param cy 触れている高さ | |
//! @param id タッチ識別用ID | |
virtual void TJS_INTF_METHOD OnTouchMove( tjs_real x, tjs_real y, tjs_real cx, tjs_real cy, tjs_uint32 id ) = 0; | |
//! @brief (Window→DrawDevice) 拡大タッチ操作が行われた | |
//! @param startdist 開始時の2点間の幅 | |
//! @param curdist 現在の2点間の幅 | |
//! @param cx 触れている幅 | |
//! @param cy 触れている高さ | |
//! @param flag タッチ状態フラグ | |
virtual void TJS_INTF_METHOD OnTouchScaling( tjs_real startdist, tjs_real curdist, tjs_real cx, tjs_real cy, tjs_int flag ) = 0; | |
//! @brief (Window→DrawDevice) 回転タッチ操作が行われた | |
//! @param startangle 開始時の角度 | |
//! @param curangle 現在の角度 | |
//! @param dist 現在の2点間の幅 | |
//! @param cx 触れている幅 | |
//! @param cy 触れている高さ | |
//! @param flag タッチ状態フラグ | |
virtual void TJS_INTF_METHOD OnTouchRotate( tjs_real startangle, tjs_real curangle, tjs_real dist, tjs_real cx, tjs_real cy, tjs_int flag ) = 0; | |
//! @brief (Window→DrawDevice) マルチタッチ状態が更新された | |
virtual void TJS_INTF_METHOD OnMultiTouch() = 0; | |
//! @brief (Window->DrawDevice) 画面の回転が行われた | |
//! @param orientation 画面の向き ( 横向き、縦向き、不明 ) | |
//! @param rotate 回転角度。Degree。負の値の時不明 | |
//! @param bpp Bits per pixel | |
//! @param width 画面幅 | |
//! @param height 画面高さ | |
virtual void TJS_INTF_METHOD OnDisplayRotate( tjs_int orientation, tjs_int rotate, tjs_int bpp, tjs_int width, tjs_int height ) = 0; | |
//! @brief (Window->DrawDevice) 入力状態のチェック | |
//! @note ウィンドウから約1秒おきに、レイヤマネージャがユーザからの入力の状態を | |
//! 再チェックするために呼ばれる。レイヤ状態の変化がユーザの入力とは | |
//! 非同期に行われた場合、たとえばマウスカーソルの下にレイヤが出現した | |
//! のにもかかわらず、マウスカーソルがそのレイヤの指定する形状に変更されない | |
//! といった状況が発生しうる。このような状況に対処するため、ウィンドウから | |
//! このメソッドが約1秒おきに呼ばれる。 | |
virtual void TJS_INTF_METHOD RecheckInputState() = 0; | |
//! @brief (LayerManager→DrawDevice) マウスカーソルの形状をデフォルトに戻す | |
//! @param manager レイヤマネージャ | |
//! @note マウスカーソルの形状をデフォルトの物に戻したい場合に呼ばれる | |
virtual void TJS_INTF_METHOD SetDefaultMouseCursor(iTVPLayerManager * manager) = 0; | |
//! @brief (LayerManager→DrawDevice) マウスカーソルの形状を設定する | |
//! @param manager レイヤマネージャ | |
//! @param cursor マウスカーソル形状番号 | |
virtual void TJS_INTF_METHOD SetMouseCursor(iTVPLayerManager * manager, tjs_int cursor) = 0; | |
//! @brief (LayerManager→DrawDevice) マウスカーソルの位置を取得する | |
//! @param manager レイヤマネージャ | |
//! @param x プライマリレイヤ上の座標におけるマウスカーソルのx位置 | |
//! @param y プライマリレイヤ上の座標におけるマウスカーソルのy位置 | |
//! @note 座標はプライマリレイヤ上の座標なので、必要ならば変換を行う | |
virtual void TJS_INTF_METHOD GetCursorPos(iTVPLayerManager * manager, tjs_int &x, tjs_int &y) = 0; | |
//! @brief (LayerManager→DrawDevice) マウスカーソルの位置を設定する | |
//! @param manager レイヤマネージャ | |
//! @param x プライマリレイヤ上の座標におけるマウスカーソルのx位置 | |
//! @param y プライマリレイヤ上の座標におけるマウスカーソルのy位置 | |
//! @note 座標はプライマリレイヤ上の座標なので、必要ならば変換を行う | |
virtual void TJS_INTF_METHOD SetCursorPos(iTVPLayerManager * manager, tjs_int x, tjs_int y) = 0; | |
//! @brief (LayerManager→DrawDevice) ウィンドウのマウスキャプチャを解放する | |
//! @param manager レイヤマネージャ | |
//! @note ウィンドウのマウスキャプチャを解放すべき場合にレイヤマネージャから呼ばれる。 | |
//! @note ウィンドウのマウスキャプチャは OnReleaseCapture() で開放できるレイヤのマウスキャプチャ | |
//! と異なることに注意。ウィンドウのマウスキャプチャは主にOSのウィンドウシステムの | |
//! 機能であるが、レイヤのマウスキャプチャは吉里吉里がレイヤマネージャごとに | |
//! 独自に管理している物である。このメソッドでは基本的には ::ReleaseCapture() などで | |
//! マウスのキャプチャを開放する。 | |
virtual void TJS_INTF_METHOD WindowReleaseCapture(iTVPLayerManager * manager) = 0; | |
//! @brief (LayerManager→DrawDevice) ツールチップヒントを設定する | |
//! @param manager レイヤマネージャ | |
//! @param text ヒントテキスト(空文字列の場合はヒントの表示をキャンセルする) | |
virtual void TJS_INTF_METHOD SetHintText(iTVPLayerManager * manager, iTJSDispatch2* sender, const ttstr & text) = 0; | |
//! @brief (LayerManager→DrawDevice) 注視ポイントの設定 | |
//! @param manager レイヤマネージャ | |
//! @param layer フォント情報の含まれるレイヤ | |
//! @param x プライマリレイヤ上の座標における注視ポイントのx位置 | |
//! @param y プライマリレイヤ上の座標における注視ポイントのy位置 | |
//! @note 注視ポイントは通常キャレット位置のことで、そこにIMEのコンポジット・ウィンドウが | |
//! 表示されたり、ユーザ補助の拡大鏡がそこを拡大したりする。IMEがコンポジットウィンドウを | |
//! 表示したり、未確定の文字をそこに表示したりする際のフォントは layer パラメータ | |
//! で示されるレイヤが持つ情報によるが、プラグインからその情報を得たり設定したり | |
//! するインターフェースは今のところない。 | |
//! @note 座標はプライマリレイヤ上の座標なので、必要ならば変換を行う。 | |
virtual void TJS_INTF_METHOD SetAttentionPoint(iTVPLayerManager * manager, tTJSNI_BaseLayer *layer, | |
tjs_int l, tjs_int t) = 0; | |
//! @brief (LayerManager→DrawDevice) 注視ポイントの解除 | |
//! @param manager レイヤマネージャ | |
virtual void TJS_INTF_METHOD DisableAttentionPoint(iTVPLayerManager * manager) = 0; | |
//! @brief (LayerManager→DrawDevice) IMEモードの設定 | |
//! @param manager レイヤマネージャ | |
//! @param mode IMEモード | |
virtual void TJS_INTF_METHOD SetImeMode(iTVPLayerManager * manager, tTVPImeMode mode) = 0; | |
//! @brief (LayerManager→DrawDevice) IMEモードのリセット | |
//! @param manager レイヤマネージャ | |
virtual void TJS_INTF_METHOD ResetImeMode(iTVPLayerManager * manager) = 0; | |
//---- プライマリレイヤ関連 | |
//! @brief (Window→DrawDevice) プライマリレイヤの取得 | |
//! @return プライマリレイヤ | |
//! @note Window.primaryLayer が読み出された際にこのメソッドが呼ばれる。 | |
//! それ以外に呼ばれることはない。 | |
virtual tTJSNI_BaseLayer * TJS_INTF_METHOD GetPrimaryLayer() = 0; | |
//! @brief (Window→DrawDevice) フォーカスのあるレイヤの取得 | |
//! @return フォーカスのあるレイヤ(NULL=フォーカスのあるレイヤがない場合) | |
//! @note Window.focusedLayer が読み出された際にこのメソッドが呼ばれる。 | |
//! それ以外に呼ばれることはない。 | |
virtual tTJSNI_BaseLayer * TJS_INTF_METHOD GetFocusedLayer() = 0; | |
//! @brief (Window→DrawDevice) フォーカスのあるレイヤの設定 | |
//! @param layer フォーカスのあるレイヤ(NULL=フォーカスのあるレイヤがない状態にしたい場合) | |
//! @note Window.focusedLayer が書き込まれた際にこのメソッドが呼ばれる。 | |
//! それ以外に呼ばれることはない。 | |
virtual void TJS_INTF_METHOD SetFocusedLayer(tTJSNI_BaseLayer * layer) = 0; | |
//---- 再描画関連 | |
//! @brief (Window→DrawDevice) 描画矩形の無効化の通知 | |
//! @param rect 描画矩形内の座標における、無効になった領域 | |
//! (描画矩形の左上が原点) | |
//! @note 描画矩形の一部あるいは全部が無効になった際にウィンドウから通知される。 | |
//! 描画デバイスは、なるべく早い時期に無効になった部分を再描画すべきである。 | |
virtual void TJS_INTF_METHOD RequestInvalidation(const tTVPRect & rect) = 0; | |
//! @brief (Window→DrawDevice) 更新の要求 | |
//! @note 描画矩形の内容を最新の状態に更新すべきタイミングで、ウィンドウから呼ばれる。 | |
//! iTVPWindow::RequestUpdate() を呼んだ後、システムが描画タイミングに入った際に | |
//! 呼ばれる。通常、描画デバイスはこのタイミングを利用してオフスクリーン | |
//! サーフェースに画像を描画する。 | |
virtual void TJS_INTF_METHOD Update() = 0; | |
//! @brief (Window->DrawDevice) 画像の表示 | |
//! @note オフスクリーンサーフェースに描画された画像を、オンスクリーンに表示する | |
//! (あるいはフリップする) タイミングで呼ばれる。通常は Update の直後に | |
//! 呼ばれるが、VSync 待ちが有効になっている場合は Update 直後ではなく、 | |
//! VBlank 中に呼ばれる可能性がある。オフスクリーンサーフェースを | |
//! 使わない場合は無視してかまわない。 | |
virtual void TJS_INTF_METHOD Show() = 0; | |
//---- LayerManager からの画像受け渡し関連 | |
//! @brief (LayerManager->DrawDevice) ビットマップの描画を開始する | |
//! @param manager 描画を開始するレイヤマネージャ | |
//! @note レイヤマネージャから描画デバイスへ画像が転送される前に呼ばれる。 | |
//! このあと、NotifyBitmapCompleted() が任意の回数呼ばれ、最後に | |
//! EndBitmapCompletion() が呼ばれる。 | |
//! 必要ならば、このタイミングで描画デバイス側でサーフェースのロックなどを | |
//! 行うこと。 | |
virtual void TJS_INTF_METHOD StartBitmapCompletion(iTVPLayerManager * manager) = 0; | |
//! @brief (LayerManager->DrawDevice) ビットマップの描画を通知する | |
//! @param manager 画像の提供元のレイヤマネージャ | |
//! @param x プライマリレイヤ上の座標における画像の左端位置 | |
//! @param y プライマリレイヤ上の座標における画像の上端位置 | |
//! @param bits ビットマップデータ | |
//! @param bitmapinfo ビットマップの形式情報 | |
//! @param cliprect bits のうち、どの部分を使って欲しいかの情報 | |
//! @param type 提供される画像が想定する合成モード | |
//! @param opacity 提供される画像が想定する不透明度(0~255) | |
//! @note レイヤマネージャが合成を完了し、結果を描画デバイスに描画してもらいたい際に | |
//! 呼ばれる。一つの更新が複数の矩形で構成される場合があるため、このメソッドは | |
//! StartBitmapCompletion() と EndBitmapCompletion() の間に複数回呼ばれる可能性がある。 | |
//! 基本的には、bits と bitmapinfo で表されるビットマップのうち、cliprect で | |
//! 示される矩形を x, y 位置に転送すればよいが、描画矩形の大きさに合わせた | |
//! 拡大や縮小などは描画デバイス側で面倒を見る必要がある。 | |
virtual void TJS_INTF_METHOD NotifyBitmapCompleted(iTVPLayerManager * manager, | |
tjs_int x, tjs_int y, const void * bits, const BITMAPINFO * bitmapinfo, | |
const tTVPRect &cliprect, tTVPLayerType type, tjs_int opacity) = 0; | |
//! @brief (LayerManager->DrawDevice) ビットマップの描画を終了する | |
//! @param manager 描画を終了するレイヤマネージャ | |
virtual void TJS_INTF_METHOD EndBitmapCompletion(iTVPLayerManager * manager) = 0; | |
//---- デバッグ支援 | |
//! @brief (Window->DrawDevice) レイヤ構造をコンソールにダンプする | |
virtual void TJS_INTF_METHOD DumpLayerStructure() = 0; | |
//! @brief (Window->DrawDevice) 更新矩形の表示を行うかどうかを設定する | |
//! @param b 表示を行うかどうか | |
//! @note レイヤ表示機構が差分更新を行う際の矩形を表示し、 | |
//! 差分更新の最適化に役立てるための支援機能。 | |
//! 実装する必要はないが、実装することが望ましい。 | |
virtual void TJS_INTF_METHOD SetShowUpdateRect(bool b) = 0; | |
//! @brief (Window->DrawDevice) フルスクリーン化する | |
//! @param window ウィンドウハンドル | |
//! @param w 要求する幅 | |
//! @param h 要求する高さ | |
//! @param bpp Bit per pixels | |
//! @param color 16bpp の時 565 か 555を指定 | |
//! @param changeresolution 解像度変更を行うかどうか | |
virtual bool TJS_INTF_METHOD SwitchToFullScreen( HWND window, tjs_uint w, tjs_uint h, tjs_uint bpp, tjs_uint color, bool changeresolution ) = 0; | |
//! @brief (Window->DrawDevice) フルスクリーンを解除する | |
//! @param window ウィンドウハンドル | |
//! @param w 要求する幅 | |
//! @param h 要求する高さ | |
//! @param bpp 元々のBit per pixels | |
//! @param color 16bpp の時 565 か 555を指定 | |
virtual void TJS_INTF_METHOD RevertFromFullScreen( HWND window, tjs_uint w, tjs_uint h, tjs_uint bpp, tjs_uint color ) = 0; | |
//! @brief (Window->DrawDevice) VBlank待ちを行う | |
//! @param in_vblank 待たなくてもVBlank内だったかどうかを返す( !0 : 内、0: 外 ) | |
//! @param delayed 1フレーム遅延が発生したかどうかを返す( !0 : 発生、0: 発生せず ) | |
//! @return Wait可不可 true : 可能、false : 不可 | |
virtual bool TJS_INTF_METHOD WaitForVBlank( tjs_int* in_vblank, tjs_int* delayed ) = 0; | |
}; | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// tTVPVideoOverlayMode | |
//--------------------------------------------------------------------------- | |
#ifdef __BORLANDC__ | |
#pragma warn .8027 | |
#endif | |
//--------------------------------------------------------------------------- | |
// Stub library setup | |
//--------------------------------------------------------------------------- | |
extern bool TVPInitImportStub(iTVPFunctionExporter * exporter); | |
extern void TVPUninitImportStub(); | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// Global reference count | |
//--------------------------------------------------------------------------- | |
extern tjs_int TVPPluginGlobalRefCount; | |
//--------------------------------------------------------------------------- | |
//--------------------------------------------------------------------------- | |
// exception protected function stub | |
//--------------------------------------------------------------------------- | |
extern tjs_uint Try_iTJSDispatch2_AddRef(iTJSDispatch2 * _this); | |
extern tjs_uint Try_iTJSDispatch2_Release(iTJSDispatch2 * _this); | |
extern tjs_error Try_iTJSDispatch2_FuncCall(iTJSDispatch2 * _this, tjs_uint32 flag, const tjs_char * membername, tjs_uint32 *hint, tTJSVariant *result, tjs_int numparams, tTJSVariant **param, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_FuncCallByNum(iTJSDispatch2 * _this, tjs_uint32 flag, tjs_int num, tTJSVariant *result, tjs_int numparams, tTJSVariant **param, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_PropGet(iTJSDispatch2 * _this, tjs_uint32 flag, const tjs_char * membername, tjs_uint32 *hint, tTJSVariant *result, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_PropGetByNum(iTJSDispatch2 * _this, tjs_uint32 flag, tjs_int num, tTJSVariant *result, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_PropSet(iTJSDispatch2 * _this, tjs_uint32 flag, const tjs_char *membername, tjs_uint32 *hint, const tTJSVariant *param, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_PropSetByNum(iTJSDispatch2 * _this, tjs_uint32 flag, tjs_int num, const tTJSVariant *param, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_GetCount(iTJSDispatch2 * _this, tjs_int *result, const tjs_char *membername, tjs_uint32 *hint, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_GetCountByNum(iTJSDispatch2 * _this, tjs_int *result, tjs_int num, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_PropSetByVS(iTJSDispatch2 * _this, tjs_uint32 flag, tTJSVariantString *membername, const tTJSVariant *param, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_EnumMembers(iTJSDispatch2 * _this, tjs_uint32 flag, tTJSVariantClosure *callback, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_DeleteMember(iTJSDispatch2 * _this, tjs_uint32 flag, const tjs_char *membername, tjs_uint32 *hint, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_DeleteMemberByNum(iTJSDispatch2 * _this, tjs_uint32 flag, tjs_int num, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_Invalidate(iTJSDispatch2 * _this, tjs_uint32 flag, const tjs_char *membername, tjs_uint32 *hint, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_InvalidateByNum(iTJSDispatch2 * _this, tjs_uint32 flag, tjs_int num, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_IsValid(iTJSDispatch2 * _this, tjs_uint32 flag, const tjs_char *membername, tjs_uint32 *hint, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_IsValidByNum(iTJSDispatch2 * _this, tjs_uint32 flag, tjs_int num, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_CreateNew(iTJSDispatch2 * _this, tjs_uint32 flag, const tjs_char * membername, tjs_uint32 *hint, iTJSDispatch2 **result, tjs_int numparams, tTJSVariant **param, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_CreateNewByNum(iTJSDispatch2 * _this, tjs_uint32 flag, tjs_int num, iTJSDispatch2 **result, tjs_int numparams, tTJSVariant **param, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_Reserved1(iTJSDispatch2 * _this); | |
extern tjs_error Try_iTJSDispatch2_IsInstanceOf(iTJSDispatch2 * _this, tjs_uint32 flag, const tjs_char *membername, tjs_uint32 *hint, const tjs_char *classname, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_IsInstanceOfByNum(iTJSDispatch2 * _this, tjs_uint32 flag, tjs_int num, const tjs_char *classname, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_Operation(iTJSDispatch2 * _this, tjs_uint32 flag, const tjs_char *membername, tjs_uint32 *hint, tTJSVariant *result, const tTJSVariant *param, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_OperationByNum(iTJSDispatch2 * _this, tjs_uint32 flag, tjs_int num, tTJSVariant *result, const tTJSVariant *param, iTJSDispatch2 *objthis); | |
extern tjs_error Try_iTJSDispatch2_NativeInstanceSupport(iTJSDispatch2 * _this, tjs_uint32 flag, tjs_int32 classid, iTJSNativeInstance **pointer); | |
extern tjs_error Try_iTJSDispatch2_ClassInstanceInfo(iTJSDispatch2 * _this, tjs_uint32 flag, tjs_uint num, tTJSVariant *value); | |
extern tjs_error Try_iTJSDispatch2_Reserved2(iTJSDispatch2 * _this); | |
extern tjs_error Try_iTJSDispatch2_Reserved3(iTJSDispatch2 * _this); | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment